Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / JSCalendarRecurrenceRule.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_RECURRENCE_RULE_H_
19 #define _JS_CALENDAR_RECURRENCE_RULE_H_
20
21 #include <string>
22 #include <vector>
23 #include <JavaScriptCore/JavaScript.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25 #include <API/Calendar/CalendarEvent.h>
26 #include <API/Calendar/EventRecurrenceRule.h>
27
28 namespace TizenApis {
29 namespace Tizen1_0 {
30 namespace Calendar {
31
32 #define TIZEN_INTERFACE_CALENDAR_RECURRENCE_RULE "CalendarRecurrenceRule"
33
34 #define TIZEN_RECURRENCE_RULE_FREQUENCY "frequency"
35 #define TIZEN_RECURRENCE_RULE_INTERVAL "interval"
36 #define TIZEN_RECURRENCE_RULE_UNTIL_DATE "untilDate"
37 #define TIZEN_RECURRENCE_RULE_OCCURRENCE_COUNT "occurrenceCount"
38 //#define TIZEN_RECURRENCE_RULE_DAYS_OF_THE_MONTH "daysOfTheMonth"
39 #define TIZEN_RECURRENCE_RULE_DAYS_OF_THE_WEEK "daysOfTheWeek"
40 //#define TIZEN_RECURRENCE_RULE_DAYS_OF_THE_YEAR "daysOfTheYear"
41 //#define TIZEN_RECURRENCE_RULE_WEEKS_OF_THE_YEAR "weeksOfTheYear"
42 #define TIZEN_RECURRENCE_RULE_SET_POSITION "setPositions"
43 #define TIZEN_RECURRENCE_RULE_EXCEPTIONS "exceptions"
44
45 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::EventRecurrenceRulePtr,
46         WrtDeviceApis::CommonsJavaScript::NoOwnership> RecurrenceRulePrivateObject;
47
48 class JSCalendarRecurrenceRule
49 {
50   public:
51
52     static const JSClassDefinition* getClassInfo();
53
54     static JSClassRef getClassRef();
55
56     static JSObjectRef createJSCalendarRecurrenceRule(JSContextRef context, TizenApis::Api::Calendar::EventRecurrenceRulePtr rule);
57
58     static TizenApis::Api::Calendar::EventRecurrenceRulePtr getPrivateObject(JSObjectRef object);
59
60     static void setPrivateObject(const TizenApis::Api::Calendar::EventRecurrenceRulePtr &rrule,
61             JSContextRef ctx,
62             const JSObjectRef object);
63
64   private:
65
66     /**
67      * The callback invoked when an object is first created.
68      */
69     static void initialize(JSContextRef context, JSObjectRef object);
70
71     /**
72      * The callback invoked when an object is finalized.
73      */
74     static void finalize(JSObjectRef object);
75
76         /**
77          * Constructor for the CalendarRecurrenceRule interface.
78          */
79         static JSObjectRef constructor(JSContextRef context,
80                     JSObjectRef constructor,
81                     size_t argumentCount,
82                     const JSValueRef arguments[],
83                     JSValueRef* exception);
84
85     static JSValueRef getProperty(JSContextRef context,
86             JSObjectRef object,
87             JSStringRef propertyName,
88             JSValueRef* exception);
89
90     static bool setProperty(JSContextRef context,
91             JSObjectRef object,
92             JSStringRef propertyName,
93             JSValueRef value,
94             JSValueRef* exception);
95
96     static JSClassRef m_jsClassRef;
97
98     /**
99      * This structure describes a statically declared function property.
100      */
101     static JSStaticFunction m_function[];
102
103     /**
104      * This structure contains properties and callbacks that define a type of object.
105      */
106     static JSClassDefinition m_classInfo;
107
108     /**
109      * This member variable contains the initialization values for the static properties of this class.
110      * The values are given according to the data structure JSPropertySpec
111      */
112     static JSStaticValue m_property[];
113 };
114
115 }
116 }
117 }
118
119 #endif /* _JS_CALENDAR_RECURRENCE_RULE_H_ */