added2efdc668e52aa895ff13f343748a3d56f30
[framework/web/wrt-plugins-tizen.git] / src / Calendar / JSTZDateArray.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18
19 #ifndef _TIZEN_CALENDAR_JS_TZDATE_ARRAY_H_
20 #define _TIZEN_CALENDAR_JS_TZDATE_ARRAY_H_
21
22 #include <vector>
23 #include <JavaScriptCore/JavaScript.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25 #include "CalendarEvent.h"
26
27 namespace DeviceAPI {
28 namespace Calendar {
29
30 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<NumberArrayPtr>::Type JSTZDateArrayPriv;
31
32 class JSTZDateArray
33 {
34 public:
35
36         static const JSClassDefinition* getClassInfo();
37
38         static JSClassRef getClassRef();
39
40         static JSObjectRef createArray(JSContextRef context,
41                         const NumberArrayPtr &Numbers);
42
43         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
44
45         static NumberArrayPtr getTZDateArray(JSContextRef context, JSValueRef value);
46
47 private:
48
49         /**
50          * The callback invoked when an object is first created.
51          */
52         static void initialize(JSContextRef context,
53                         JSObjectRef object);
54
55         /**
56          * The callback invoked when an object is finalized.
57          */
58         static void finalize(JSObjectRef object);
59
60         static JSValueRef getLength(JSContextRef context,
61                         JSObjectRef object,
62                         JSStringRef propertyName,
63                         JSValueRef* exception);
64
65         static bool hasProperty(JSContextRef context,
66                         JSObjectRef object,
67                         JSStringRef propertyName);
68
69         static JSValueRef getProperty(JSContextRef context,
70                         JSObjectRef object,
71                         JSStringRef propertyName,
72                         JSValueRef* exception);
73
74         static bool setProperty(JSContextRef context,
75                         JSObjectRef object,
76                         JSStringRef propertyName,
77                         JSValueRef value,
78                         JSValueRef* exception);
79
80         static void getPropertyNames(JSContextRef context,
81                         JSObjectRef object,
82                         JSPropertyNameAccumulatorRef propertyNames);
83
84         static JSValueRef concat(JSContextRef context,
85                         JSObjectRef function,
86                         JSObjectRef thisObject,
87                         size_t argumentCount,
88                         const JSValueRef arguments[],
89                         JSValueRef* exception);
90         static JSValueRef join(JSContextRef context,
91                         JSObjectRef function,
92                         JSObjectRef thisObject,
93                         size_t argumentCount,
94                         const JSValueRef arguments[],
95                         JSValueRef* exception);
96
97         static JSValueRef pop(JSContextRef context,
98                         JSObjectRef function,
99                         JSObjectRef thisObject,
100                         size_t argumentCount,
101                         const JSValueRef arguments[],
102                         JSValueRef* exception);
103         static JSValueRef push(JSContextRef context,
104                         JSObjectRef function,
105                         JSObjectRef thisObject,
106                         size_t argumentCount,
107                         const JSValueRef arguments[],
108                         JSValueRef* exception);
109         static JSValueRef reverse(JSContextRef context,
110                         JSObjectRef function,
111                         JSObjectRef thisObject,
112                         size_t argumentCount,
113                         const JSValueRef arguments[],
114                         JSValueRef* exception);
115         static JSValueRef shift(JSContextRef context,
116                         JSObjectRef function,
117                         JSObjectRef thisObject,
118                         size_t argumentCount,
119                         const JSValueRef arguments[],
120                         JSValueRef* exception);
121         static JSValueRef slice(JSContextRef context,
122                         JSObjectRef function,
123                         JSObjectRef thisObject,
124                         size_t argumentCount,
125                         const JSValueRef arguments[],
126                         JSValueRef* exception);
127         static JSValueRef sort(JSContextRef context,
128                         JSObjectRef function,
129                         JSObjectRef thisObject,
130                         size_t argumentCount,
131                         const JSValueRef arguments[],
132                         JSValueRef* exception);
133         static JSValueRef splice(JSContextRef context,
134                         JSObjectRef function,
135                         JSObjectRef thisObject,
136                         size_t argumentCount,
137                         const JSValueRef arguments[],
138                         JSValueRef* exception);
139         static JSValueRef toString(JSContextRef context,
140                         JSObjectRef function,
141                         JSObjectRef thisObject,
142                         size_t argumentCount,
143                         const JSValueRef arguments[],
144                         JSValueRef* exception);
145         static JSValueRef unshift(JSContextRef context,
146                         JSObjectRef function,
147                         JSObjectRef thisObject,
148                         size_t argumentCount,
149                         const JSValueRef arguments[],
150                         JSValueRef* exception);
151         static JSValueRef valueOf(JSContextRef context,
152                         JSObjectRef function,
153                         JSObjectRef thisObject,
154                         size_t argumentCount,
155                         const JSValueRef arguments[],
156                         JSValueRef* exception);
157
158         static bool checkValue(const long long int &value);
159
160         static JSClassRef m_jsClassRef;
161         /**
162          * This structure describes a statically declared function property.
163          */
164         static JSStaticFunction m_function[];
165
166         /**
167          * This structure contains properties and callbacks that define a type of object.
168          */
169         static JSClassDefinition m_classInfo;
170
171         /**
172          * This member variable contains the initialization values for the static properties of this class.
173          * The values are given according to the data structure JSPropertySpec
174          */
175         static JSStaticValue m_property[];
176 };
177
178 } // Calendar
179 } // DeviceAPI
180
181 #endif // _TIZEN_CALENDAR_JS_TZDATE_ARRAY_H_