d0c52ae84a471357443d49259b20c78789a374e0
[framework/web/wrt-plugins-tizen.git] / src / Contact / ContactAddress.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        ContactAddress.h
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief
23  */
24
25 #ifndef _API_CONTACT_CONTACT_ADDRESS_H_
26 #define _API_CONTACT_CONTACT_ADDRESS_H_
27
28 #include <string>
29 #include <vector>
30 #include <dpl/shared_ptr.h>
31 #include "ContactTypes.h"
32 #include <JavaScriptCore/JavaScript.h>
33
34 namespace DeviceAPI {
35 namespace Contact {
36
37 class ContactAddress;
38 typedef DPL::SharedPtr<ContactAddress> ContactAddressPtr;
39
40 typedef std::vector<ContactAddressPtr> ContactAddressArray;
41 typedef DPL::SharedPtr<ContactAddressArray> ContactAddressArrayPtr;
42
43 typedef std::vector<ContactAddressType> ContactAddressTypeArray;
44 typedef DPL::SharedPtr<ContactAddressTypeArray> ContactAddressTypeArrayPtr;
45
46 /* This object represents an address data of a contact */
47 class ContactAddress
48 {
49 public:
50         ContactAddress();
51         ~ContactAddress();
52
53         std::string getCountry() const;
54         void setCountry(const std::string &value);
55         void unsetCountry();
56         bool getCountryIsSet() const;
57
58         std::string getRegion() const;
59         void setRegion(const std::string &value);
60         void unsetRegion();
61         bool getRegionIsSet() const;
62
63         std::string getCity() const;
64         void setCity(const std::string &value);
65         void unsetCity();
66         bool getCityIsSet() const;
67
68         std::string getStreetAddress() const;
69         void setStreetAddress(const std::string &value);
70         void unsetStreetAddress();
71         bool getStreetAddressIsSet() const;
72
73         std::string getAdditionalInformation() const;
74         void setAdditionalInformation(const std::string &value);
75         void unsetAdditionalInformation();
76         bool getAdditionalInformationIsSet() const;
77
78         std::string getPostalCode() const;
79         void setPostalCode(const std::string &value);
80         void unsetPostalCode();
81         bool getPostalCodeIsSet() const;
82
83         bool getIsDefault() const;
84         void setIsDefault(const bool &value);
85
86         ContactAddressTypeArrayPtr getTypes() const;
87         void setTypes(const ContactAddressTypeArrayPtr &value);
88         void addType(const ContactAddressType &value);
89         bool isTypeOf(const ContactAddressType &value) const;
90         int getTypesNum() const;
91
92         //returns m_country, ..., m_postalCode
93         //fields concatenated into single string
94         std::string getAsSingleString() const;
95
96         bool compareTo(const ContactAddressPtr &address,
97                                         bool includeId = false,
98                                         bool includeTypes = false) const;
99         void clear();
100         ContactAddressPtr clone() const;
101
102         void setTypesJSArray(bool value, JSObjectRef initValue);
103         JSValueRef getTypesJSArray();
104         JSObjectRef getTypesJSObj();
105         bool IsTypesSetJSArray() const;
106         void resetTypesJSObj();
107
108         void setContext(JSContextRef contextRef);
109         JSContextRef getContext();
110
111 private:
112         std::string     m_country;
113         bool            m_countryIsSet;
114
115         std::string     m_region;
116         bool            m_regionIsSet;
117
118         std::string     m_city;
119         bool            m_cityIsSet;
120
121         std::string     m_streetAddress;
122         bool            m_streetAddressIsSet;
123
124         std::string     m_additionalInformation;
125         bool            m_additionalInformationIsSet;
126
127         std::string     m_postalCode;
128         bool            m_postalCodeIsSet;
129
130         bool            m_isDefault;
131
132         ContactAddressTypeArrayPtr m_types;
133
134         bool is_typesSetJSArray;
135         JSValueRef m_typesJsValue;
136         JSObjectRef m_typesObj;
137
138         JSContextRef m_context;
139
140 };
141
142 } // Contact
143 } // DeviceAPI
144
145 #endif // _API_CONTACT_CONTACT_ADDRESS_H_