tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSSpeechInputResultList.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22
23 #if ENABLE(INPUT_SPEECH)
24
25 #include "JSSpeechInputResultList.h"
26
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSSpeechInputResult.h"
30 #include "SpeechInputResult.h"
31 #include "SpeechInputResultList.h"
32 #include <runtime/Error.h>
33 #include <runtime/PropertyNameArray.h>
34 #include <wtf/GetPtr.h>
35
36 using namespace JSC;
37
38 namespace WebCore {
39
40 ASSERT_CLASS_FITS_IN_CELL(JSSpeechInputResultList);
41
42 /* Hash table */
43 #if ENABLE(JIT)
44 #define THUNK_GENERATOR(generator) , generator
45 #else
46 #define THUNK_GENERATOR(generator)
47 #endif
48 #if ENABLE(DFG_JIT)
49 #define INTRINSIC(intrinsic) , intrinsic
50 #else
51 #define INTRINSIC(intrinsic)
52 #endif
53
54 static const HashTableValue JSSpeechInputResultListTableValues[] =
55 {
56     { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechInputResultListLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechInputResultListConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
59 };
60
61 #undef THUNK_GENERATOR
62 static const HashTable JSSpeechInputResultListTable = { 5, 3, JSSpeechInputResultListTableValues, 0 };
63 /* Hash table for constructor */
64 #if ENABLE(JIT)
65 #define THUNK_GENERATOR(generator) , generator
66 #else
67 #define THUNK_GENERATOR(generator)
68 #endif
69 #if ENABLE(DFG_JIT)
70 #define INTRINSIC(intrinsic) , intrinsic
71 #else
72 #define INTRINSIC(intrinsic)
73 #endif
74
75 static const HashTableValue JSSpeechInputResultListConstructorTableValues[] =
76 {
77     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
78 };
79
80 #undef THUNK_GENERATOR
81 static const HashTable JSSpeechInputResultListConstructorTable = { 1, 0, JSSpeechInputResultListConstructorTableValues, 0 };
82 const ClassInfo JSSpeechInputResultListConstructor::s_info = { "SpeechInputResultListConstructor", &DOMConstructorObject::s_info, &JSSpeechInputResultListConstructorTable, 0, CREATE_METHOD_TABLE(JSSpeechInputResultListConstructor) };
83
84 JSSpeechInputResultListConstructor::JSSpeechInputResultListConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
85     : DOMConstructorObject(structure, globalObject)
86 {
87 }
88
89 void JSSpeechInputResultListConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
90 {
91     Base::finishCreation(exec->globalData());
92     ASSERT(inherits(&s_info));
93     putDirect(exec->globalData(), exec->propertyNames().prototype, JSSpeechInputResultListPrototype::self(exec, globalObject), DontDelete | ReadOnly);
94 }
95
96 bool JSSpeechInputResultListConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
97 {
98     return getStaticValueSlot<JSSpeechInputResultListConstructor, JSDOMWrapper>(exec, &JSSpeechInputResultListConstructorTable, static_cast<JSSpeechInputResultListConstructor*>(cell), propertyName, slot);
99 }
100
101 bool JSSpeechInputResultListConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
102 {
103     return getStaticValueDescriptor<JSSpeechInputResultListConstructor, JSDOMWrapper>(exec, &JSSpeechInputResultListConstructorTable, static_cast<JSSpeechInputResultListConstructor*>(object), propertyName, descriptor);
104 }
105
106 /* Hash table for prototype */
107 #if ENABLE(JIT)
108 #define THUNK_GENERATOR(generator) , generator
109 #else
110 #define THUNK_GENERATOR(generator)
111 #endif
112 #if ENABLE(DFG_JIT)
113 #define INTRINSIC(intrinsic) , intrinsic
114 #else
115 #define INTRINSIC(intrinsic)
116 #endif
117
118 static const HashTableValue JSSpeechInputResultListPrototypeTableValues[] =
119 {
120     { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSpeechInputResultListPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
121     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
122 };
123
124 #undef THUNK_GENERATOR
125 static const HashTable JSSpeechInputResultListPrototypeTable = { 2, 1, JSSpeechInputResultListPrototypeTableValues, 0 };
126 const ClassInfo JSSpeechInputResultListPrototype::s_info = { "SpeechInputResultListPrototype", &JSC::JSNonFinalObject::s_info, &JSSpeechInputResultListPrototypeTable, 0, CREATE_METHOD_TABLE(JSSpeechInputResultListPrototype) };
127
128 JSObject* JSSpeechInputResultListPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
129 {
130     return getDOMPrototype<JSSpeechInputResultList>(exec, globalObject);
131 }
132
133 bool JSSpeechInputResultListPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
134 {
135     JSSpeechInputResultListPrototype* thisObject = jsCast<JSSpeechInputResultListPrototype*>(cell);
136     return getStaticFunctionSlot<JSObject>(exec, &JSSpeechInputResultListPrototypeTable, thisObject, propertyName, slot);
137 }
138
139 bool JSSpeechInputResultListPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
140 {
141     JSSpeechInputResultListPrototype* thisObject = jsCast<JSSpeechInputResultListPrototype*>(object);
142     return getStaticFunctionDescriptor<JSObject>(exec, &JSSpeechInputResultListPrototypeTable, thisObject, propertyName, descriptor);
143 }
144
145 const ClassInfo JSSpeechInputResultList::s_info = { "SpeechInputResultList", &JSDOMWrapper::s_info, &JSSpeechInputResultListTable, 0 , CREATE_METHOD_TABLE(JSSpeechInputResultList) };
146
147 JSSpeechInputResultList::JSSpeechInputResultList(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SpeechInputResultList> impl)
148     : JSDOMWrapper(structure, globalObject)
149     , m_impl(impl.leakRef())
150 {
151 }
152
153 void JSSpeechInputResultList::finishCreation(JSGlobalData& globalData)
154 {
155     Base::finishCreation(globalData);
156     ASSERT(inherits(&s_info));
157 }
158
159 JSObject* JSSpeechInputResultList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
160 {
161     return JSSpeechInputResultListPrototype::create(exec->globalData(), globalObject, JSSpeechInputResultListPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
162 }
163
164 bool JSSpeechInputResultList::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
165 {
166     JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(cell);
167     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
168     const HashEntry* entry = JSSpeechInputResultListTable.entry(exec, propertyName);
169     if (entry) {
170         slot.setCustom(thisObject, entry->propertyGetter());
171         return true;
172     }
173     bool ok;
174     unsigned index = propertyName.toUInt32(ok);
175     if (ok && index < static_cast<SpeechInputResultList*>(thisObject->impl())->length()) {
176         slot.setCustomIndex(thisObject, index, indexGetter);
177         return true;
178     }
179     return getStaticValueSlot<JSSpeechInputResultList, Base>(exec, &JSSpeechInputResultListTable, thisObject, propertyName, slot);
180 }
181
182 bool JSSpeechInputResultList::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
183 {
184     JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(object);
185     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
186     const HashEntry* entry = JSSpeechInputResultListTable.entry(exec, propertyName);
187     if (entry) {
188         PropertySlot slot;
189         slot.setCustom(thisObject, entry->propertyGetter());
190         descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
191         return true;
192     }
193     bool ok;
194     unsigned index = propertyName.toUInt32(ok);
195     if (ok && index < static_cast<SpeechInputResultList*>(thisObject->impl())->length()) {
196         PropertySlot slot;
197         slot.setCustomIndex(thisObject, index, indexGetter);
198         descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
199         return true;
200     }
201     return getStaticValueDescriptor<JSSpeechInputResultList, Base>(exec, &JSSpeechInputResultListTable, thisObject, propertyName, descriptor);
202 }
203
204 bool JSSpeechInputResultList::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
205 {
206     JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(cell);
207     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
208     if (propertyName < static_cast<SpeechInputResultList*>(thisObject->impl())->length()) {
209         slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
210         return true;
211     }
212     return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
213 }
214
215 JSValue jsSpeechInputResultListLength(ExecState* exec, JSValue slotBase, const Identifier&)
216 {
217     JSSpeechInputResultList* castedThis = static_cast<JSSpeechInputResultList*>(asObject(slotBase));
218     UNUSED_PARAM(exec);
219     SpeechInputResultList* imp = static_cast<SpeechInputResultList*>(castedThis->impl());
220     JSValue result = jsNumber(imp->length());
221     return result;
222 }
223
224
225 JSValue jsSpeechInputResultListConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
226 {
227     JSSpeechInputResultList* domObject = static_cast<JSSpeechInputResultList*>(asObject(slotBase));
228     return JSSpeechInputResultList::getConstructor(exec, domObject->globalObject());
229 }
230
231 void JSSpeechInputResultList::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
232 {
233     JSSpeechInputResultList* thisObject = jsCast<JSSpeechInputResultList*>(object);
234     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
235     for (unsigned i = 0; i < static_cast<SpeechInputResultList*>(thisObject->impl())->length(); ++i)
236         propertyNames.add(Identifier::from(exec, i));
237      Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
238 }
239
240 JSValue JSSpeechInputResultList::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
241 {
242     return getDOMConstructor<JSSpeechInputResultListConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
243 }
244
245 EncodedJSValue JSC_HOST_CALL jsSpeechInputResultListPrototypeFunctionItem(ExecState* exec)
246 {
247     JSValue thisValue = exec->hostThisValue();
248     if (!thisValue.inherits(&JSSpeechInputResultList::s_info))
249         return throwVMTypeError(exec);
250     JSSpeechInputResultList* castedThis = static_cast<JSSpeechInputResultList*>(asObject(thisValue));
251     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSpeechInputResultList::s_info);
252     SpeechInputResultList* imp = static_cast<SpeechInputResultList*>(castedThis->impl());
253     if (exec->argumentCount() < 1)
254         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
255     int index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
256     if (index < 0) {
257         setDOMException(exec, INDEX_SIZE_ERR);
258         return JSValue::encode(jsUndefined());
259     }
260     if (exec->hadException())
261         return JSValue::encode(jsUndefined());
262
263     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
264     return JSValue::encode(result);
265 }
266
267
268 JSValue JSSpeechInputResultList::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
269 {
270     JSSpeechInputResultList* thisObj = static_cast<JSSpeechInputResultList*>(asObject(slotBase));
271     ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
272     return toJS(exec, thisObj->globalObject(), static_cast<SpeechInputResultList*>(thisObj->impl())->item(index));
273 }
274
275 static inline bool isObservable(JSSpeechInputResultList* jsSpeechInputResultList)
276 {
277     if (jsSpeechInputResultList->hasCustomProperties())
278         return true;
279     return false;
280 }
281
282 bool JSSpeechInputResultListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
283 {
284     JSSpeechInputResultList* jsSpeechInputResultList = static_cast<JSSpeechInputResultList*>(handle.get().asCell());
285     if (!isObservable(jsSpeechInputResultList))
286         return false;
287     UNUSED_PARAM(visitor);
288     return false;
289 }
290
291 void JSSpeechInputResultListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
292 {
293     JSSpeechInputResultList* jsSpeechInputResultList = static_cast<JSSpeechInputResultList*>(handle.get().asCell());
294     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
295     uncacheWrapper(world, jsSpeechInputResultList->impl(), jsSpeechInputResultList);
296     jsSpeechInputResultList->releaseImpl();
297 }
298
299 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SpeechInputResultList* impl)
300 {
301     return wrap<JSSpeechInputResultList>(exec, globalObject, impl);
302 }
303
304 SpeechInputResultList* toSpeechInputResultList(JSC::JSValue value)
305 {
306     return value.inherits(&JSSpeechInputResultList::s_info) ? static_cast<JSSpeechInputResultList*>(asObject(value))->impl() : 0;
307 }
308
309 }
310
311 #endif // ENABLE(INPUT_SPEECH)