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 <parcel.h> 20 #include <string> 21 #include <set> 22 #include <map> 23 24 namespace OHOS { 25 namespace Location { 26 class GeoAddress : public Parcelable { 27 public: 28 GeoAddress(); 29 virtual ~GeoAddress() = 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 m_latitude; 38 double m_longitude; 39 std::string m_localeLanguage; 40 std::string m_localeCountry; 41 std::string m_placeName; 42 std::string m_countryCode; 43 std::string m_countryName; 44 std::string m_administrativeArea; 45 std::string m_subAdministrativeArea; 46 std::string m_locality; 47 std::string m_subLocality; 48 std::string m_roadName; 49 std::string m_subRoadName; 50 std::string m_premises; 51 std::string m_postalCode; 52 std::string m_phoneNumber; 53 std::string m_addressUrl; 54 std::map<int, std::string> m_descriptions; 55 int m_descriptionsSize = 0; 56 bool m_hasLatitude = false; 57 bool m_hasLongitude = false; 58 static constexpr double PARCEL_INT_SIZE = 64.0; 59 static constexpr int MAX_PARCEL_SIZE = 100; 60 static constexpr int MAX_RESULT = 10; 61 }; 62 } // namespace Location 63 } // namespace OHOS 64 #endif // GEO_ADDRESS_H 65