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