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 JSContactName.h
19 * @author Kisub Song (kisubs.song@samsung.com)
21 * @brief Declaration of the JSContactName class
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_NAME_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_NAME_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/ContactName.h>
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::ContactNamePtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactNamePriv;
42 * This initializes this JS class in the JS Engine.
44 static JSClassRef getClassRef();
46 static JSValueRef createJSObject(JSContextRef context,
47 const std::string& prefix,
48 const std::string& firstName,
49 const std::string& middleName,
50 const std::string& lastName,
51 const TizenApis::Api::Contact::StringArrayPtr& nicknames,
52 const std::string& phoneticName,
53 const std::string& displayName);
55 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
57 static TizenApis::Api::Contact::ContactNamePtr getContactName(JSContextRef context, JSValueRef value);
61 * The callback invoked when an object is first created.
63 static void Initialize(JSContextRef context, JSObjectRef object);
66 * The callback invoked when an object is finalized.
68 static void Finalize(JSObjectRef object);
71 * This structure contains properties and callbacks that define a type of object.
73 static JSClassDefinition m_classInfo;
76 * This structure describes a statically declared function property.
78 static JSStaticFunction m_functions[];
81 * This member variable contains the initialization values for the static properties of this class.
82 * The values are given according to the data structure JSPropertySpec
84 static JSStaticValue m_property[];
86 static JSClassRef m_classRef;
88 static TizenApis::Api::Contact::ContactNamePtr getPrivData(JSObjectRef object);
90 static JSValueRef getPrefix(JSContextRef context,
92 JSStringRef propertyName,
93 JSValueRef* exception);
95 static bool setPrefix(JSContextRef context,
97 JSStringRef propertyName,
99 JSValueRef* exception);
101 static JSValueRef getFirstName(JSContextRef context,
103 JSStringRef propertyName,
104 JSValueRef* exception);
106 static bool setFirstName(JSContextRef context,
108 JSStringRef propertyName,
110 JSValueRef* exception);
112 static JSValueRef getMiddleName(JSContextRef context,
114 JSStringRef propertyName,
115 JSValueRef* exception);
117 static bool setMiddleName(JSContextRef context,
119 JSStringRef propertyName,
121 JSValueRef* exception);
123 static JSValueRef getLastName(JSContextRef context,
125 JSStringRef propertyName,
126 JSValueRef* exception);
128 static bool setLastName(JSContextRef context,
130 JSStringRef propertyName,
132 JSValueRef* exception);
134 static JSValueRef getNicknames(JSContextRef context,
136 JSStringRef propertyName,
137 JSValueRef* exception);
139 static bool setNicknames(JSContextRef context,
141 JSStringRef propertyName,
143 JSValueRef* exception);
145 static JSValueRef getPhoneticName(JSContextRef context,
147 JSStringRef propertyName,
148 JSValueRef* exception);
150 static bool setPhoneticName(JSContextRef context,
152 JSStringRef propertyName,
154 JSValueRef* exception);
156 static JSValueRef getDisplayName(JSContextRef context,
158 JSStringRef propertyName,
159 JSValueRef* exception);
161 static bool setDisplayName(JSContextRef context,
163 JSStringRef propertyName,
165 JSValueRef* exception);
173 #endif // _TIZEN_CONTACT_JS_CONTACT_NAME_H_