Git Init
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / JSCalendar.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 #ifndef _JS_TIZEN_CALENDAR_H_
19 #define _JS_TIZEN_CALENDAR_H_
20
21 #include <vector>
22 #include <string>
23 #include <JavaScriptCore/JavaScript.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25 #include <API/Calendar/ICalendar.h>
26 #include <CommonsJavaScript/JSCallbackManager.h>
27
28 namespace TizenApis {
29 namespace Tizen1_0 {
30 namespace Calendar {
31
32 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::ICalendarPtr,
33                                WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarPrivObject;
34
35 class JSCalendar
36 {
37   public:
38
39     static const JSClassDefinition* getClassInfo();
40
41     static const JSClassRef getClassRef();
42
43   private:
44     /**
45      * This member variable contains the values which has to be passed
46      * when the this class is embedded into JS Engine.
47      */
48     static JSClassDefinition m_classInfo;
49
50     /**
51      * This structure describes a statically declared function property.
52      */
53     static JSStaticFunction m_function[];
54
55     /**
56      * This member variable contains the initialization values for the
57      * properties of this class. The values are given according to
58      * the data structure JSPropertySpec
59      */
60     static JSStaticValue m_property[];
61
62     static JSClassRef m_jsClassRef;
63
64     /**
65      * The callback invoked when an object is first created.
66      */
67     static void initialize(JSContextRef context,
68             JSObjectRef object);
69
70     /**
71      * The callback invoked when an object is finalized.
72      */
73     static void finalize(JSObjectRef object);
74
75     static JSValueRef getPropertyName(JSContextRef context,
76             JSObjectRef object,
77             JSStringRef propertyName,
78             JSValueRef* exception);
79
80     static JSValueRef getPropertyAccountId(JSContextRef context,
81             JSObjectRef object,
82             JSStringRef propertyName,
83             JSValueRef* exception);
84
85     /**
86      * Add a calendar item.
87      */
88     static JSValueRef add(JSContextRef context,
89             JSObjectRef object,
90             JSObjectRef thisObject,
91             size_t argumentCount,
92             const JSValueRef arguments[],
93             JSValueRef* exception);
94
95     /**
96      * Add calendar items.
97      */
98     static JSValueRef addBatch(JSContextRef context,
99             JSObjectRef object,
100             JSObjectRef thisObject,
101             size_t argumentCount,
102             const JSValueRef arguments[],
103             JSValueRef* exception);
104
105     /**
106      * Update an item.
107      */
108     static JSValueRef update(JSContextRef context,
109             JSObjectRef object,
110             JSObjectRef thisObject,
111             size_t argumentCount,
112             const JSValueRef arguments[],
113             JSValueRef* exception);
114
115     /**
116      * Update items.
117      */
118     static JSValueRef updateBatch(JSContextRef context,
119             JSObjectRef object,
120             JSObjectRef thisObject,
121             size_t argumentCount,
122             const JSValueRef arguments[],
123             JSValueRef* exception);
124
125     /**
126      * Remove a calendar item.
127      */
128     static JSValueRef remove(JSContextRef context,
129             JSObjectRef object,
130             JSObjectRef thisObject,
131             size_t argumentCount,
132             const JSValueRef arguments[],
133             JSValueRef* exception);
134
135     /**
136      * Remove calendar items.
137      */
138     static JSValueRef removeBatch(JSContextRef context,
139             JSObjectRef object,
140             JSObjectRef thisObject,
141             size_t argumentCount,
142             const JSValueRef arguments[],
143             JSValueRef* exception);
144
145     /**
146      * Search for calendar events.
147      */
148     static JSValueRef find(JSContextRef context,
149             JSObjectRef object,
150             JSObjectRef thisObject,
151             size_t argumentCount,
152             const JSValueRef arguments[],
153             JSValueRef* exception);
154
155     /**
156      * Search for calendar events.
157      */
158     static JSValueRef findEventsGeneric(JSContextRef context,
159             JSObjectRef object,
160             JSObjectRef thisObject,
161             size_t argumentCount,
162             const JSValueRef arguments[],
163             JSValueRef* exception);
164
165     /**
166      * Create an event from string
167      */
168     static JSValueRef convertFromString(JSContextRef context,
169             JSObjectRef object,
170             JSObjectRef thisObject,
171             size_t argumentCount,
172             const JSValueRef arguments[],
173             JSValueRef* exception);
174
175     /**
176      * Export a string from event
177      */
178     static JSValueRef convertToString(JSContextRef context,
179             JSObjectRef object,
180             JSObjectRef thisObject,
181             size_t argumentCount,
182             const JSValueRef arguments[],
183             JSValueRef* exception);
184
185     /**
186      * Watch changes
187      */
188     static JSValueRef addChangeListener(JSContextRef context,
189             JSObjectRef object,
190             JSObjectRef thisObject,
191             size_t argumentCount,
192             const JSValueRef arguments[],
193             JSValueRef* exception);
194
195     /**
196      * Clear watch
197      */
198     static JSValueRef removeChangeListener(JSContextRef context,
199             JSObjectRef object,
200             JSObjectRef thisObject,
201             size_t argumentCount,
202             const JSValueRef arguments[],
203             JSValueRef* exception);
204
205     /**
206      * Expand event instances from a recurring event
207      */
208     static JSValueRef expandEventRecurrence(JSContextRef context,
209             JSObjectRef object,
210             JSObjectRef thisObject,
211             size_t argumentCount,
212             const JSValueRef arguments[],
213             JSValueRef* exception);
214
215     /**
216      *  Returns calendar stored as private object
217      */
218     static Api::Calendar::ICalendarPtr getCalendar(JSContextRef ctx,
219             const JSObjectRef object,
220             JSValueRef* exception);
221 };
222
223 }
224 }
225 }
226
227 #endif /* _JS_TIZEN_CALENDAR_H_ */
228