1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef GEO_ADDRESS_H 17 #define GEO_ADDRESS_H 18 19 #include <map> 20 #include <mutex> 21 #include <parcel.h> 22 #include <string> 23 24 namespace OHOS { 25 namespace Location { 26 class GeoAddress : public Parcelable { 27 public: 28 GeoAddress(); 29 ~GeoAddress() override = default; 30 bool Marshalling(Parcel& parcel) const override; 31 static std::unique_ptr<GeoAddress> Unmarshalling(Parcel& parcel); 32 std::string GetDescriptions(int index); 33 double GetLatitude(); 34 double GetLongitude(); 35 void ReadFromParcel(Parcel& in); 36 37 double latitude_; 38 double longitude_; 39 std::string locale_; 40 std::string placeName_; 41 std::string countryCode_; 42 std::string countryName_; 43 std::string administrativeArea_; 44 std::string subAdministrativeArea_; 45 std::string locality_; 46 std::string subLocality_; 47 std::string roadName_; 48 std::string subRoadName_; 49 std::string premises_; 50 std::string postalCode_; 51 std::string phoneNumber_; 52 std::string addressUrl_; 53 std::mutex mutex_; 54 std::map<int, std::string> descriptions_; 55 int descriptionsSize_ = 0; 56 bool isFromMock_ = false; 57 static constexpr double PARCEL_INT_SIZE = 64.0; 58 static constexpr int MAX_RESULT = 10; 59 }; 60 } // namespace Location 61 } // namespace OHOS 62 #endif // GEO_ADDRESS_H 63