Update change log and spec for wrt-plugins-tizen_0.4.57
[platform/framework/web/wrt-plugins-tizen.git] / src / Calendar / JSCalendarEvent.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_EVENT_H_
20 #define _JS_CALENDAR_EVENT_H_
21
22 #include <JavaScriptCore/JavaScript.h>
23 #include "CalendarEvent.h"
24 #include "ICalendar.h"
25 #include "CalendarFactory.h"
26 #include <CommonsJavaScript/PrivateObject.h>
27
28 namespace DeviceAPI {
29 namespace Calendar {
30
31 #define TIZEN_INTERFACE_CALENDAR_EVENT "CalendarEvent"
32
33 #define TIZEN_CALENDAR_EVENT_ID "id"
34 #define TIZEN_CALENDAR_EVENT_IS_DETACHED "isDetached"
35 #define TIZEN_CALENDAR_EVENT_END_DATE  "endDate"
36 #define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
37 #define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
38
39 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
40         WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarEventPrivObject;
41
42 class JSCalendarEvent
43 {
44   public:
45
46     static const JSClassDefinition* getClassInfo();
47
48     static const JSClassRef getClassRef();
49
50     static CalendarEventPtr getPrivateObject(JSObjectRef object);
51
52     static void setPrivateObject(const CalendarEventPtr &event,
53             JSContextRef ctx,
54             const JSObjectRef object);
55
56         static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event);
57
58         static JSObjectRef constructor(JSContextRef context,
59     JSObjectRef constructor,
60     size_t argumentCount,
61     const JSValueRef arguments[],
62     JSValueRef* exception);
63
64   private:
65     /**
66      * This member variable contains the values which has to be passed when
67      * the this class is embedded into JS Engine.
68      */
69     static JSClassDefinition m_classInfo;
70
71     /**
72      * This structure describes a statically declared function property.
73      */
74     static JSStaticFunction m_function[];
75
76     /**
77      * This member variable contains the initialization values for the
78      * properties of this class. The values are given according to the
79      * data structure JSPropertySpec.
80      */
81     static JSStaticValue m_property[];
82
83     static JSClassRef m_jsClassRef;
84
85         /**
86          * The calendar object to be used for asynchronous platform function invocation.
87          */
88         static ICalendarPtr m_calendar;
89
90     /**
91      * The callback invoked when an object is first created.
92      */
93     static void initialize(JSContextRef context,
94             JSObjectRef object);
95
96     /**
97      * The callback invoked when an object is finalized.
98      */
99     static void finalize(JSObjectRef object);
100
101     /**
102      * Expand event instances from a recurring event
103      */
104     static JSValueRef expandRecurrence(JSContextRef context,
105             JSObjectRef object,
106             JSObjectRef thisObject,
107             size_t argumentCount,
108             const JSValueRef arguments[],
109             JSValueRef* exception);
110
111     /**
112      * Getters and setters for properties
113      */
114     static JSValueRef getPropertyId(JSContextRef context,
115             JSObjectRef object,
116             JSStringRef propertyName,
117             JSValueRef* exception);
118     static JSValueRef getPropertyIsDetached(JSContextRef context,
119             JSObjectRef object,
120             JSStringRef propertyName,
121             JSValueRef* exception);
122     static JSValueRef getPropertyAvailability(JSContextRef context,
123             JSObjectRef object,
124             JSStringRef propertyName,
125             JSValueRef* exception);
126     static bool setPropertyAvailability(JSContextRef context,
127             JSObjectRef object,
128             JSStringRef propertyName,
129             JSValueRef value,
130             JSValueRef* exception);
131         static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
132                         JSObjectRef object,
133                         JSStringRef propertyName,
134                         JSValueRef* exception);
135         static bool setPropertyRecurrenceRule(JSContextRef context,
136                         JSObjectRef object,
137                         JSStringRef propertyName,
138                         JSValueRef value,
139                         JSValueRef* exception);
140 };
141
142 }
143 }
144
145 #endif /* _JS_CALENDAR_EVENT_H_ */