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