Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / JSCalendarEvent.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_EVENT_H_
19 #define _JS_CALENDAR_EVENT_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 #define TIZEN_INTERFACE_CALENDAR_EVENT "CalendarEvent"
30
31 #define TIZEN_CALENDAR_EVENT_ID "id"
32 #define TIZEN_CALENDAR_EVENT_LAST_MODIFICATION_DATE "lastModificationDate"
33 #define TIZEN_CALENDAR_EVENT_IS_DETACHED "isDetached"
34
35 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::CalendarEventPtr,
36         WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarEventPrivObject;
37
38 class JSCalendarEvent
39 {
40   public:
41
42     static const JSClassDefinition* getClassInfo();
43
44     static const JSClassRef getClassRef();
45
46     static TizenApis::Api::Calendar::CalendarEventPtr getPrivateObject(JSObjectRef object);
47
48     static void setPrivateObject(const TizenApis::Api::Calendar::CalendarEventPtr &event,
49             JSContextRef ctx,
50             const JSObjectRef object);
51
52     static bool validate(JSContextRef ctx,
53             const JSObjectRef object,
54             JSValueRef* exception);
55
56         static JSObjectRef createJSCalendarEvent(JSContextRef context, TizenApis::Api::Calendar::CalendarEventPtr event);
57
58   private:
59     /**
60      * This member variable contains the values which has to be passed when
61      * the this class is embedded into JS Engine.
62      */
63     static JSClassDefinition m_classInfo;
64
65     /**
66      * This structure describes a statically declared function property.
67      */
68     static JSStaticFunction m_function[];
69
70     /**
71      * This member variable contains the initialization values for the
72      * properties of this class. The values are given according to the
73      * data structure JSPropertySpec.
74      */
75     static JSStaticValue m_property[];
76
77     static JSClassRef m_jsClassRef;
78
79     /**
80      * The callback invoked when an object is first created.
81      */
82     static void initialize(JSContextRef context,
83             JSObjectRef object);
84
85     /**
86      * The callback invoked when an object is finalized.
87      */
88     static void finalize(JSObjectRef object);
89
90         /**
91          * Constructor for the CalendarEvent interface.
92          */
93         static JSObjectRef constructor(JSContextRef context,
94     JSObjectRef constructor,
95     size_t argumentCount,
96     const JSValueRef arguments[],
97     JSValueRef* exception);
98
99     /**
100      * Expand event instances from a recurring event
101      */
102     static JSValueRef expandRecurrence(JSContextRef context,
103             JSObjectRef object,
104             JSObjectRef thisObject,
105             size_t argumentCount,
106             const JSValueRef arguments[],
107             JSValueRef* exception);
108
109     /**
110      * Getters and setters for properties
111      */
112     static JSValueRef getPropertyId(JSContextRef context,
113             JSObjectRef object,
114             JSStringRef propertyName,
115             JSValueRef* exception);
116     static JSValueRef getPropertyLastModificationDate(JSContextRef context,
117             JSObjectRef object,
118             JSStringRef propertyName,
119             JSValueRef* exception);
120     static JSValueRef getPropertyIsDetached(JSContextRef context,
121             JSObjectRef object,
122             JSStringRef propertyName,
123             JSValueRef* exception);
124 };
125
126 }
127 }
128 }
129
130 #endif /* _JS_CALENDAR_EVENT_H_ */