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 JSContactAccount.h
19 * @author Kisub Song (kisubs.song@samsung.com)
21 * @brief Declaration of the JSContactAccount class
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_ACCOUNT_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_ACCOUNT_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/ContactAccount.h>
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::ContactAccountPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactAccountPriv;
39 class JSContactAccount {
42 * This initializes this JS class in the JS Engine.
44 static JSClassRef getClassRef();
46 static JSValueRef createJSObject(JSContextRef context,
47 const std::string& accountId,
48 const std::string& contactURI);
50 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
52 static TizenApis::Api::Contact::ContactAccountPtr getContactAccount(JSContextRef context, JSValueRef value);
56 * The callback invoked when an object is first created.
58 static void Initialize(JSContextRef context, JSObjectRef object);
61 * The callback invoked when an object is finalized.
63 static void Finalize(JSObjectRef object);
66 * This structure contains properties and callbacks that define a type of object.
68 static JSClassDefinition m_classInfo;
71 * This structure describes a statically declared function property.
73 static JSStaticFunction m_functions[];
76 * This member variable contains the initialization values for the static properties of this class.
77 * The values are given according to the data structure JSPropertySpec
79 static JSStaticValue m_property[];
81 static JSClassRef m_classRef;
83 static TizenApis::Api::Contact::ContactAccountPtr getPrivData(JSObjectRef object);
85 static JSValueRef getAccountId(JSContextRef context,
87 JSStringRef propertyName,
88 JSValueRef* exception);
90 static bool setAccountId(JSContextRef context,
92 JSStringRef propertyName,
94 JSValueRef* exception);
96 static JSValueRef getContactURI(JSContextRef context,
98 JSStringRef propertyName,
99 JSValueRef* exception);
101 static bool setContactURI(JSContextRef context,
103 JSStringRef propertyName,
105 JSValueRef* exception);
112 #endif // _TIZEN_CONTACT_JS_CONTACT_ACCOUNT_H_