/*
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 "JSXPathNSResolver.h"
#include <wtf/GetPtr.h>
#include "JSCustomXPathNSResolver.h"
#include "JSXPathNSResolver.h"
#include "PlatformString.h"
using namespace KJS;
namespace WebCore {
/* Hash table for prototype */
static const HashEntry JSXPathNSResolverPrototypeTableEntries[] =
{
{ "lookupNamespaceURI", JSXPathNSResolver::LookupNamespaceURIFuncNum, DontDelete|Function, 1, 0 }
};
static const HashTable JSXPathNSResolverPrototypeTable =
{
2, 1, JSXPathNSResolverPrototypeTableEntries, 1
};
const ClassInfo JSXPathNSResolverPrototype::info = { "XPathNSResolverPrototype", 0, &JSXPathNSResolverPrototypeTable, 0 };
JSObject* JSXPathNSResolverPrototype::self(ExecState* exec)
{
return KJS::cacheGlobalObject<JSXPathNSResolverPrototype>(exec, "[[JSXPathNSResolver.prototype]]");
}
bool JSXPathNSResolverPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticFunctionSlot<JSXPathNSResolverPrototypeFunction, JSObject>(exec, &JSXPathNSResolverPrototypeTable, this, propertyName, slot);
}
const ClassInfo JSXPathNSResolver::info = { "XPathNSResolver", 0, 0, 0 };
JSXPathNSResolver::JSXPathNSResolver(ExecState* exec, XPathNSResolver* impl)
: m_impl(impl)
{
setPrototype(JSXPathNSResolverPrototype::self(exec));
}
JSXPathNSResolver::~JSXPathNSResolver()
{
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
JSValue* JSXPathNSResolverPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSXPathNSResolver::info))
return throwError(exec, TypeError);
XPathNSResolver* imp = static_cast<XPathNSResolver*>(static_cast<JSXPathNSResolver*>(thisObj)->impl());
switch (id) {
case JSXPathNSResolver::LookupNamespaceURIFuncNum: {
String prefix = args[0]->toString(exec);
KJS::JSValue* result = jsStringOrNull(imp->lookupNamespaceURI(prefix));
return result;
}
}
return 0;
}
KJS::JSValue* toJS(KJS::ExecState* exec, XPathNSResolver* obj)
{
return KJS::cacheDOMObject<XPathNSResolver, JSXPathNSResolver>(exec, obj);
}
XPathNSResolver* toXPathNSResolver(KJS::JSValue* val)
{
return val->isObject(&JSXPathNSResolver::info) ? static_cast<JSXPathNSResolver*>(val)->impl() : 0;
}
}
#endif // ENABLE(XPATH)