tizen 2.3.1 release
[framework/web/mobile/wrt-plugins-tizen.git] / src / Account / JSAccount.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef __TIZEN_JS_ACCOUNT_H__
19 #define __TIZEN_JS_ACCOUNT_H__
20
21 #include <JavaScriptCore/JavaScript.h>
22
23 #include "Account.h"
24
25 namespace DeviceAPI {
26 namespace Account {
27
28 class JSAccount
29 {
30 public:
31     static const JSClassDefinition* getClassInfo();
32     static const JSClassRef getClassRef();
33
34     static JSObjectRef constructor(JSContextRef context,
35             JSObjectRef constructor,
36             size_t argumentCount,
37             const JSValueRef arguments[],
38             JSValueRef* exception);
39
40     static AccountPtr getPrivateObject(JSContextRef context, JSValueRef value);
41     static void setPrivateObject(JSObjectRef object, AccountPtr priv);
42     static JSObjectRef makeJSObject(JSContextRef context, AccountPtr native);
43 private:
44
45     /**
46      * The callback invoked when an object is first created.
47      */
48     static void initialize(JSContextRef context,
49             JSObjectRef object);
50
51     /**
52      * The callback invoked when an object is finalized.
53      */
54     static void finalize(JSObjectRef object);
55
56     static JSValueRef setExtendedData(JSContextRef context,
57             JSObjectRef object,
58             JSObjectRef thisObject,
59             size_t argumentCount,
60             const JSValueRef arguments[],
61             JSValueRef* exception);
62
63     static JSValueRef getExtendedData(JSContextRef context,
64             JSObjectRef object,
65             JSObjectRef thisObject,
66             size_t argumentCount,
67             const JSValueRef arguments[],
68             JSValueRef* exception);
69
70     /**
71      * This member variable contains the values which has to be passed
72      * when the this class is embedded into JS Engine.
73      */
74     static JSClassDefinition m_classInfo;
75
76     /**
77      * This structure describes a statically declared function property.
78      */
79     static JSStaticFunction m_function[];
80
81         /**
82         * The callback invoked when getting a property's value.
83         */
84         static JSValueRef getProperty(JSContextRef context,
85                 JSObjectRef object,
86                 JSStringRef propertyName,
87                 JSValueRef* exception);
88
89         /**
90         * The callback invoked when setting a property's value.
91         */
92         static bool setProperty(JSContextRef context,
93                 JSObjectRef object,
94                 JSStringRef propertyName,
95                 JSValueRef value,
96                 JSValueRef* exception);
97
98     /**
99      * This member variable contains the initialization values for the
100      * properties of this class. The values are given according to
101      * the data structure JSPropertySpec
102      */
103     static JSStaticValue m_property[];
104
105     static JSClassRef m_jsClassRef;
106 };
107
108 } // Account
109 } // DeviceAPI
110
111 #endif // __TIZEN_JS_ACCOUNT_H__