Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / JSCalendarItemProperties.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_CALENDAR_ITEM_PROPERTIES_H_
19 #define _JS_CALENDAR_ITEM_PROPERTIES_H_
20
21 #include <JavaScriptCore/JavaScript.h>
22 #include <API/Calendar/CalendarEvent.h>
23 #include <CommonsJavaScript/PrivateObject.h>
24
25 namespace TizenApis {
26 namespace Tizen1_0 {
27 namespace Calendar {
28
29 // Common CalendarItemProperties
30 #define TIZEN_CALENDAR_ITEM_DESCRIPTION "description"
31 #define TIZEN_CALENDAR_ITEM_SUMMARY "summary"
32 #define TIZEN_CALENDAR_ITEM_IS_ALL_DAY "isAllDay"
33 #define TIZEN_CALENDAR_ITEM_START_DATE "startDate"
34 #define TIZEN_CALENDAR_ITEM_DURATION "duration"
35 #define TIZEN_CALENDAR_ITEM_LOCATION "location"
36 #define TIZEN_CALENDAR_ITEM_GEOLOCATION "geolocation"
37 #define TIZEN_CALENDAR_ITEM_ORGANIZER "organizer"
38 #define TIZEN_CALENDAR_ITEM_VISIBILITY "visibility"
39 #define TIZEN_CALENDAR_ITEM_STATUS "status"
40 #define TIZEN_CALENDAR_ITEM_PRIORITY  "priority"
41 #define TIZEN_CALENDAR_ITEM_ALARMS "alarms"
42 #define TIZEN_CALENDAR_ITEM_CATEGORIES "categories"
43 #define TIZEN_CALENDAR_ITEM_ATTENDEES "attendees"
44
45 // CalendarTaskProperties
46 #define TIZEN_CALENDAR_TASK_DUE_DATE  "dueDate"
47 #define TIZEN_CALENDAR_TASK_COMPLETED_DATE  "completedDate"
48 #define TIZEN_CALENDAR_TASK_PROGRESS "progress"
49
50 // CalendarEventProperties
51 #define TIZEN_CALENDAR_EVENT_END_DATE  "endDate"
52 #define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
53 #define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
54
55 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::CalendarEventPtr, 
56         WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarItemPropertiesPrivObject;
57
58 class JSCalendarItemProperties
59 {
60   public:
61
62     static const JSClassDefinition* getClassInfo();
63
64     static const JSClassRef getClassRef();
65
66     static TizenApis::Api::Calendar::CalendarEventPtr getPrivateObject(JSObjectRef object);
67
68     static void setPrivateObject(const TizenApis::Api::Calendar::CalendarEventPtr &event,
69             JSContextRef ctx,
70             const JSObjectRef object);
71
72         static JSObjectRef createJSCalendarItemProperties(JSContextRef context, TizenApis::Api::Calendar::CalendarEventPtr geo);
73
74     static bool validate(JSContextRef ctx,
75             const JSObjectRef object,
76             JSValueRef* exception);
77
78   private:
79     /**
80      * This member variable contains the values which has to be passed when
81      * the this class is embedded into JS Engine.
82      */
83     static JSClassDefinition m_classInfo;
84
85     /**
86      * This structure describes a statically declared function property.
87      */
88     static JSStaticFunction m_function[];
89
90     /**
91      * This member variable contains the initialization values for the
92      * properties of this class. The values are given according to the
93      * data structure JSPropertySpec.
94      */
95     static JSStaticValue m_property[];
96
97     static JSClassRef m_jsClassRef;
98
99     /**
100      * The callback invoked when an object is first created.
101      */
102     static void initialize(JSContextRef context,
103             JSObjectRef object);
104
105     /**
106      * The callback invoked when an object is finalized.
107      */
108     static void finalize(JSObjectRef object);
109
110     /**
111      * Export a string from item
112      */
113     static JSValueRef convertToString(JSContextRef context,
114             JSObjectRef object,
115             JSObjectRef thisObject,
116             size_t argumentCount,
117             const JSValueRef arguments[],
118             JSValueRef* exception);
119
120     /**
121      * Copy item object contents except id
122      */
123     static JSValueRef clone(JSContextRef context,
124             JSObjectRef object,
125             JSObjectRef thisObject,
126             size_t argumentCount,
127             const JSValueRef arguments[],
128             JSValueRef* exception);
129
130     /**
131      * Getters and setters for properties
132      */
133     static JSValueRef getPropertyDescription(JSContextRef context,
134             JSObjectRef object,
135             JSStringRef propertyName,
136             JSValueRef* exception);
137     static bool setPropertyDescription(JSContextRef context,
138             JSObjectRef object,
139             JSStringRef propertyName,
140             JSValueRef value,
141             JSValueRef* exception);
142     static JSValueRef getPropertySummary(JSContextRef context,
143             JSObjectRef object,
144             JSStringRef propertyName,
145             JSValueRef* exception);
146     static bool setPropertySummary(JSContextRef context,
147             JSObjectRef object,
148             JSStringRef propertyName,
149             JSValueRef value,
150             JSValueRef* exception);
151     static JSValueRef getPropertyStartTime(JSContextRef context,
152             JSObjectRef object,
153             JSStringRef propertyName,
154             JSValueRef* exception);
155     static bool setPropertyStartTime(JSContextRef context,
156             JSObjectRef object,
157             JSStringRef propertyName,
158             JSValueRef value,
159             JSValueRef* exception);
160     static JSValueRef getPropertyLocation(JSContextRef context,
161             JSObjectRef object,
162             JSStringRef propertyName,
163             JSValueRef* exception);
164     static bool setPropertyLocation(JSContextRef context,
165             JSObjectRef object,
166             JSStringRef propertyName,
167             JSValueRef value,
168             JSValueRef* exception);
169     static JSValueRef getPropertyGeolocation(JSContextRef context,
170             JSObjectRef object,
171             JSStringRef propertyName,
172             JSValueRef* exception);
173     static bool setPropertyGeolocation(JSContextRef context,
174             JSObjectRef object,
175             JSStringRef propertyName,
176             JSValueRef value,
177             JSValueRef* exception);
178     static JSValueRef getPropertyOrganizer(JSContextRef context,
179             JSObjectRef object,
180             JSStringRef propertyName,
181             JSValueRef* exception);
182     static bool setPropertyOrganizer(JSContextRef context,
183             JSObjectRef object,
184             JSStringRef propertyName,
185             JSValueRef value,
186             JSValueRef* exception);
187     static JSValueRef getPropertyVisibility(JSContextRef context,
188             JSObjectRef object,
189             JSStringRef propertyName,
190             JSValueRef* exception);
191     static bool setPropertyVisibility(JSContextRef context,
192             JSObjectRef object,
193             JSStringRef propertyName,
194             JSValueRef value,
195             JSValueRef* exception);
196     static JSValueRef getPropertyStatus(JSContextRef context,
197             JSObjectRef object,
198             JSStringRef propertyName,
199             JSValueRef* exception);
200     static bool setPropertyStatus(JSContextRef context,
201             JSObjectRef object,
202             JSStringRef propertyName,
203             JSValueRef value,
204             JSValueRef* exception);
205     static JSValueRef getPropertyAlarms(JSContextRef context,
206             JSObjectRef object,
207             JSStringRef propertyName,
208             JSValueRef* exception);
209     static bool setPropertyAlarms(JSContextRef context,
210             JSObjectRef object,
211             JSStringRef propertyName,
212             JSValueRef value,
213             JSValueRef* exception);
214     static JSValueRef getPropertyCategories(JSContextRef context,
215             JSObjectRef object,
216             JSStringRef propertyName,
217             JSValueRef* exception);
218     static bool setPropertyCategories(JSContextRef context,
219             JSObjectRef object,
220             JSStringRef propertyName,
221             JSValueRef value,
222             JSValueRef* exception);
223     static JSValueRef getPropertyIsAllDay(JSContextRef context,
224             JSObjectRef object,
225             JSStringRef propertyName,
226             JSValueRef* exception);
227     static bool setPropertyIsAllDay(JSContextRef context,
228             JSObjectRef object,
229             JSStringRef propertyName,
230             JSValueRef value,
231             JSValueRef* exception);
232     static JSValueRef getPropertyDuration(JSContextRef context,
233             JSObjectRef object,
234             JSStringRef propertyName,
235             JSValueRef* exception);
236     static bool setPropertyDuration(JSContextRef context,
237             JSObjectRef object,
238             JSStringRef propertyName,
239             JSValueRef value,
240             JSValueRef* exception);
241     static JSValueRef getPropertyAttendees(JSContextRef context,
242             JSObjectRef object,
243             JSStringRef propertyName,
244             JSValueRef* exception);
245     static bool setPropertyAttendees(JSContextRef context,
246             JSObjectRef object,
247             JSStringRef propertyName,
248             JSValueRef value,
249             JSValueRef* exception);
250     static JSValueRef getPropertyAvailability(JSContextRef context,
251             JSObjectRef object,
252             JSStringRef propertyName,
253             JSValueRef* exception);
254     static bool setPropertyAvailability(JSContextRef context,
255             JSObjectRef object,
256             JSStringRef propertyName,
257             JSValueRef value,
258             JSValueRef* exception);
259     static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
260             JSObjectRef object,
261             JSStringRef propertyName,
262             JSValueRef* exception);
263     static bool setPropertyRecurrenceRule(JSContextRef context,
264             JSObjectRef object,
265             JSStringRef propertyName,
266             JSValueRef value,
267             JSValueRef* exception);
268     static JSValueRef getPropertyDueDate(JSContextRef context,
269             JSObjectRef object,
270             JSStringRef propertyName,
271             JSValueRef* exception);
272     static bool setPropertyDueDate(JSContextRef context,
273             JSObjectRef object,
274             JSStringRef propertyName,
275             JSValueRef value,
276             JSValueRef* exception);
277     static JSValueRef getPropertyCompletedDate(JSContextRef context,
278             JSObjectRef object,
279             JSStringRef propertyName,
280             JSValueRef* exception);
281     static bool setPropertyCompletedDate(JSContextRef context,
282             JSObjectRef object,
283             JSStringRef propertyName,
284             JSValueRef value,
285             JSValueRef* exception);
286     static JSValueRef getPropertyProgress(JSContextRef context,
287             JSObjectRef object,
288             JSStringRef propertyName,
289             JSValueRef* exception);
290     static bool setPropertyProgress(JSContextRef context,
291             JSObjectRef object,
292             JSStringRef propertyName,
293             JSValueRef value,
294             JSValueRef* exception);
295     static JSValueRef getPropertyPriority(JSContextRef context,
296             JSObjectRef object,
297             JSStringRef propertyName,
298             JSValueRef* exception);
299     static bool setPropertyPriority(JSContextRef context,
300             JSObjectRef object,
301             JSStringRef propertyName,
302             JSValueRef value,
303             JSValueRef* exception);
304     static JSValueRef getPropertyEndDate(JSContextRef context,
305             JSObjectRef object,
306             JSStringRef propertyName,
307             JSValueRef* exception);
308     static bool setPropertyEndDate(JSContextRef context,
309             JSObjectRef object,
310             JSStringRef propertyName,
311             JSValueRef value,
312             JSValueRef* exception);
313 };
314
315 }
316 }
317 }
318
319 #endif
320