2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file ContactAddress.h
20 * @author Kisub Song (kisubs.song@samsung.com)
25 #ifndef _API_CONTACT_CONTACT_ADDRESS_H_
26 #define _API_CONTACT_CONTACT_ADDRESS_H_
30 #include <dpl/shared_ptr.h>
31 #include "ContactTypes.h"
32 #include <JavaScriptCore/JavaScript.h>
38 typedef DPL::SharedPtr<ContactAddress> ContactAddressPtr;
40 typedef std::vector<ContactAddressPtr> ContactAddressArray;
41 typedef DPL::SharedPtr<ContactAddressArray> ContactAddressArrayPtr;
43 typedef std::vector<ContactAddressType> ContactAddressTypeArray;
44 typedef DPL::SharedPtr<ContactAddressTypeArray> ContactAddressTypeArrayPtr;
46 /* This object represents an address data of a contact */
53 std::string getCountry() const;
54 void setCountry(const std::string &value);
56 bool getCountryIsSet() const;
58 std::string getRegion() const;
59 void setRegion(const std::string &value);
61 bool getRegionIsSet() const;
63 std::string getCity() const;
64 void setCity(const std::string &value);
66 bool getCityIsSet() const;
68 std::string getStreetAddress() const;
69 void setStreetAddress(const std::string &value);
70 void unsetStreetAddress();
71 bool getStreetAddressIsSet() const;
73 std::string getAdditionalInformation() const;
74 void setAdditionalInformation(const std::string &value);
75 void unsetAdditionalInformation();
76 bool getAdditionalInformationIsSet() const;
78 std::string getPostalCode() const;
79 void setPostalCode(const std::string &value);
80 void unsetPostalCode();
81 bool getPostalCodeIsSet() const;
83 bool getIsDefault() const;
84 void setIsDefault(const bool &value);
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;
92 //returns m_country, ..., m_postalCode
93 //fields concatenated into single string
94 std::string getAsSingleString() const;
96 bool compareTo(const ContactAddressPtr &address,
97 bool includeId = false,
98 bool includeTypes = false) const;
100 ContactAddressPtr clone() const;
102 void setTypesJSArray(bool value, JSObjectRef initValue);
103 JSValueRef getTypesJSArray();
104 JSObjectRef getTypesJSObj();
105 bool IsTypesSetJSArray() const;
106 void resetTypesJSObj();
108 void setContext(JSContextRef contextRef);
109 JSContextRef getContext();
112 std::string m_country;
115 std::string m_region;
121 std::string m_streetAddress;
122 bool m_streetAddressIsSet;
124 std::string m_additionalInformation;
125 bool m_additionalInformationIsSet;
127 std::string m_postalCode;
128 bool m_postalCodeIsSet;
132 ContactAddressTypeArrayPtr m_types;
134 bool is_typesSetJSArray;
135 JSValueRef m_typesJsValue;
136 JSObjectRef m_typesObj;
138 JSContextRef m_context;
145 #endif // _API_CONTACT_CONTACT_ADDRESS_H_