Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Account / old / JSAccountService.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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. 
15  */
16
17
18 /*
19  * @file        JSAccountService.h
20  * @author      Jihwa Park (jh7979.park@samsung.com)
21  * @author      Sangtai Kim
22  * @version     0.1
23  */
24
25 #ifndef _JS_TIZEN_ACCOUNTSERVICE_H_
26 #define _JS_TIZEN_ACCOUNTSERVICE_H_
27
28 #include <vector>
29 #include <string>
30 #include <JavaScriptCore/JavaScript.h>
31 #include <CommonsJavaScript/PrivateObject.h>
32 #include <API/Account/IAccountService.h>
33 #include <CommonsJavaScript/JSCallbackManager.h>
34
35
36 using namespace TizenApis::Api::Account;
37 using namespace WrtDeviceApis::Commons;
38 using namespace WrtDeviceApis::CommonsJavaScript;
39
40 namespace TizenApis {
41 namespace Tizen1_0 {
42 namespace Account{
43 typedef PrivateObject<IAccountServicePtr,
44                                NoOwnership> AccountServicePrivObject;
45
46 class JSAccountService
47 {
48   public:
49
50     static const JSClassDefinition* getClassInfo();
51
52     static const JSClassRef getClassRef();
53
54   private:
55     /**
56      * This member variable contains the values which has to be passed
57      * when the this class is embedded into JS Engine.
58      */
59     static JSClassDefinition m_classInfo;
60
61     /**
62      * This structure describes a statically declared function property.
63      */
64     static JSStaticFunction m_function[];
65
66     /**
67      * This member variable contains the initialization values for the
68      * properties of this class. The values are given according to
69      * the data structure JSPropertySpec
70      */
71     static JSStaticValue m_property[];
72
73     static JSClassRef m_jsClassRef;
74
75     /**
76      * The callback invoked when an object is first created.
77      */
78     static void initialize(JSContextRef context,
79             JSObjectRef object);
80
81     /**
82      * The callback invoked when an object is finalized.
83      */
84     static void finalize(JSObjectRef object);
85
86     static JSValueRef getPropertyName(JSContextRef context,
87             JSObjectRef object,
88             JSStringRef propertyName,
89             JSValueRef* exception);
90
91     static JSValueRef getPropertyType(JSContextRef context,
92             JSObjectRef object,
93             JSStringRef propertyName,
94             JSValueRef* exception);
95
96
97
98     /**
99      * Update an event.
100      */
101     static JSValueRef updateAccount(JSContextRef context,
102             JSObjectRef object,
103             JSObjectRef thisObject,
104             size_t argumentCount,
105             const JSValueRef arguments[],
106             JSValueRef* exception);
107
108     /**
109      * Delete a calendar event.
110      */
111     static JSValueRef deleteAccount(JSContextRef context,
112             JSObjectRef object,
113             JSObjectRef thisObject,
114             size_t argumentCount,
115             const JSValueRef arguments[],
116             JSValueRef* exception);
117
118     /**
119      * Search for calendar events.
120      */
121     static JSValueRef findAccounts(JSContextRef context,
122             JSObjectRef object,
123             JSObjectRef thisObject,
124             size_t argumentCount,
125             const JSValueRef arguments[],
126             JSValueRef* exception);
127
128     /**
129      * Create Events
130      */
131     static JSValueRef createAccount(JSContextRef context,
132             JSObjectRef object,
133             JSObjectRef thisObject,
134             size_t argumentCount,
135             const JSValueRef arguments[],
136             JSValueRef* exception);
137
138
139   /**
140      * Add Event
141      */
142     static JSValueRef addAccount(JSContextRef context,
143             JSObjectRef object,
144             JSObjectRef thisObject,
145             size_t argumentCount,
146             const JSValueRef arguments[],
147             JSValueRef* exception);
148
149      /**
150      *  Returns calendar stored as private object
151      */
152     static IAccountServicePtr getAccountService(JSContextRef ctx,
153             const JSObjectRef object,
154             JSValueRef* exception);
155
156
157 };
158 }
159 }
160 }
161
162 #endif /* _JS_TIZEN_ACCOUNTSERVICE_H_ */
163