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.
17 #ifndef WRTPLUGINS_TIZEN_JS_NDEFRECORD_ARRAY_H_
18 #define WRTPLUGINS_TIZEN_JS_NDEFRECORD_ARRAY_H_
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <API/NFC/INdefMessage.h>
27 class JSNdefRecordArray
31 static const JSClassDefinition* getClassInfo();
33 static JSClassRef getClassRef();
35 static JSObjectRef createArray(JSContextRef context,
36 const Api::NFC::INdefMessagePtr &recordArray);
38 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
40 static Api::NFC::INdefMessagePtr
41 getNdefRecordArray(JSContextRef context, JSValueRef value);
46 * The callback invoked when an object is first created.
48 static void initialize(JSContextRef context,
52 * The callback invoked when an object is finalized.
54 static void finalize(JSObjectRef object);
56 static JSValueRef getLength(JSContextRef context,
58 JSStringRef propertyName,
59 JSValueRef* exception);
61 static bool hasProperty(JSContextRef context,
63 JSStringRef propertyName);
65 static JSValueRef getProperty(JSContextRef context,
67 JSStringRef propertyName,
68 JSValueRef* exception);
70 static bool setProperty(JSContextRef context,
72 JSStringRef propertyName,
74 JSValueRef* exception);
75 static JSValueRef concat(JSContextRef context,
77 JSObjectRef thisObject,
79 const JSValueRef arguments[],
80 JSValueRef* exception);
81 static JSValueRef join(JSContextRef context,
83 JSObjectRef thisObject,
85 const JSValueRef arguments[],
86 JSValueRef* exception);
87 static JSValueRef pop(JSContextRef context,
89 JSObjectRef thisObject,
91 const JSValueRef arguments[],
92 JSValueRef* exception);
93 static JSValueRef push(JSContextRef context,
95 JSObjectRef thisObject,
97 const JSValueRef arguments[],
98 JSValueRef* exception);
99 static JSValueRef reverse(JSContextRef context,
100 JSObjectRef function,
101 JSObjectRef thisObject,
102 size_t argumentCount,
103 const JSValueRef arguments[],
104 JSValueRef* exception);
105 static JSValueRef shift(JSContextRef context,
106 JSObjectRef function,
107 JSObjectRef thisObject,
108 size_t argumentCount,
109 const JSValueRef arguments[],
110 JSValueRef* exception);
111 static JSValueRef slice(JSContextRef context,
112 JSObjectRef function,
113 JSObjectRef thisObject,
114 size_t argumentCount,
115 const JSValueRef arguments[],
116 JSValueRef* exception);
117 static JSValueRef sort(JSContextRef context,
118 JSObjectRef function,
119 JSObjectRef thisObject,
120 size_t argumentCount,
121 const JSValueRef arguments[],
122 JSValueRef* exception);
123 static JSValueRef splice(JSContextRef context,
124 JSObjectRef function,
125 JSObjectRef thisObject,
126 size_t argumentCount,
127 const JSValueRef arguments[],
128 JSValueRef* exception);
129 static JSValueRef toString(JSContextRef context,
130 JSObjectRef function,
131 JSObjectRef thisObject,
132 size_t argumentCount,
133 const JSValueRef arguments[],
134 JSValueRef* exception);
135 static JSValueRef unshift(JSContextRef context,
136 JSObjectRef function,
137 JSObjectRef thisObject,
138 size_t argumentCount,
139 const JSValueRef arguments[],
140 JSValueRef* exception);
141 static JSValueRef valueOf(JSContextRef context,
142 JSObjectRef function,
143 JSObjectRef thisObject,
144 size_t argumentCount,
145 const JSValueRef arguments[],
146 JSValueRef* exception);
148 static bool checkValue(const std::string &value);
149 static JSClassRef m_jsClassRef;
151 * This structure describes a statically declared function property.
153 static JSStaticFunction m_function[];
156 * This structure contains properties and callbacks that define a type of object.
158 static JSClassDefinition m_classInfo;
161 * This member variable contains the initialization values for the static properties of this class.
162 * The values are given according to the data structure JSPropertySpec
164 static JSStaticValue m_property[];