/src/3rdparty/webkit/Source/WebCore/generated/JSIDBIndex.cpp

https://bitbucket.org/ultra_iter/qt-vtl · C++ · 359 lines · 273 code · 64 blank · 22 comment · 18 complexity · 1a408ec952a5624f1e2a792230c43cf4 MD5 · raw file

  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. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #include "config.h"
  18. #if ENABLE(INDEXED_DATABASE)
  19. #include "JSIDBIndex.h"
  20. #include "ExceptionCode.h"
  21. #include "IDBBindingUtilities.h"
  22. #include "IDBIndex.h"
  23. #include "IDBKey.h"
  24. #include "IDBObjectStore.h"
  25. #include "IDBRequest.h"
  26. #include "JSDOMBinding.h"
  27. #include "JSIDBKeyRange.h"
  28. #include "JSIDBObjectStore.h"
  29. #include "JSIDBRequest.h"
  30. #include "KURL.h"
  31. #include <runtime/Error.h>
  32. #include <runtime/JSString.h>
  33. #include <wtf/GetPtr.h>
  34. using namespace JSC;
  35. namespace WebCore {
  36. ASSERT_CLASS_FITS_IN_CELL(JSIDBIndex);
  37. /* Hash table */
  38. #if ENABLE(JIT)
  39. #define THUNK_GENERATOR(generator) , generator
  40. #else
  41. #define THUNK_GENERATOR(generator)
  42. #endif
  43. static const HashTableValue JSIDBIndexTableValues[6] =
  44. {
  45. { "name", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBIndexName), (intptr_t)0 THUNK_GENERATOR(0) },
  46. { "objectStore", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBIndexObjectStore), (intptr_t)0 THUNK_GENERATOR(0) },
  47. { "keyPath", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBIndexKeyPath), (intptr_t)0 THUNK_GENERATOR(0) },
  48. { "unique", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBIndexUnique), (intptr_t)0 THUNK_GENERATOR(0) },
  49. { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBIndexConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
  50. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  51. };
  52. #undef THUNK_GENERATOR
  53. static JSC_CONST_HASHTABLE HashTable JSIDBIndexTable = { 17, 15, JSIDBIndexTableValues, 0 };
  54. /* Hash table for constructor */
  55. #if ENABLE(JIT)
  56. #define THUNK_GENERATOR(generator) , generator
  57. #else
  58. #define THUNK_GENERATOR(generator)
  59. #endif
  60. static const HashTableValue JSIDBIndexConstructorTableValues[1] =
  61. {
  62. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  63. };
  64. #undef THUNK_GENERATOR
  65. static JSC_CONST_HASHTABLE HashTable JSIDBIndexConstructorTable = { 1, 0, JSIDBIndexConstructorTableValues, 0 };
  66. class JSIDBIndexConstructor : public DOMConstructorObject {
  67. public:
  68. JSIDBIndexConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
  69. virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
  70. virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
  71. static const JSC::ClassInfo s_info;
  72. static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
  73. {
  74. return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
  75. }
  76. protected:
  77. static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
  78. };
  79. const ClassInfo JSIDBIndexConstructor::s_info = { "IDBIndexConstructor", &DOMConstructorObject::s_info, &JSIDBIndexConstructorTable, 0 };
  80. JSIDBIndexConstructor::JSIDBIndexConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
  81. : DOMConstructorObject(structure, globalObject)
  82. {
  83. ASSERT(inherits(&s_info));
  84. putDirect(exec->globalData(), exec->propertyNames().prototype, JSIDBIndexPrototype::self(exec, globalObject), DontDelete | ReadOnly);
  85. }
  86. bool JSIDBIndexConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  87. {
  88. return getStaticValueSlot<JSIDBIndexConstructor, JSDOMWrapper>(exec, &JSIDBIndexConstructorTable, this, propertyName, slot);
  89. }
  90. bool JSIDBIndexConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  91. {
  92. return getStaticValueDescriptor<JSIDBIndexConstructor, JSDOMWrapper>(exec, &JSIDBIndexConstructorTable, this, propertyName, descriptor);
  93. }
  94. /* Hash table for prototype */
  95. #if ENABLE(JIT)
  96. #define THUNK_GENERATOR(generator) , generator
  97. #else
  98. #define THUNK_GENERATOR(generator)
  99. #endif
  100. static const HashTableValue JSIDBIndexPrototypeTableValues[5] =
  101. {
  102. { "openCursor", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIDBIndexPrototypeFunctionOpenCursor), (intptr_t)2 THUNK_GENERATOR(0) },
  103. { "openKeyCursor", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIDBIndexPrototypeFunctionOpenKeyCursor), (intptr_t)2 THUNK_GENERATOR(0) },
  104. { "get", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIDBIndexPrototypeFunctionGet), (intptr_t)1 THUNK_GENERATOR(0) },
  105. { "getKey", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIDBIndexPrototypeFunctionGetKey), (intptr_t)1 THUNK_GENERATOR(0) },
  106. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  107. };
  108. #undef THUNK_GENERATOR
  109. static JSC_CONST_HASHTABLE HashTable JSIDBIndexPrototypeTable = { 8, 7, JSIDBIndexPrototypeTableValues, 0 };
  110. const ClassInfo JSIDBIndexPrototype::s_info = { "IDBIndexPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSIDBIndexPrototypeTable, 0 };
  111. JSObject* JSIDBIndexPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
  112. {
  113. return getDOMPrototype<JSIDBIndex>(exec, globalObject);
  114. }
  115. bool JSIDBIndexPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  116. {
  117. return getStaticFunctionSlot<JSObject>(exec, &JSIDBIndexPrototypeTable, this, propertyName, slot);
  118. }
  119. bool JSIDBIndexPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  120. {
  121. return getStaticFunctionDescriptor<JSObject>(exec, &JSIDBIndexPrototypeTable, this, propertyName, descriptor);
  122. }
  123. const ClassInfo JSIDBIndex::s_info = { "IDBIndex", &JSDOMWrapper::s_info, &JSIDBIndexTable, 0 };
  124. JSIDBIndex::JSIDBIndex(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<IDBIndex> impl)
  125. : JSDOMWrapper(structure, globalObject)
  126. , m_impl(impl)
  127. {
  128. ASSERT(inherits(&s_info));
  129. }
  130. JSObject* JSIDBIndex::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
  131. {
  132. return new (exec) JSIDBIndexPrototype(exec->globalData(), globalObject, JSIDBIndexPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
  133. }
  134. bool JSIDBIndex::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  135. {
  136. return getStaticValueSlot<JSIDBIndex, Base>(exec, &JSIDBIndexTable, this, propertyName, slot);
  137. }
  138. bool JSIDBIndex::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  139. {
  140. return getStaticValueDescriptor<JSIDBIndex, Base>(exec, &JSIDBIndexTable, this, propertyName, descriptor);
  141. }
  142. JSValue jsIDBIndexName(ExecState* exec, JSValue slotBase, const Identifier&)
  143. {
  144. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(slotBase));
  145. UNUSED_PARAM(exec);
  146. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  147. JSValue result = jsString(exec, imp->name());
  148. return result;
  149. }
  150. JSValue jsIDBIndexObjectStore(ExecState* exec, JSValue slotBase, const Identifier&)
  151. {
  152. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(slotBase));
  153. UNUSED_PARAM(exec);
  154. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  155. JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objectStore()));
  156. return result;
  157. }
  158. JSValue jsIDBIndexKeyPath(ExecState* exec, JSValue slotBase, const Identifier&)
  159. {
  160. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(slotBase));
  161. UNUSED_PARAM(exec);
  162. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  163. JSValue result = jsString(exec, imp->keyPath());
  164. return result;
  165. }
  166. JSValue jsIDBIndexUnique(ExecState* exec, JSValue slotBase, const Identifier&)
  167. {
  168. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(slotBase));
  169. UNUSED_PARAM(exec);
  170. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  171. JSValue result = jsBoolean(imp->unique());
  172. return result;
  173. }
  174. JSValue jsIDBIndexConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
  175. {
  176. JSIDBIndex* domObject = static_cast<JSIDBIndex*>(asObject(slotBase));
  177. return JSIDBIndex::getConstructor(exec, domObject->globalObject());
  178. }
  179. JSValue JSIDBIndex::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
  180. {
  181. return getDOMConstructor<JSIDBIndexConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
  182. }
  183. EncodedJSValue JSC_HOST_CALL jsIDBIndexPrototypeFunctionOpenCursor(ExecState* exec)
  184. {
  185. JSValue thisValue = exec->hostThisValue();
  186. if (!thisValue.inherits(&JSIDBIndex::s_info))
  187. return throwVMTypeError(exec);
  188. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(thisValue));
  189. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  190. ExceptionCode ec = 0;
  191. ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
  192. if (!scriptContext)
  193. return JSValue::encode(jsUndefined());
  194. int argsCount = exec->argumentCount();
  195. if (argsCount <= 0) {
  196. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openCursor(scriptContext, ec)));
  197. setDOMException(exec, ec);
  198. return JSValue::encode(result);
  199. }
  200. IDBKeyRange* range(toIDBKeyRange(exec->argument(0)));
  201. if (exec->hadException())
  202. return JSValue::encode(jsUndefined());
  203. if (argsCount <= 1) {
  204. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openCursor(scriptContext, range, ec)));
  205. setDOMException(exec, ec);
  206. return JSValue::encode(result);
  207. }
  208. unsigned short direction(exec->argument(1).toUInt32(exec));
  209. if (exec->hadException())
  210. return JSValue::encode(jsUndefined());
  211. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openCursor(scriptContext, range, direction, ec)));
  212. setDOMException(exec, ec);
  213. return JSValue::encode(result);
  214. }
  215. EncodedJSValue JSC_HOST_CALL jsIDBIndexPrototypeFunctionOpenKeyCursor(ExecState* exec)
  216. {
  217. JSValue thisValue = exec->hostThisValue();
  218. if (!thisValue.inherits(&JSIDBIndex::s_info))
  219. return throwVMTypeError(exec);
  220. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(thisValue));
  221. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  222. ExceptionCode ec = 0;
  223. ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
  224. if (!scriptContext)
  225. return JSValue::encode(jsUndefined());
  226. int argsCount = exec->argumentCount();
  227. if (argsCount <= 0) {
  228. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openKeyCursor(scriptContext, ec)));
  229. setDOMException(exec, ec);
  230. return JSValue::encode(result);
  231. }
  232. IDBKeyRange* range(toIDBKeyRange(exec->argument(0)));
  233. if (exec->hadException())
  234. return JSValue::encode(jsUndefined());
  235. if (argsCount <= 1) {
  236. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openKeyCursor(scriptContext, range, ec)));
  237. setDOMException(exec, ec);
  238. return JSValue::encode(result);
  239. }
  240. unsigned short direction(exec->argument(1).toUInt32(exec));
  241. if (exec->hadException())
  242. return JSValue::encode(jsUndefined());
  243. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openKeyCursor(scriptContext, range, direction, ec)));
  244. setDOMException(exec, ec);
  245. return JSValue::encode(result);
  246. }
  247. EncodedJSValue JSC_HOST_CALL jsIDBIndexPrototypeFunctionGet(ExecState* exec)
  248. {
  249. JSValue thisValue = exec->hostThisValue();
  250. if (!thisValue.inherits(&JSIDBIndex::s_info))
  251. return throwVMTypeError(exec);
  252. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(thisValue));
  253. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  254. ExceptionCode ec = 0;
  255. ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
  256. if (!scriptContext)
  257. return JSValue::encode(jsUndefined());
  258. RefPtr<IDBKey> key(createIDBKeyFromValue(exec, exec->argument(0)));
  259. if (exec->hadException())
  260. return JSValue::encode(jsUndefined());
  261. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->get(scriptContext, key, ec)));
  262. setDOMException(exec, ec);
  263. return JSValue::encode(result);
  264. }
  265. EncodedJSValue JSC_HOST_CALL jsIDBIndexPrototypeFunctionGetKey(ExecState* exec)
  266. {
  267. JSValue thisValue = exec->hostThisValue();
  268. if (!thisValue.inherits(&JSIDBIndex::s_info))
  269. return throwVMTypeError(exec);
  270. JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(thisValue));
  271. IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
  272. ExceptionCode ec = 0;
  273. ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
  274. if (!scriptContext)
  275. return JSValue::encode(jsUndefined());
  276. RefPtr<IDBKey> key(createIDBKeyFromValue(exec, exec->argument(0)));
  277. if (exec->hadException())
  278. return JSValue::encode(jsUndefined());
  279. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getKey(scriptContext, key, ec)));
  280. setDOMException(exec, ec);
  281. return JSValue::encode(result);
  282. }
  283. JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, IDBIndex* impl)
  284. {
  285. return wrap<JSIDBIndex>(exec, globalObject, impl);
  286. }
  287. IDBIndex* toIDBIndex(JSC::JSValue value)
  288. {
  289. return value.inherits(&JSIDBIndex::s_info) ? static_cast<JSIDBIndex*>(asObject(value))->impl() : 0;
  290. }
  291. }
  292. #endif // ENABLE(INDEXED_DATABASE)