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