f296dc9e44bffe1d1493a046b9b9985857c14de6
[framework/web/wrt-plugins-common.git] / src / modules / API / Contact / ContactAddress.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file        ContactEmail.h
18  * @author      Lukasz Marek (l.marek@samsung.com)
19  * @version     0.1
20  */
21
22 #ifndef WRTDEVICEAPIS_CONTACT_CONTACT_ADDRESS_H_
23 #define WRTDEVICEAPIS_CONTACT_CONTACT_ADDRESS_H_
24
25 #include <string>
26 #include <vector>
27 #include <dpl/shared_ptr.h>
28
29 namespace WrtDeviceApis {
30 namespace Contact {
31 namespace Api {
32
33 class ContactAddress;
34
35 typedef DPL::SharedPtr<ContactAddress> ContactAddressPtr;
36 typedef std::vector<ContactAddressPtr> ContactAddressPtrList;
37
38 /* This object represents an address data of a contact */
39 class ContactAddress
40 {
41   public:
42
43     typedef enum
44     {
45         CONTACT_ADDRESS_TYPE_WORK,
46         CONTACT_ADDRESS_TYPE_PREF,
47         CONTACT_ADDRESS_TYPE_HOME
48     } ContactAddressType;
49
50     ContactAddress();
51     ~ContactAddress();
52
53     int getId() const;
54     void setId(int value);
55
56     std::string getCountry() const;
57     void setCountry(const std::string &value);
58
59     std::string getRegion() const;
60     void setRegion(const std::string &value);
61
62     std::string getCounty() const;
63     void setCounty(const std::string &value);
64
65     std::string getCity() const;
66     void setCity(const std::string &value);
67
68     std::string getStreet() const;
69     void setStreet(const std::string &value);
70
71     std::string getStreetNumber() const;
72     void setStreetNumber(const std::string &value);
73
74     std::string getPremises() const;
75     void setPremises(const std::string &value);
76
77     std::string getAdditionalInformation() const;
78     void setAdditionalInformation(const std::string &value);
79
80     std::string getPostalCode() const;
81     void setPostalCode(const std::string &value);
82
83     std::vector<ContactAddressType> getTypes() const;
84     void addType(const ContactAddressType value);
85     void setTypes(const std::vector<ContactAddressType> &value);
86     bool isTypeOf(const ContactAddressType value) const;
87     void setTypeFilter(const ContactAddressType value);
88     ContactAddressType getTypeFilter() const;
89
90     //returns m_country, ..., m_postalCode
91     //fields concatenated into single string
92     std::string getAsSingleString() const;
93     std::string getAddress() const;
94     void setAddress(const std::string &value);
95
96     bool compareTo(const ContactAddressPtr &address,
97             bool includeId = false,
98             bool includeTypes = false) const;
99     ContactAddressPtr clone() const;
100
101     bool getCountryIsSet() const;
102     bool getRegionIsSet() const;
103     bool getCountyIsSet() const;
104     bool getCityIsSet() const;
105     bool getStreetIsSet() const;
106     bool getStreetNumberIsSet() const;
107     bool getPremisesIsSet() const;
108     bool getAdditionalInformationIsSet() const;
109     bool getPostalCodeIsSet() const;
110
111   private:
112     int m_id;
113     std::string m_country;
114     std::string m_region;
115     std::string m_county;
116     std::string m_city;
117     std::string m_street;
118     std::string m_streetNumber;
119     std::string m_premises;
120     std::string m_additionalInformation;
121     std::string m_postalCode;
122     std::vector<ContactAddressType> m_types;
123
124     //this field is free form fieldand should not be used.
125     //it holds data used by Jil standard, but fields
126     //m_country, ..., m_postalCode should be used instead
127     std::string m_address;
128
129     bool m_countryIsSet;
130     bool m_regionIsSet;
131     bool m_countyIsSet;
132     bool m_cityIsSet;
133     bool m_streetIsSet;
134     bool m_streetNumberIsSet;
135     bool m_premisesIsSet;
136     bool m_additionalInformationIsSet;
137     bool m_postalCodeIsSet;
138 };
139
140 }
141 }
142 }
143
144 #endif // WRTDEVICEAPIS_CONTACT_CONTACT_ADDRESS_H_