WebCore/generated/JSXPathExpression.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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(XPATH)
       
    24 
       
    25 #include "JSXPathExpression.h"
       
    26 
       
    27 #include "JSNode.h"
       
    28 #include "JSXPathResult.h"
       
    29 #include "XPathExpression.h"
       
    30 #include "XPathResult.h"
       
    31 #include <runtime/Error.h>
       
    32 #include <wtf/GetPtr.h>
       
    33 
       
    34 using namespace JSC;
       
    35 
       
    36 namespace WebCore {
       
    37 
       
    38 ASSERT_CLASS_FITS_IN_CELL(JSXPathExpression);
       
    39 
       
    40 /* Hash table */
       
    41 #if ENABLE(JIT)
       
    42 #define THUNK_GENERATOR(generator) , generator
       
    43 #else
       
    44 #define THUNK_GENERATOR(generator)
       
    45 #endif
       
    46 
       
    47 static const HashTableValue JSXPathExpressionTableValues[2] =
       
    48 {
       
    49     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExpressionConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    50     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    51 };
       
    52 
       
    53 #undef THUNK_GENERATOR
       
    54 static JSC_CONST_HASHTABLE HashTable JSXPathExpressionTable = { 2, 1, JSXPathExpressionTableValues, 0 };
       
    55 /* Hash table for constructor */
       
    56 #if ENABLE(JIT)
       
    57 #define THUNK_GENERATOR(generator) , generator
       
    58 #else
       
    59 #define THUNK_GENERATOR(generator)
       
    60 #endif
       
    61 
       
    62 static const HashTableValue JSXPathExpressionConstructorTableValues[1] =
       
    63 {
       
    64     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    65 };
       
    66 
       
    67 #undef THUNK_GENERATOR
       
    68 static JSC_CONST_HASHTABLE HashTable JSXPathExpressionConstructorTable = { 1, 0, JSXPathExpressionConstructorTableValues, 0 };
       
    69 class JSXPathExpressionConstructor : public DOMConstructorObject {
       
    70 public:
       
    71     JSXPathExpressionConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    72 
       
    73     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    74     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    75     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    76     static const JSC::ClassInfo s_info;
       
    77     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    78     {
       
    79         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    80     }
       
    81 protected:
       
    82     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    83 };
       
    84 
       
    85 const ClassInfo JSXPathExpressionConstructor::s_info = { "XPathExpressionConstructor", 0, &JSXPathExpressionConstructorTable, 0 };
       
    86 
       
    87 JSXPathExpressionConstructor::JSXPathExpressionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    88     : DOMConstructorObject(JSXPathExpressionConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    89 {
       
    90     putDirect(exec->propertyNames().prototype, JSXPathExpressionPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    91 }
       
    92 
       
    93 bool JSXPathExpressionConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    94 {
       
    95     return getStaticValueSlot<JSXPathExpressionConstructor, DOMObject>(exec, &JSXPathExpressionConstructorTable, this, propertyName, slot);
       
    96 }
       
    97 
       
    98 bool JSXPathExpressionConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    99 {
       
   100     return getStaticValueDescriptor<JSXPathExpressionConstructor, DOMObject>(exec, &JSXPathExpressionConstructorTable, this, propertyName, descriptor);
       
   101 }
       
   102 
       
   103 /* Hash table for prototype */
       
   104 #if ENABLE(JIT)
       
   105 #define THUNK_GENERATOR(generator) , generator
       
   106 #else
       
   107 #define THUNK_GENERATOR(generator)
       
   108 #endif
       
   109 
       
   110 static const HashTableValue JSXPathExpressionPrototypeTableValues[2] =
       
   111 {
       
   112     { "evaluate", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXPathExpressionPrototypeFunctionEvaluate), (intptr_t)3 THUNK_GENERATOR(0) },
       
   113     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   114 };
       
   115 
       
   116 #undef THUNK_GENERATOR
       
   117 static JSC_CONST_HASHTABLE HashTable JSXPathExpressionPrototypeTable = { 2, 1, JSXPathExpressionPrototypeTableValues, 0 };
       
   118 const ClassInfo JSXPathExpressionPrototype::s_info = { "XPathExpressionPrototype", 0, &JSXPathExpressionPrototypeTable, 0 };
       
   119 
       
   120 JSObject* JSXPathExpressionPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   121 {
       
   122     return getDOMPrototype<JSXPathExpression>(exec, globalObject);
       
   123 }
       
   124 
       
   125 bool JSXPathExpressionPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   126 {
       
   127     return getStaticFunctionSlot<JSObject>(exec, &JSXPathExpressionPrototypeTable, this, propertyName, slot);
       
   128 }
       
   129 
       
   130 bool JSXPathExpressionPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   131 {
       
   132     return getStaticFunctionDescriptor<JSObject>(exec, &JSXPathExpressionPrototypeTable, this, propertyName, descriptor);
       
   133 }
       
   134 
       
   135 const ClassInfo JSXPathExpression::s_info = { "XPathExpression", 0, &JSXPathExpressionTable, 0 };
       
   136 
       
   137 JSXPathExpression::JSXPathExpression(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<XPathExpression> impl)
       
   138     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   139     , m_impl(impl)
       
   140 {
       
   141 }
       
   142 
       
   143 JSXPathExpression::~JSXPathExpression()
       
   144 {
       
   145     forgetDOMObject(this, impl());
       
   146 }
       
   147 
       
   148 JSObject* JSXPathExpression::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   149 {
       
   150     return new (exec) JSXPathExpressionPrototype(globalObject, JSXPathExpressionPrototype::createStructure(globalObject->objectPrototype()));
       
   151 }
       
   152 
       
   153 bool JSXPathExpression::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   154 {
       
   155     return getStaticValueSlot<JSXPathExpression, Base>(exec, &JSXPathExpressionTable, this, propertyName, slot);
       
   156 }
       
   157 
       
   158 bool JSXPathExpression::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   159 {
       
   160     return getStaticValueDescriptor<JSXPathExpression, Base>(exec, &JSXPathExpressionTable, this, propertyName, descriptor);
       
   161 }
       
   162 
       
   163 JSValue jsXPathExpressionConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   164 {
       
   165     JSXPathExpression* domObject = static_cast<JSXPathExpression*>(asObject(slotBase));
       
   166     return JSXPathExpression::getConstructor(exec, domObject->globalObject());
       
   167 }
       
   168 JSValue JSXPathExpression::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   169 {
       
   170     return getDOMConstructor<JSXPathExpressionConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   171 }
       
   172 
       
   173 EncodedJSValue JSC_HOST_CALL jsXPathExpressionPrototypeFunctionEvaluate(ExecState* exec)
       
   174 {
       
   175     JSValue thisValue = exec->hostThisValue();
       
   176     if (!thisValue.inherits(&JSXPathExpression::s_info))
       
   177         return throwVMTypeError(exec);
       
   178     JSXPathExpression* castedThis = static_cast<JSXPathExpression*>(asObject(thisValue));
       
   179     XPathExpression* imp = static_cast<XPathExpression*>(castedThis->impl());
       
   180     ExceptionCode ec = 0;
       
   181     Node* contextNode = toNode(exec->argument(0));
       
   182     unsigned short type = exec->argument(1).toInt32(exec);
       
   183     XPathResult* inResult = toXPathResult(exec->argument(2));
       
   184 
       
   185 
       
   186     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->evaluate(contextNode, type, inResult, ec)));
       
   187     setDOMException(exec, ec);
       
   188     return JSValue::encode(result);
       
   189 }
       
   190 
       
   191 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XPathExpression* object)
       
   192 {
       
   193     return getDOMObjectWrapper<JSXPathExpression>(exec, globalObject, object);
       
   194 }
       
   195 XPathExpression* toXPathExpression(JSC::JSValue value)
       
   196 {
       
   197     return value.inherits(&JSXPathExpression::s_info) ? static_cast<JSXPathExpression*>(asObject(value))->impl() : 0;
       
   198 }
       
   199 
       
   200 }
       
   201 
       
   202 #endif // ENABLE(XPATH)