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