f200ca63e9bcfc4b669966e76b07f379e32bf4e9
[framework/web/wrt-plugins-tizen.git] / src / Contact / JSContactAddress.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        JSContactAddress.h
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief       Declaration of the JSContactAddress class
23  */
24
25 #ifndef _TIZEN_CONTACT_JS_CONTACT_ADDRESS_H_
26 #define _TIZEN_CONTACT_JS_CONTACT_ADDRESS_H_
27
28 #include <JavaScriptCore/JavaScript.h>
29 #include <dpl/shared_ptr.h>
30 #include <CommonsJavaScript/PrivateObject.h>
31 #include <Commons/IEvent.h>
32 #include "ContactAddress.h"
33
34 namespace DeviceAPI {
35 namespace Contact {
36
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<ContactAddressPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactAddressPriv;
38
39 class JSContactAddress {
40 public:
41         /*
42         * This initializes this JS class in the JS Engine.
43         */
44         static JSClassRef getClassRef();
45
46         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
47
48         static ContactAddressPtr getContactAddress(JSContextRef context, JSValueRef value);
49
50 private:
51    /**
52         * The callback invoked when an object is first created.
53         */
54         static void Initialize(JSContextRef context, JSObjectRef object);
55
56    /**
57         * The callback invoked when an object is finalized.
58         */
59         static void Finalize(JSObjectRef object);
60
61    /**
62         * This structure contains properties and callbacks that define a type of object.
63         */
64         static JSClassDefinition m_classInfo;
65
66    /**
67         * This structure describes a statically declared function property.
68         */
69         static JSStaticFunction m_functions[];
70
71         /**
72          * This member variable contains the initialization values for the static properties of this class.
73          * The values are given according to the data structure JSPropertySpec
74          */
75         static JSStaticValue m_property[];
76
77         static JSClassRef m_classRef;
78
79         static JSObjectRef createJSObject(JSContextRef context, const ContactAddressPtr contactAddress);
80
81         static ContactAddressPtr getPrivData(JSObjectRef object);
82
83         static JSObjectRef constructor(JSContextRef context,
84                         JSObjectRef constructor,
85                         size_t argumentCount,
86                         const JSValueRef arguments[],
87                         JSValueRef* exception);
88
89         static bool hasInstance(JSContextRef context,
90                         JSObjectRef constructor,
91                         JSValueRef possibleInstance,
92                         JSValueRef* exception);
93
94         static JSValueRef getCountry(JSContextRef context,
95                         JSObjectRef object,
96                         JSStringRef propertyName,
97                         JSValueRef* exception);
98
99         static bool setCountry(JSContextRef context,
100                         JSObjectRef object,
101                         JSStringRef propertyName,
102                         JSValueRef value,
103                         JSValueRef* exception);
104
105         static JSValueRef getRegion(JSContextRef context,
106                         JSObjectRef object,
107                         JSStringRef propertyName,
108                         JSValueRef* exception);
109
110         static bool setRegion(JSContextRef context,
111                         JSObjectRef object,
112                         JSStringRef propertyName,
113                         JSValueRef value,
114                         JSValueRef* exception);
115
116         static JSValueRef getCity(JSContextRef context,
117                         JSObjectRef object,
118                         JSStringRef propertyName,
119                         JSValueRef* exception);
120
121         static bool setCity(JSContextRef context,
122                         JSObjectRef object,
123                         JSStringRef propertyName,
124                         JSValueRef value,
125                         JSValueRef* exception);
126
127         static JSValueRef getStreetAddress(JSContextRef context,
128                         JSObjectRef object,
129                         JSStringRef propertyName,
130                         JSValueRef* exception);
131
132         static bool setStreetAddress(JSContextRef context,
133                         JSObjectRef object,
134                         JSStringRef propertyName,
135                         JSValueRef value,
136                         JSValueRef* exception);
137
138         static JSValueRef getAdditionalInformation(JSContextRef context,
139                         JSObjectRef object,
140                         JSStringRef propertyName,
141                         JSValueRef* exception);
142
143         static bool setAdditionalInformation(JSContextRef context,
144                         JSObjectRef object,
145                         JSStringRef propertyName,
146                         JSValueRef value,
147                         JSValueRef* exception);
148
149         static JSValueRef getPostalCode(JSContextRef context,
150                         JSObjectRef object,
151                         JSStringRef propertyName,
152                         JSValueRef* exception);
153
154         static bool setPostalCode(JSContextRef context,
155                         JSObjectRef object,
156                         JSStringRef propertyName,
157                         JSValueRef value,
158                         JSValueRef* exception);
159
160         static JSValueRef getIsDefault(JSContextRef context,
161                         JSObjectRef object,
162                         JSStringRef propertyName,
163                         JSValueRef* exception);
164
165         static bool setIsDefault(JSContextRef context,
166                         JSObjectRef object,
167                         JSStringRef propertyName,
168                         JSValueRef value,
169                         JSValueRef* exception);
170
171         static JSValueRef getTypes(JSContextRef context,
172                         JSObjectRef object,
173                         JSStringRef propertyName,
174                         JSValueRef* exception);
175
176         static bool setTypes(JSContextRef context,
177                         JSObjectRef object,
178                         JSStringRef propertyName,
179                         JSValueRef value,
180                         JSValueRef* exception);
181 };
182
183 } // Contact
184 } // DeviceAPI
185
186 #endif // _TIZEN_CONTACT_JS_CONTACT_ADDRESS_H_