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

https://bitbucket.org/ultra_iter/qt-vtl
C++ | 256 lines | 191 code | 43 blank | 22 comment | 12 complexity | aeb9c7e8d40301cab8f03bdb017b7afe 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(FILE_SYSTEM)
  19. #include "JSDirectoryEntry.h"
  20. #include "DirectoryEntry.h"
  21. #include "DirectoryReader.h"
  22. #include "ExceptionCode.h"
  23. #include "JSCustomVoidCallback.h"
  24. #include "JSDOMBinding.h"
  25. #include "JSDirectoryReader.h"
  26. #include "JSErrorCallback.h"
  27. #include <runtime/Error.h>
  28. #include <wtf/GetPtr.h>
  29. using namespace JSC;
  30. namespace WebCore {
  31. ASSERT_CLASS_FITS_IN_CELL(JSDirectoryEntry);
  32. /* Hash table */
  33. #if ENABLE(JIT)
  34. #define THUNK_GENERATOR(generator) , generator
  35. #else
  36. #define THUNK_GENERATOR(generator)
  37. #endif
  38. static const HashTableValue JSDirectoryEntryTableValues[2] =
  39. {
  40. { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDirectoryEntryConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
  41. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  42. };
  43. #undef THUNK_GENERATOR
  44. static JSC_CONST_HASHTABLE HashTable JSDirectoryEntryTable = { 2, 1, JSDirectoryEntryTableValues, 0 };
  45. /* Hash table for constructor */
  46. #if ENABLE(JIT)
  47. #define THUNK_GENERATOR(generator) , generator
  48. #else
  49. #define THUNK_GENERATOR(generator)
  50. #endif
  51. static const HashTableValue JSDirectoryEntryConstructorTableValues[1] =
  52. {
  53. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  54. };
  55. #undef THUNK_GENERATOR
  56. static JSC_CONST_HASHTABLE HashTable JSDirectoryEntryConstructorTable = { 1, 0, JSDirectoryEntryConstructorTableValues, 0 };
  57. class JSDirectoryEntryConstructor : public DOMConstructorObject {
  58. public:
  59. JSDirectoryEntryConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
  60. virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
  61. virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
  62. static const JSC::ClassInfo s_info;
  63. static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
  64. {
  65. return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
  66. }
  67. protected:
  68. static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
  69. };
  70. const ClassInfo JSDirectoryEntryConstructor::s_info = { "DirectoryEntryConstructor", &DOMConstructorObject::s_info, &JSDirectoryEntryConstructorTable, 0 };
  71. JSDirectoryEntryConstructor::JSDirectoryEntryConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
  72. : DOMConstructorObject(structure, globalObject)
  73. {
  74. ASSERT(inherits(&s_info));
  75. putDirect(exec->globalData(), exec->propertyNames().prototype, JSDirectoryEntryPrototype::self(exec, globalObject), DontDelete | ReadOnly);
  76. }
  77. bool JSDirectoryEntryConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  78. {
  79. return getStaticValueSlot<JSDirectoryEntryConstructor, JSDOMWrapper>(exec, &JSDirectoryEntryConstructorTable, this, propertyName, slot);
  80. }
  81. bool JSDirectoryEntryConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  82. {
  83. return getStaticValueDescriptor<JSDirectoryEntryConstructor, JSDOMWrapper>(exec, &JSDirectoryEntryConstructorTable, this, propertyName, descriptor);
  84. }
  85. /* Hash table for prototype */
  86. #if ENABLE(JIT)
  87. #define THUNK_GENERATOR(generator) , generator
  88. #else
  89. #define THUNK_GENERATOR(generator)
  90. #endif
  91. static const HashTableValue JSDirectoryEntryPrototypeTableValues[5] =
  92. {
  93. { "createReader", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDirectoryEntryPrototypeFunctionCreateReader), (intptr_t)0 THUNK_GENERATOR(0) },
  94. { "getFile", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDirectoryEntryPrototypeFunctionGetFile), (intptr_t)4 THUNK_GENERATOR(0) },
  95. { "getDirectory", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDirectoryEntryPrototypeFunctionGetDirectory), (intptr_t)4 THUNK_GENERATOR(0) },
  96. { "removeRecursively", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDirectoryEntryPrototypeFunctionRemoveRecursively), (intptr_t)2 THUNK_GENERATOR(0) },
  97. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  98. };
  99. #undef THUNK_GENERATOR
  100. static JSC_CONST_HASHTABLE HashTable JSDirectoryEntryPrototypeTable = { 10, 7, JSDirectoryEntryPrototypeTableValues, 0 };
  101. static const HashTable* getJSDirectoryEntryPrototypeTable(ExecState* exec)
  102. {
  103. return getHashTableForGlobalData(exec->globalData(), &JSDirectoryEntryPrototypeTable);
  104. }
  105. const ClassInfo JSDirectoryEntryPrototype::s_info = { "DirectoryEntryPrototype", &JSC::JSObjectWithGlobalObject::s_info, 0, getJSDirectoryEntryPrototypeTable };
  106. JSObject* JSDirectoryEntryPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
  107. {
  108. return getDOMPrototype<JSDirectoryEntry>(exec, globalObject);
  109. }
  110. bool JSDirectoryEntryPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  111. {
  112. return getStaticFunctionSlot<JSObject>(exec, getJSDirectoryEntryPrototypeTable(exec), this, propertyName, slot);
  113. }
  114. bool JSDirectoryEntryPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  115. {
  116. return getStaticFunctionDescriptor<JSObject>(exec, getJSDirectoryEntryPrototypeTable(exec), this, propertyName, descriptor);
  117. }
  118. static const HashTable* getJSDirectoryEntryTable(ExecState* exec)
  119. {
  120. return getHashTableForGlobalData(exec->globalData(), &JSDirectoryEntryTable);
  121. }
  122. const ClassInfo JSDirectoryEntry::s_info = { "DirectoryEntry", &JSEntry::s_info, 0, getJSDirectoryEntryTable };
  123. JSDirectoryEntry::JSDirectoryEntry(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<DirectoryEntry> impl)
  124. : JSEntry(structure, globalObject, impl)
  125. {
  126. ASSERT(inherits(&s_info));
  127. }
  128. JSObject* JSDirectoryEntry::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
  129. {
  130. return new (exec) JSDirectoryEntryPrototype(exec->globalData(), globalObject, JSDirectoryEntryPrototype::createStructure(exec->globalData(), JSEntryPrototype::self(exec, globalObject)));
  131. }
  132. bool JSDirectoryEntry::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  133. {
  134. return getStaticValueSlot<JSDirectoryEntry, Base>(exec, getJSDirectoryEntryTable(exec), this, propertyName, slot);
  135. }
  136. bool JSDirectoryEntry::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  137. {
  138. return getStaticValueDescriptor<JSDirectoryEntry, Base>(exec, getJSDirectoryEntryTable(exec), this, propertyName, descriptor);
  139. }
  140. JSValue jsDirectoryEntryConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
  141. {
  142. JSDirectoryEntry* domObject = static_cast<JSDirectoryEntry*>(asObject(slotBase));
  143. return JSDirectoryEntry::getConstructor(exec, domObject->globalObject());
  144. }
  145. JSValue JSDirectoryEntry::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
  146. {
  147. return getDOMConstructor<JSDirectoryEntryConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
  148. }
  149. EncodedJSValue JSC_HOST_CALL jsDirectoryEntryPrototypeFunctionCreateReader(ExecState* exec)
  150. {
  151. JSValue thisValue = exec->hostThisValue();
  152. if (!thisValue.inherits(&JSDirectoryEntry::s_info))
  153. return throwVMTypeError(exec);
  154. JSDirectoryEntry* castedThis = static_cast<JSDirectoryEntry*>(asObject(thisValue));
  155. DirectoryEntry* imp = static_cast<DirectoryEntry*>(castedThis->impl());
  156. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createReader()));
  157. return JSValue::encode(result);
  158. }
  159. EncodedJSValue JSC_HOST_CALL jsDirectoryEntryPrototypeFunctionGetFile(ExecState* exec)
  160. {
  161. JSValue thisValue = exec->hostThisValue();
  162. if (!thisValue.inherits(&JSDirectoryEntry::s_info))
  163. return throwVMTypeError(exec);
  164. JSDirectoryEntry* castedThis = static_cast<JSDirectoryEntry*>(asObject(thisValue));
  165. return JSValue::encode(castedThis->getFile(exec));
  166. }
  167. EncodedJSValue JSC_HOST_CALL jsDirectoryEntryPrototypeFunctionGetDirectory(ExecState* exec)
  168. {
  169. JSValue thisValue = exec->hostThisValue();
  170. if (!thisValue.inherits(&JSDirectoryEntry::s_info))
  171. return throwVMTypeError(exec);
  172. JSDirectoryEntry* castedThis = static_cast<JSDirectoryEntry*>(asObject(thisValue));
  173. return JSValue::encode(castedThis->getDirectory(exec));
  174. }
  175. EncodedJSValue JSC_HOST_CALL jsDirectoryEntryPrototypeFunctionRemoveRecursively(ExecState* exec)
  176. {
  177. JSValue thisValue = exec->hostThisValue();
  178. if (!thisValue.inherits(&JSDirectoryEntry::s_info))
  179. return throwVMTypeError(exec);
  180. JSDirectoryEntry* castedThis = static_cast<JSDirectoryEntry*>(asObject(thisValue));
  181. DirectoryEntry* imp = static_cast<DirectoryEntry*>(castedThis->impl());
  182. RefPtr<VoidCallback> successCallback;
  183. if (exec->argumentCount() > 0 && !exec->argument(0).isNull() && !exec->argument(0).isUndefined()) {
  184. if (!exec->argument(0).isObject()) {
  185. setDOMException(exec, TYPE_MISMATCH_ERR);
  186. return JSValue::encode(jsUndefined());
  187. }
  188. successCallback = JSCustomVoidCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
  189. }
  190. RefPtr<ErrorCallback> errorCallback;
  191. if (exec->argumentCount() > 1 && !exec->argument(1).isNull() && !exec->argument(1).isUndefined()) {
  192. if (!exec->argument(1).isObject()) {
  193. setDOMException(exec, TYPE_MISMATCH_ERR);
  194. return JSValue::encode(jsUndefined());
  195. }
  196. errorCallback = JSErrorCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
  197. }
  198. imp->removeRecursively(successCallback, errorCallback);
  199. return JSValue::encode(jsUndefined());
  200. }
  201. JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DirectoryEntry* impl)
  202. {
  203. return wrap<JSDirectoryEntry>(exec, globalObject, impl);
  204. }
  205. DirectoryEntry* toDirectoryEntry(JSC::JSValue value)
  206. {
  207. return value.inherits(&JSDirectoryEntry::s_info) ? static_cast<JSDirectoryEntry*>(asObject(value))->impl() : 0;
  208. }
  209. }
  210. #endif // ENABLE(FILE_SYSTEM)