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.
24 #ifndef _JS_ACCOUNT_H_
25 #define _JS_ACCOUNT_H_
29 #include <JavaScriptCore/JavaScript.h>
30 #include <CommonsJavaScript/PrivateObject.h>
31 #include <API/Account/EventAccount.h>
32 #include <API/Account/log.h>
34 using namespace TizenApis::Api::Account;
35 using namespace WrtDeviceApis::Commons;
36 using namespace WrtDeviceApis::CommonsJavaScript;
42 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<EventAccountPtr>::Type AccountPrivateObject;
48 static const JSClassDefinition* getClassInfo();
50 static JSClassRef getClassRef();
52 //TODO: check if createJSAccount is necessary.
53 static JSObjectRef createJSAccount(JSContextRef context, EventAccountPtr event);
56 static EventAccountPtr getIEvent(JSObjectRef object);
58 static void setIEvent(const EventAccountPtr &account,
60 const JSObjectRef object);
62 static bool validate(JSContextRef ctx,
63 const JSObjectRef object,
64 JSValueRef* exception);
69 * The callback invoked when an object is first created.
71 static void initialize(JSContextRef context, JSObjectRef object);
74 * The callback invoked when an object is finalized.
76 static void finalize(JSObjectRef object);
78 static JSValueRef getProperty(JSContextRef context,
80 JSStringRef propertyName,
81 JSValueRef* exception);
83 static bool setProperty(JSContextRef context,
85 JSStringRef propertyName,
87 JSValueRef* exception);
89 static JSValueRef getServices(JSContextRef context,
91 JSStringRef propertyName,
92 JSValueRef* exception);
94 static bool setServices(JSContextRef context,
96 JSStringRef propertyName,
98 JSValueRef* exception);
100 static JSObjectRef constructor(JSContextRef context,
102 size_t argumentCount,
103 const JSValueRef arguments[],
104 JSValueRef* exception);
107 * The callback invoked when an object is used as the target of an 'instanceof' expression.
109 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
112 static JSClassRef m_jsClassRef;
115 * This structure contains properties and callbacks that define a type of object.
117 static JSClassDefinition m_classInfo;
120 * This member variable contains the initialization values for the static properties of this class.
121 * The values are given according to the data structure JSPropertySpec
123 static JSStaticValue m_property[];
129 #endif /* _JS_ATTENDEE_H_ */