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 JSContactPhoneNumberArray.h
19 * @author Kisub Song (kisubs.song@samsung.com)
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_PHONE_NUMBER_ARRAY_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_PHONE_NUMBER_ARRAY_H_
27 #include <JavaScriptCore/JavaScript.h>
28 #include <CommonsJavaScript/PrivateObject.h>
29 #include <API/Contact/ContactPhoneNumber.h>
35 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<TizenApis::Api::Contact::ContactPhoneNumberArrayPtr>::Type JSContactPhoneNumberArrayPriv;
37 class JSContactPhoneNumberArray
41 static const JSClassDefinition* getClassInfo();
43 static JSClassRef getClassRef();
45 static JSObjectRef createArray(JSContextRef context,
46 const TizenApis::Api::Contact::ContactPhoneNumberArrayPtr &contactPhoneNumbers);
48 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
50 static TizenApis::Api::Contact::ContactPhoneNumberArrayPtr getContactPhoneNumberArray(JSContextRef context, JSValueRef value);
55 * The callback invoked when an object is first created.
57 static void initialize(JSContextRef context,
61 * The callback invoked when an object is finalized.
63 static void finalize(JSObjectRef object);
65 static JSValueRef getLength(JSContextRef context,
67 JSStringRef propertyName,
68 JSValueRef* exception);
70 static bool hasProperty(JSContextRef context,
72 JSStringRef propertyName);
74 static JSValueRef getProperty(JSContextRef context,
76 JSStringRef propertyName,
77 JSValueRef* exception);
79 static bool setProperty(JSContextRef context,
81 JSStringRef propertyName,
83 JSValueRef* exception);
85 static void getPropertyNames(JSContextRef context,
87 JSPropertyNameAccumulatorRef propertyNames);
89 static JSValueRef concat(JSContextRef context,
91 JSObjectRef thisObject,
93 const JSValueRef arguments[],
94 JSValueRef* exception);
95 static JSValueRef join(JSContextRef context,
97 JSObjectRef thisObject,
99 const JSValueRef arguments[],
100 JSValueRef* exception);
101 static JSValueRef pop(JSContextRef context,
102 JSObjectRef function,
103 JSObjectRef thisObject,
104 size_t argumentCount,
105 const JSValueRef arguments[],
106 JSValueRef* exception);
107 static JSValueRef push(JSContextRef context,
108 JSObjectRef function,
109 JSObjectRef thisObject,
110 size_t argumentCount,
111 const JSValueRef arguments[],
112 JSValueRef* exception);
113 static JSValueRef reverse(JSContextRef context,
114 JSObjectRef function,
115 JSObjectRef thisObject,
116 size_t argumentCount,
117 const JSValueRef arguments[],
118 JSValueRef* exception);
119 static JSValueRef shift(JSContextRef context,
120 JSObjectRef function,
121 JSObjectRef thisObject,
122 size_t argumentCount,
123 const JSValueRef arguments[],
124 JSValueRef* exception);
125 static JSValueRef slice(JSContextRef context,
126 JSObjectRef function,
127 JSObjectRef thisObject,
128 size_t argumentCount,
129 const JSValueRef arguments[],
130 JSValueRef* exception);
131 static JSValueRef sort(JSContextRef context,
132 JSObjectRef function,
133 JSObjectRef thisObject,
134 size_t argumentCount,
135 const JSValueRef arguments[],
136 JSValueRef* exception);
137 static JSValueRef splice(JSContextRef context,
138 JSObjectRef function,
139 JSObjectRef thisObject,
140 size_t argumentCount,
141 const JSValueRef arguments[],
142 JSValueRef* exception);
143 static JSValueRef toString(JSContextRef context,
144 JSObjectRef function,
145 JSObjectRef thisObject,
146 size_t argumentCount,
147 const JSValueRef arguments[],
148 JSValueRef* exception);
149 static JSValueRef unshift(JSContextRef context,
150 JSObjectRef function,
151 JSObjectRef thisObject,
152 size_t argumentCount,
153 const JSValueRef arguments[],
154 JSValueRef* exception);
155 static JSValueRef valueOf(JSContextRef context,
156 JSObjectRef function,
157 JSObjectRef thisObject,
158 size_t argumentCount,
159 const JSValueRef arguments[],
160 JSValueRef* exception);
162 static bool checkValue(const std::string &value);
164 static JSClassRef m_jsClassRef;
166 * This structure describes a statically declared function property.
168 static JSStaticFunction m_function[];
171 * This structure contains properties and callbacks that define a type of object.
173 static JSClassDefinition m_classInfo;
176 * This member variable contains the initialization values for the static properties of this class.
177 * The values are given according to the data structure JSPropertySpec
179 static JSStaticValue m_property[];
186 #endif // _TIZEN_CONTACT_JS_CONTACT_PHONE_NUMBER_ARRAY_H_