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 JSContactOrganization.h
19 * @author Kisub Song (kisubs.song@samsung.com)
21 * @brief Declaration of the JSContactOrganization class
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_ORGANIZATION_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_ORGANIZATION_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/ContactOrganization.h>
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::ContactOrganizationPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactOrganizationPriv;
39 class JSContactOrganization {
42 * This initializes this JS class in the JS Engine.
44 static JSClassRef getClassRef();
46 static JSValueRef createJSObject(JSContextRef context,
47 const std::string& name,
48 const std::string& department,
49 const std::string& office,
50 const std::string& title,
51 const std::string& role,
52 const std::string& logoURI);
54 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
56 static TizenApis::Api::Contact::ContactOrganizationPtr getContactOrganization(JSContextRef context, JSValueRef value);
60 * The callback invoked when an object is first created.
62 static void Initialize(JSContextRef context, JSObjectRef object);
65 * The callback invoked when an object is finalized.
67 static void Finalize(JSObjectRef object);
70 * This structure contains properties and callbacks that define a type of object.
72 static JSClassDefinition m_classInfo;
75 * This structure describes a statically declared function property.
77 static JSStaticFunction m_functions[];
80 * This member variable contains the initialization values for the static properties of this class.
81 * The values are given according to the data structure JSPropertySpec
83 static JSStaticValue m_property[];
85 static JSClassRef m_classRef;
87 static TizenApis::Api::Contact::ContactOrganizationPtr getPrivData(JSObjectRef object);
89 static JSValueRef getName(JSContextRef context,
91 JSStringRef propertyName,
92 JSValueRef* exception);
94 static bool setName(JSContextRef context,
96 JSStringRef propertyName,
98 JSValueRef* exception);
100 static JSValueRef getDepartment(JSContextRef context,
102 JSStringRef propertyName,
103 JSValueRef* exception);
105 static bool setDepartment(JSContextRef context,
107 JSStringRef propertyName,
109 JSValueRef* exception);
111 static JSValueRef getOffice(JSContextRef context,
113 JSStringRef propertyName,
114 JSValueRef* exception);
116 static bool setOffice(JSContextRef context,
118 JSStringRef propertyName,
120 JSValueRef* exception);
122 static JSValueRef getTitle(JSContextRef context,
124 JSStringRef propertyName,
125 JSValueRef* exception);
127 static bool setTitle(JSContextRef context,
129 JSStringRef propertyName,
131 JSValueRef* exception);
133 static JSValueRef getRole(JSContextRef context,
135 JSStringRef propertyName,
136 JSValueRef* exception);
138 static bool setRole(JSContextRef context,
140 JSStringRef propertyName,
142 JSValueRef* exception);
144 static JSValueRef getLogoURI(JSContextRef context,
146 JSStringRef propertyName,
147 JSValueRef* exception);
149 static bool setLogoURI(JSContextRef context,
151 JSStringRef propertyName,
153 JSValueRef* exception);
160 #endif // _TIZEN_CONTACT_JS_CONTACT_ORGANIZATION_H_