webengine/osswebengine/DerivedSources/WebCore/JSXPathNSResolver.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 
       
    24 #if ENABLE(XPATH)
       
    25 
       
    26 #include "JSXPathNSResolver.h"
       
    27 
       
    28 #include <wtf/GetPtr.h>
       
    29 
       
    30 #include "JSCustomXPathNSResolver.h"
       
    31 #include "JSXPathNSResolver.h"
       
    32 #include "PlatformString.h"
       
    33 
       
    34 using namespace KJS;
       
    35 
       
    36 namespace WebCore {
       
    37 
       
    38 /* Hash table for prototype */
       
    39 
       
    40 static const HashEntry JSXPathNSResolverPrototypeTableEntries[] =
       
    41 {
       
    42     { "lookupNamespaceURI", JSXPathNSResolver::LookupNamespaceURIFuncNum, DontDelete|Function, 1, 0 }
       
    43 };
       
    44 
       
    45 static const HashTable JSXPathNSResolverPrototypeTable = 
       
    46 {
       
    47     2, 1, JSXPathNSResolverPrototypeTableEntries, 1
       
    48 };
       
    49 
       
    50 const ClassInfo JSXPathNSResolverPrototype::info = { "XPathNSResolverPrototype", 0, &JSXPathNSResolverPrototypeTable, 0 };
       
    51 
       
    52 JSObject* JSXPathNSResolverPrototype::self(ExecState* exec)
       
    53 {
       
    54     return KJS::cacheGlobalObject<JSXPathNSResolverPrototype>(exec, "[[JSXPathNSResolver.prototype]]");
       
    55 }
       
    56 
       
    57 bool JSXPathNSResolverPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    58 {
       
    59     return getStaticFunctionSlot<JSXPathNSResolverPrototypeFunction, JSObject>(exec, &JSXPathNSResolverPrototypeTable, this, propertyName, slot);
       
    60 }
       
    61 
       
    62 const ClassInfo JSXPathNSResolver::info = { "XPathNSResolver", 0, 0, 0 };
       
    63 
       
    64 JSXPathNSResolver::JSXPathNSResolver(ExecState* exec, XPathNSResolver* impl)
       
    65     : m_impl(impl)
       
    66 {
       
    67     setPrototype(JSXPathNSResolverPrototype::self(exec));
       
    68 }
       
    69 
       
    70 JSXPathNSResolver::~JSXPathNSResolver()
       
    71 {
       
    72     ScriptInterpreter::forgetDOMObject(m_impl.get());
       
    73 }
       
    74 
       
    75 JSValue* JSXPathNSResolverPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
    76 {
       
    77     if (!thisObj->inherits(&JSXPathNSResolver::info))
       
    78       return throwError(exec, TypeError);
       
    79 
       
    80     XPathNSResolver* imp = static_cast<XPathNSResolver*>(static_cast<JSXPathNSResolver*>(thisObj)->impl());
       
    81 
       
    82     switch (id) {
       
    83     case JSXPathNSResolver::LookupNamespaceURIFuncNum: {
       
    84         String prefix = args[0]->toString(exec);
       
    85 
       
    86 
       
    87         KJS::JSValue* result = jsStringOrNull(imp->lookupNamespaceURI(prefix));
       
    88         return result;
       
    89     }
       
    90     }
       
    91     return 0;
       
    92 }
       
    93 KJS::JSValue* toJS(KJS::ExecState* exec, XPathNSResolver* obj)
       
    94 {
       
    95     return KJS::cacheDOMObject<XPathNSResolver, JSXPathNSResolver>(exec, obj);
       
    96 }
       
    97 XPathNSResolver* toXPathNSResolver(KJS::JSValue* val)
       
    98 {
       
    99     return val->isObject(&JSXPathNSResolver::info) ? static_cast<JSXPathNSResolver*>(val)->impl() : 0;
       
   100 }
       
   101 
       
   102 }
       
   103 
       
   104 #endif // ENABLE(XPATH)