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