5d4e041189b7a3e6572e47046178ec297aa0430f
[framework/web/wrt-plugins-tizen.git] / src / Tizen / JSAbstractFilterArray.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  * @file        JSAbstractFilterArray.h
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief
23  */
24
25 #ifndef _TIZEN_TIZEN_JS_ABSTRACT_FILTER_ARRAY_H_
26 #define _TIZEN_TIZEN_JS_ABSTRACT_FILTER_ARRAY_H_
27
28 #include <JavaScriptCore/JavaScript.h>
29 #include <CommonsJavaScript/PrivateObject.h>
30 #include "IFilter.h"
31
32 namespace DeviceAPI {\rnamespace Tizen {
33
34 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT< DeviceAPI::Tizen::FilterArrayPtr >::Type JSAbstractFilterArrayPriv;
35
36 class JSAbstractFilterArray
37 {
38 public:
39
40         static const JSClassDefinition* getClassInfo();
41
42         static JSClassRef getClassRef();
43
44         static JSObjectRef createArray(JSContextRef context,
45                         const DeviceAPI::Tizen::FilterArrayPtr &filterArray);
46
47         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
48
49         static DeviceAPI::Tizen::FilterArrayPtr getAbstractFilterArray(JSContextRef context, JSValueRef value);
50
51 private:
52
53         /**
54          * The callback invoked when an object is first created.
55          */
56         static void initialize(JSContextRef context,
57                         JSObjectRef object);
58
59         /**
60          * The callback invoked when an object is finalized.
61          */
62         static void finalize(JSObjectRef object);
63
64         static JSValueRef getLength(JSContextRef context,
65                         JSObjectRef object,
66                         JSStringRef propertyName,
67                         JSValueRef* exception);
68
69         static bool hasProperty(JSContextRef context,
70                         JSObjectRef object,
71                         JSStringRef propertyName);
72
73         static JSValueRef getProperty(JSContextRef context,
74                         JSObjectRef object,
75                         JSStringRef propertyName,
76                         JSValueRef* exception);
77
78         static bool setProperty(JSContextRef context,
79                         JSObjectRef object,
80                         JSStringRef propertyName,
81                         JSValueRef value,
82                         JSValueRef* exception);
83
84         static void getPropertyNames(JSContextRef context,
85                         JSObjectRef object,
86                         JSPropertyNameAccumulatorRef propertyNames);
87
88         static JSValueRef concat(JSContextRef context,
89                         JSObjectRef function,
90                         JSObjectRef thisObject,
91                         size_t argumentCount,
92                         const JSValueRef arguments[],
93                         JSValueRef* exception);
94         static JSValueRef join(JSContextRef context,
95                         JSObjectRef function,
96                         JSObjectRef thisObject,
97                         size_t argumentCount,
98                         const JSValueRef arguments[],
99                         JSValueRef* exception);
100         static JSValueRef pop(JSContextRef context,
101                         JSObjectRef function,
102                         JSObjectRef thisObject,
103                         size_t argumentCount,
104                         const JSValueRef arguments[],
105                         JSValueRef* exception);
106         static JSValueRef push(JSContextRef context,
107                         JSObjectRef function,
108                         JSObjectRef thisObject,
109                         size_t argumentCount,
110                         const JSValueRef arguments[],
111                         JSValueRef* exception);
112         static JSValueRef reverse(JSContextRef context,
113                         JSObjectRef function,
114                         JSObjectRef thisObject,
115                         size_t argumentCount,
116                         const JSValueRef arguments[],
117                         JSValueRef* exception);
118         static JSValueRef shift(JSContextRef context,
119                         JSObjectRef function,
120                         JSObjectRef thisObject,
121                         size_t argumentCount,
122                         const JSValueRef arguments[],
123                         JSValueRef* exception);
124         static JSValueRef slice(JSContextRef context,
125                         JSObjectRef function,
126                         JSObjectRef thisObject,
127                         size_t argumentCount,
128                         const JSValueRef arguments[],
129                         JSValueRef* exception);
130         static JSValueRef sort(JSContextRef context,
131                         JSObjectRef function,
132                         JSObjectRef thisObject,
133                         size_t argumentCount,
134                         const JSValueRef arguments[],
135                         JSValueRef* exception);
136         static JSValueRef splice(JSContextRef context,
137                         JSObjectRef function,
138                         JSObjectRef thisObject,
139                         size_t argumentCount,
140                         const JSValueRef arguments[],
141                         JSValueRef* exception);
142         static JSValueRef toString(JSContextRef context,
143                         JSObjectRef function,
144                         JSObjectRef thisObject,
145                         size_t argumentCount,
146                         const JSValueRef arguments[],
147                         JSValueRef* exception);
148         static JSValueRef unshift(JSContextRef context,
149                         JSObjectRef function,
150                         JSObjectRef thisObject,
151                         size_t argumentCount,
152                         const JSValueRef arguments[],
153                         JSValueRef* exception);
154         static JSValueRef valueOf(JSContextRef context,
155                         JSObjectRef function,
156                         JSObjectRef thisObject,
157                         size_t argumentCount,
158                         const JSValueRef arguments[],
159                         JSValueRef* exception);
160         static JSValueRef constructor(JSContextRef context,
161                         JSObjectRef function,
162                         JSObjectRef thisObject,
163                         size_t argumentCount,
164                         const JSValueRef arguments[],
165                         JSValueRef* exception);
166
167         static bool checkValue(const std::string &value);
168
169         static JSClassRef m_jsClassRef;
170         /**
171          * This structure describes a statically declared function property.
172          */
173         static JSStaticFunction m_function[];
174
175         /**
176          * This structure contains properties and callbacks that define a type of object.
177          */
178         static JSClassDefinition m_classInfo;
179
180         /**
181          * This member variable contains the initialization values for the static properties of this class.
182          * The values are given according to the data structure JSPropertySpec
183          */
184         static JSStaticValue m_property[];
185 };
186
187 } // Tizen
188 } // DeviceAPI
189
190
191 #endif // _TIZEN_TIZEN_JS_ABSTRACT_FILTER_ARRAY_H_