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