Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / JSCalendarItem.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_H_
19 #define _JS_CALENDAR_ITEM_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_CALENDAR_ITEM_ID "id"
30 #define TIZEN_CALENDAR_ITEM_LAST_MODIFICATION_DATE "lastModificationDate"
31 #define TIZEN_CALENDAR_ITEM_IS_DETACHED "isDetached"
32
33 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::CalendarEventPtr,
34         WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarItemPrivObject;
35
36 class JSCalendarItem
37 {
38   public:
39
40     static const JSClassDefinition* getClassInfo();
41
42     static const JSClassRef getClassRef();
43
44     static TizenApis::Api::Calendar::CalendarEventPtr getPrivateObject(JSObjectRef object);
45
46     static void setPrivateObject(const TizenApis::Api::Calendar::CalendarEventPtr &event,
47             JSContextRef ctx,
48             const JSObjectRef object);
49
50         static JSObjectRef createJSCalendarItem(JSContextRef context, TizenApis::Api::Calendar::CalendarEventPtr item);
51
52     static bool validate(JSContextRef ctx,
53             const JSObjectRef object,
54             JSValueRef* exception);
55
56   private:
57     /**
58      * This member variable contains the values which has to be passed when
59      * the this class is embedded into JS Engine.
60      */
61     static JSClassDefinition m_classInfo;
62
63     /**
64      * This structure describes a statically declared function property.
65      */
66     static JSStaticFunction m_function[];
67
68     /**
69      * This member variable contains the initialization values for the
70      * properties of this class. The values are given according to the
71      * data structure JSPropertySpec.
72      */
73     static JSStaticValue m_property[];
74
75     static JSClassRef m_jsClassRef;
76
77     /**
78      * The callback invoked when an object is first created.
79      */
80     static void initialize(JSContextRef context,
81             JSObjectRef object);
82
83     /**
84      * The callback invoked when an object is finalized.
85      */
86     static void finalize(JSObjectRef object);
87
88     /**
89      * Getters and setters for properties
90      */
91     static JSValueRef getPropertyId(JSContextRef context,
92             JSObjectRef object,
93             JSStringRef propertyName,
94             JSValueRef* exception);
95     static JSValueRef getPropertyLastModificationDate(JSContextRef context,
96             JSObjectRef object,
97             JSStringRef propertyName,
98             JSValueRef* exception);
99     static JSValueRef getPropertyIsDetached(JSContextRef context,
100             JSObjectRef object,
101             JSStringRef propertyName,
102             JSValueRef* exception);
103 };
104
105 }
106 }
107 }
108
109 #endif /* _JS_CALENDAR_ITEM_H_ */