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     bool GetIsSystemApp();
37     void SetIsSystemApp(bool isSystemApp);
38 
39     double latitude_;
40     double longitude_;
41     std::string locale_;
42     std::string placeName_;
43     std::string countryCode_;
44     std::string countryName_;
45     std::string administrativeArea_;
46     std::string subAdministrativeArea_;
47     std::string locality_;
48     std::string subLocality_;
49     std::string roadName_;
50     std::string subRoadName_;
51     std::string premises_;
52     std::string postalCode_;
53     std::string phoneNumber_;
54     std::string addressUrl_;
55     std::mutex mutex_;
56     std::map<int, std::string> descriptions_;
57     int descriptionsSize_ = 0;
58     bool isFromMock_ = false;
59     bool isSystemApp_ = false;
60     static constexpr double PARCEL_INT_SIZE = 64.0;
61     static constexpr int MAX_RESULT = 10;
62 };
63 } // namespace Location
64 } // namespace OHOS
65 #endif // GEO_ADDRESS_H
66