2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file JSContactAddress.h
19 * @author Kisub Song (kisubs.song@samsung.com)
21 * @brief Declaration of the JSContactAddress class
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_ADDRESS_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_ADDRESS_H_
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"
38 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::ContactAddressPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactAddressPriv;
40 class JSContactAddress {
43 * This initializes this JS class in the JS Engine.
45 static JSClassRef getClassRef();
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()));
57 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
59 static TizenApis::Api::Contact::ContactAddressPtr getContactAddress(JSContextRef context, JSValueRef value);
63 * The callback invoked when an object is first created.
65 static void Initialize(JSContextRef context, JSObjectRef object);
68 * The callback invoked when an object is finalized.
70 static void Finalize(JSObjectRef object);
73 * This structure contains properties and callbacks that define a type of object.
75 static JSClassDefinition m_classInfo;
78 * This structure describes a statically declared function property.
80 static JSStaticFunction m_functions[];
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
86 static JSStaticValue m_property[];
88 static JSClassRef m_classRef;
90 static TizenApis::Api::Contact::ContactAddressPtr getPrivData(JSObjectRef object);
92 static JSValueRef getCountry(JSContextRef context,
94 JSStringRef propertyName,
95 JSValueRef* exception);
97 static bool setCountry(JSContextRef context,
99 JSStringRef propertyName,
101 JSValueRef* exception);
103 static JSValueRef getRegion(JSContextRef context,
105 JSStringRef propertyName,
106 JSValueRef* exception);
108 static bool setRegion(JSContextRef context,
110 JSStringRef propertyName,
112 JSValueRef* exception);
114 static JSValueRef getCity(JSContextRef context,
116 JSStringRef propertyName,
117 JSValueRef* exception);
119 static bool setCity(JSContextRef context,
121 JSStringRef propertyName,
123 JSValueRef* exception);
125 static JSValueRef getStreetAddress(JSContextRef context,
127 JSStringRef propertyName,
128 JSValueRef* exception);
130 static bool setStreetAddress(JSContextRef context,
132 JSStringRef propertyName,
134 JSValueRef* exception);
136 static JSValueRef getAdditionalInformation(JSContextRef context,
138 JSStringRef propertyName,
139 JSValueRef* exception);
141 static bool setAdditionalInformation(JSContextRef context,
143 JSStringRef propertyName,
145 JSValueRef* exception);
147 static JSValueRef getPostalCode(JSContextRef context,
149 JSStringRef propertyName,
150 JSValueRef* exception);
152 static bool setPostalCode(JSContextRef context,
154 JSStringRef propertyName,
156 JSValueRef* exception);
158 static JSValueRef getTypes(JSContextRef context,
160 JSStringRef propertyName,
161 JSValueRef* exception);
163 static bool setTypes(JSContextRef context,
165 JSStringRef propertyName,
167 JSValueRef* exception);
174 #endif // _TIZEN_CONTACT_JS_CONTACT_ADDRESS_H_