Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / JSCalendarEventId.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_CALEMDAR_EVENT_ID_H_
19 #define _JS_CALEMDAR_EVENT_ID_H_
20
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/PrivateObject.h>
23 #include <API/Calendar/EventId.h>
24
25 namespace TizenApis {
26 namespace Tizen1_0 {
27 namespace Calendar {
28
29 #define TIZEN_INTERFACE_CALENDAR_EVENT_ID "CalendarEventId"
30
31 #define TIZEN_CALENDAR_EVENT_ID_UID "uid"
32 #define TIZEN_CALENDAR_EVENT_ID_RECURRENCEID "recurrenceId"
33
34 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::EventIdPtr,
35                                WrtDeviceApis::CommonsJavaScript::NoOwnership> EventIdPrivateObject;
36
37 class JSCalendarEventId
38 {
39   public:
40
41     static const JSClassDefinition* getClassInfo();
42
43     static JSClassRef getClassRef();
44
45     static JSObjectRef createJSCalendarEventId(JSContextRef context, TizenApis::Api::Calendar::EventIdPtr eventId);
46
47     static TizenApis::Api::Calendar::EventIdPtr getPrivateObject(JSObjectRef object);
48
49     static void setPrivateObject(const TizenApis::Api::Calendar::EventIdPtr &eventId,
50             JSContextRef ctx,
51             const JSObjectRef object);
52
53   private:
54
55     /**
56      * The callback invoked when an object is first created.
57      */
58     static void initialize(JSContextRef context, JSObjectRef object);
59
60     /**
61      * The callback invoked when an object is finalized.
62      */
63     static void finalize(JSObjectRef object);
64
65         /**
66          * Constructor for the CalendarEventId interface.
67          */
68         static JSObjectRef constructor(JSContextRef context,
69                     JSObjectRef constructor,
70                     size_t argumentCount,
71                     const JSValueRef arguments[],
72                     JSValueRef* exception);
73
74     static JSValueRef getProperty(JSContextRef context,
75             JSObjectRef object,
76             JSStringRef propertyName,
77             JSValueRef* exception);
78
79     static bool setProperty(JSContextRef context,
80             JSObjectRef object,
81             JSStringRef propertyName,
82             JSValueRef value,
83             JSValueRef* exception);
84
85     static JSClassRef m_jsClassRef;
86
87     /**
88      * This structure describes a statically declared function property.
89      */
90     static JSStaticFunction m_function[];
91
92     /**
93      * This structure contains properties and callbacks that define a type of object.
94      */
95     static JSClassDefinition m_classInfo;
96
97     /**
98      * This member variable contains the initialization values for the static properties of this class.
99      * The values are given according to the data structure JSPropertySpec
100      */
101     static JSStaticValue m_property[];
102 };
103
104 }
105 }
106 }
107
108 #endif /* _JS_CALEMDAR_EVENT_ID_H_ */