2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file JSStringArray.h
19 * @author Kisub Song (kisubs.song@samsung.com)
24 #ifndef _TIZEN_CONTACT_JS_STRING_ARRAY_H_
25 #define _TIZEN_CONTACT_JS_STRING_ARRAY_H_
28 #include <JavaScriptCore/JavaScript.h>
29 #include <CommonsJavaScript/PrivateObject.h>
35 typedef std::vector<std::string> StringArray;
36 typedef DPL::SharedPtr<StringArray> StringArrayPtr;
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<StringArrayPtr>::Type JSStringArrayPriv;
43 static const JSClassDefinition* getClassInfo();
45 static JSClassRef getClassRef();
47 static JSObjectRef createArray(JSContextRef context,
48 const StringArrayPtr &Strings);
50 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
52 static StringArrayPtr getStringArray(JSContextRef context, JSValueRef value);
57 * The callback invoked when an object is first created.
59 static void initialize(JSContextRef context,
63 * The callback invoked when an object is finalized.
65 static void finalize(JSObjectRef object);
67 static JSValueRef getLength(JSContextRef context,
69 JSStringRef propertyName,
70 JSValueRef* exception);
72 static bool hasProperty(JSContextRef context,
74 JSStringRef propertyName);
76 static JSValueRef getProperty(JSContextRef context,
78 JSStringRef propertyName,
79 JSValueRef* exception);
81 static bool setProperty(JSContextRef context,
83 JSStringRef propertyName,
85 JSValueRef* exception);
87 static JSValueRef concat(JSContextRef context,
89 JSObjectRef thisObject,
91 const JSValueRef arguments[],
92 JSValueRef* exception);
93 static JSValueRef join(JSContextRef context,
95 JSObjectRef thisObject,
97 const JSValueRef arguments[],
98 JSValueRef* exception);
99 static JSValueRef pop(JSContextRef context,
100 JSObjectRef function,
101 JSObjectRef thisObject,
102 size_t argumentCount,
103 const JSValueRef arguments[],
104 JSValueRef* exception);
105 static JSValueRef push(JSContextRef context,
106 JSObjectRef function,
107 JSObjectRef thisObject,
108 size_t argumentCount,
109 const JSValueRef arguments[],
110 JSValueRef* exception);
111 static JSValueRef reverse(JSContextRef context,
112 JSObjectRef function,
113 JSObjectRef thisObject,
114 size_t argumentCount,
115 const JSValueRef arguments[],
116 JSValueRef* exception);
117 static JSValueRef shift(JSContextRef context,
118 JSObjectRef function,
119 JSObjectRef thisObject,
120 size_t argumentCount,
121 const JSValueRef arguments[],
122 JSValueRef* exception);
123 static JSValueRef slice(JSContextRef context,
124 JSObjectRef function,
125 JSObjectRef thisObject,
126 size_t argumentCount,
127 const JSValueRef arguments[],
128 JSValueRef* exception);
129 static JSValueRef sort(JSContextRef context,
130 JSObjectRef function,
131 JSObjectRef thisObject,
132 size_t argumentCount,
133 const JSValueRef arguments[],
134 JSValueRef* exception);
135 static JSValueRef splice(JSContextRef context,
136 JSObjectRef function,
137 JSObjectRef thisObject,
138 size_t argumentCount,
139 const JSValueRef arguments[],
140 JSValueRef* exception);
141 static JSValueRef toString(JSContextRef context,
142 JSObjectRef function,
143 JSObjectRef thisObject,
144 size_t argumentCount,
145 const JSValueRef arguments[],
146 JSValueRef* exception);
147 static JSValueRef unshift(JSContextRef context,
148 JSObjectRef function,
149 JSObjectRef thisObject,
150 size_t argumentCount,
151 const JSValueRef arguments[],
152 JSValueRef* exception);
153 static JSValueRef valueOf(JSContextRef context,
154 JSObjectRef function,
155 JSObjectRef thisObject,
156 size_t argumentCount,
157 const JSValueRef arguments[],
158 JSValueRef* exception);
160 static bool checkValue(const std::string &value);
162 static JSClassRef m_jsClassRef;
164 * This structure describes a statically declared function property.
166 static JSStaticFunction m_function[];
169 * This structure contains properties and callbacks that define a type of object.
171 static JSClassDefinition m_classInfo;
174 * This member variable contains the initialization values for the static properties of this class.
175 * The values are given according to the data structure JSPropertySpec
177 static JSStaticValue m_property[];
184 #endif // _TIZEN_CONTACT_JS_STRING_ARRAY_H_