diff -r 000000000000 -r 4f2f89ce4247 WebCore/generated/JSXPathResult.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebCore/generated/JSXPathResult.cpp Fri Sep 17 09:02:29 2010 +0300 @@ -0,0 +1,377 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#if ENABLE(XPATH) + +#include "JSXPathResult.h" + +#include "JSNode.h" +#include "KURL.h" +#include "Node.h" +#include "XPathResult.h" +#include +#include +#include +#include + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSXPathResult); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSXPathResultTableValues[9] = +{ + { "resultType", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultResultType), (intptr_t)0 THUNK_GENERATOR(0) }, + { "numberValue", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultNumberValue), (intptr_t)0 THUNK_GENERATOR(0) }, + { "stringValue", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultStringValue), (intptr_t)0 THUNK_GENERATOR(0) }, + { "booleanValue", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultBooleanValue), (intptr_t)0 THUNK_GENERATOR(0) }, + { "singleNodeValue", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultSingleNodeValue), (intptr_t)0 THUNK_GENERATOR(0) }, + { "invalidIteratorState", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultInvalidIteratorState), (intptr_t)0 THUNK_GENERATOR(0) }, + { "snapshotLength", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultSnapshotLength), (intptr_t)0 THUNK_GENERATOR(0) }, + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsXPathResultConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSXPathResultTable = { 18, 15, JSXPathResultTableValues, 0 }; +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSXPathResultConstructorTableValues[11] = +{ + { "ANY_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultANY_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "NUMBER_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultNUMBER_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "STRING_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultSTRING_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "BOOLEAN_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultBOOLEAN_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultUNORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultANY_UNORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultFIRST_ORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSXPathResultConstructorTable = { 33, 31, JSXPathResultConstructorTableValues, 0 }; + +COMPILE_ASSERT(0 == XPathResult::ANY_TYPE, XPathResultEnumANY_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(1 == XPathResult::NUMBER_TYPE, XPathResultEnumNUMBER_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(2 == XPathResult::STRING_TYPE, XPathResultEnumSTRING_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(3 == XPathResult::BOOLEAN_TYPE, XPathResultEnumBOOLEAN_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(4 == XPathResult::UNORDERED_NODE_ITERATOR_TYPE, XPathResultEnumUNORDERED_NODE_ITERATOR_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(5 == XPathResult::ORDERED_NODE_ITERATOR_TYPE, XPathResultEnumORDERED_NODE_ITERATOR_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(6 == XPathResult::UNORDERED_NODE_SNAPSHOT_TYPE, XPathResultEnumUNORDERED_NODE_SNAPSHOT_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(7 == XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, XPathResultEnumORDERED_NODE_SNAPSHOT_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(8 == XPathResult::ANY_UNORDERED_NODE_TYPE, XPathResultEnumANY_UNORDERED_NODE_TYPEIsWrongUseDontCheckEnums); +COMPILE_ASSERT(9 == XPathResult::FIRST_ORDERED_NODE_TYPE, XPathResultEnumFIRST_ORDERED_NODE_TYPEIsWrongUseDontCheckEnums); + +class JSXPathResultConstructor : public DOMConstructorObject { +public: + JSXPathResultConstructor(JSC::ExecState*, JSDOMGlobalObject*); + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + static PassRefPtr createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +const ClassInfo JSXPathResultConstructor::s_info = { "XPathResultConstructor", 0, &JSXPathResultConstructorTable, 0 }; + +JSXPathResultConstructor::JSXPathResultConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSXPathResultConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSXPathResultPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSXPathResultConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSXPathResultConstructorTable, this, propertyName, slot); +} + +bool JSXPathResultConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSXPathResultConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSXPathResultPrototypeTableValues[13] = +{ + { "ANY_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultANY_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "NUMBER_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultNUMBER_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "STRING_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultSTRING_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "BOOLEAN_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultBOOLEAN_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultUNORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultANY_UNORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast(jsXPathResultFIRST_ORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) }, + { "iterateNext", DontDelete | Function, (intptr_t)static_cast(jsXPathResultPrototypeFunctionIterateNext), (intptr_t)0 THUNK_GENERATOR(0) }, + { "snapshotItem", DontDelete | Function, (intptr_t)static_cast(jsXPathResultPrototypeFunctionSnapshotItem), (intptr_t)1 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSXPathResultPrototypeTable = { 33, 31, JSXPathResultPrototypeTableValues, 0 }; +const ClassInfo JSXPathResultPrototype::s_info = { "XPathResultPrototype", 0, &JSXPathResultPrototypeTable, 0 }; + +JSObject* JSXPathResultPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype(exec, globalObject); +} + +bool JSXPathResultPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticPropertySlot(exec, &JSXPathResultPrototypeTable, this, propertyName, slot); +} + +bool JSXPathResultPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticPropertyDescriptor(exec, &JSXPathResultPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSXPathResult::s_info = { "XPathResult", 0, &JSXPathResultTable, 0 }; + +JSXPathResult::JSXPathResult(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) + : DOMObjectWithGlobalPointer(structure, globalObject) + , m_impl(impl) +{ +} + +JSXPathResult::~JSXPathResult() +{ + forgetDOMObject(this, impl()); +} + +JSObject* JSXPathResult::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSXPathResultPrototype(globalObject, JSXPathResultPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSXPathResult::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSXPathResultTable, this, propertyName, slot); +} + +bool JSXPathResult::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSXPathResultTable, this, propertyName, descriptor); +} + +JSValue jsXPathResultResultType(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + XPathResult* imp = static_cast(castedThis->impl()); + JSValue result = jsNumber(exec, imp->resultType()); + return result; +} + +JSValue jsXPathResultNumberValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* castedThis = static_cast(asObject(slotBase)); + ExceptionCode ec = 0; + XPathResult* imp = static_cast(castedThis->impl()); + JSC::JSValue result = jsNumber(exec, imp->numberValue(ec)); + setDOMException(exec, ec); + return result; +} + +JSValue jsXPathResultStringValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* castedThis = static_cast(asObject(slotBase)); + ExceptionCode ec = 0; + XPathResult* imp = static_cast(castedThis->impl()); + JSC::JSValue result = jsString(exec, imp->stringValue(ec)); + setDOMException(exec, ec); + return result; +} + +JSValue jsXPathResultBooleanValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* castedThis = static_cast(asObject(slotBase)); + ExceptionCode ec = 0; + XPathResult* imp = static_cast(castedThis->impl()); + JSC::JSValue result = jsBoolean(imp->booleanValue(ec)); + setDOMException(exec, ec); + return result; +} + +JSValue jsXPathResultSingleNodeValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* castedThis = static_cast(asObject(slotBase)); + ExceptionCode ec = 0; + XPathResult* imp = static_cast(castedThis->impl()); + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->singleNodeValue(ec))); + setDOMException(exec, ec); + return result; +} + +JSValue jsXPathResultInvalidIteratorState(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + XPathResult* imp = static_cast(castedThis->impl()); + JSValue result = jsBoolean(imp->invalidIteratorState()); + return result; +} + +JSValue jsXPathResultSnapshotLength(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* castedThis = static_cast(asObject(slotBase)); + ExceptionCode ec = 0; + XPathResult* imp = static_cast(castedThis->impl()); + JSC::JSValue result = jsNumber(exec, imp->snapshotLength(ec)); + setDOMException(exec, ec); + return result; +} + +JSValue jsXPathResultConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSXPathResult* domObject = static_cast(asObject(slotBase)); + return JSXPathResult::getConstructor(exec, domObject->globalObject()); +} +JSValue JSXPathResult::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor(exec, static_cast(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionIterateNext(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSXPathResult::s_info)) + return throwVMTypeError(exec); + JSXPathResult* castedThis = static_cast(asObject(thisValue)); + XPathResult* imp = static_cast(castedThis->impl()); + ExceptionCode ec = 0; + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->iterateNext(ec))); + setDOMException(exec, ec); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionSnapshotItem(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSXPathResult::s_info)) + return throwVMTypeError(exec); + JSXPathResult* castedThis = static_cast(asObject(thisValue)); + XPathResult* imp = static_cast(castedThis->impl()); + ExceptionCode ec = 0; + unsigned index = exec->argument(0).toInt32(exec); + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->snapshotItem(index, ec))); + setDOMException(exec, ec); + return JSValue::encode(result); +} + +// Constant getters + +JSValue jsXPathResultANY_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(0)); +} + +JSValue jsXPathResultNUMBER_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(1)); +} + +JSValue jsXPathResultSTRING_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(2)); +} + +JSValue jsXPathResultBOOLEAN_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(3)); +} + +JSValue jsXPathResultUNORDERED_NODE_ITERATOR_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(4)); +} + +JSValue jsXPathResultORDERED_NODE_ITERATOR_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(5)); +} + +JSValue jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(6)); +} + +JSValue jsXPathResultORDERED_NODE_SNAPSHOT_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(7)); +} + +JSValue jsXPathResultANY_UNORDERED_NODE_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(8)); +} + +JSValue jsXPathResultFIRST_ORDERED_NODE_TYPE(ExecState* exec, JSValue, const Identifier&) +{ + return jsNumber(exec, static_cast(9)); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XPathResult* object) +{ + return getDOMObjectWrapper(exec, globalObject, object); +} +XPathResult* toXPathResult(JSC::JSValue value) +{ + return value.inherits(&JSXPathResult::s_info) ? static_cast(asObject(value))->impl() : 0; +} + +} + +#endif // ENABLE(XPATH)