/*
    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(INDEXED_DATABASE)

#include "JSIDBCursorWithValue.h"

#include "IDBCursorWithValue.h"
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

/* Hash table */

static const HashTableValue JSIDBCursorWithValueTableValues[] =
{
    { "value", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBCursorWithValueValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBCursorWithValueConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSIDBCursorWithValueTable = { 4, 3, true, JSIDBCursorWithValueTableValues, 0 };
/* Hash table for constructor */

static const HashTableValue JSIDBCursorWithValueConstructorTableValues[] =
{
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSIDBCursorWithValueConstructorTable = { 1, 0, false, JSIDBCursorWithValueConstructorTableValues, 0 };
static const HashTable& getJSIDBCursorWithValueConstructorTable(VM& vm)
{
    return getHashTableForGlobalData(vm, JSIDBCursorWithValueConstructorTable);
}

const ClassInfo JSIDBCursorWithValueConstructor::s_info = { "IDBCursorWithValueConstructor", &Base::s_info, 0, getJSIDBCursorWithValueConstructorTable, CREATE_METHOD_TABLE(JSIDBCursorWithValueConstructor) };

JSIDBCursorWithValueConstructor::JSIDBCursorWithValueConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
    : DOMConstructorObject(structure, globalObject)
{
}

void JSIDBCursorWithValueConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
    putDirect(vm, vm.propertyNames->prototype, JSIDBCursorWithValuePrototype::self(vm, globalObject), DontDelete | ReadOnly);
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
}

bool JSIDBCursorWithValueConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSIDBCursorWithValueConstructor, JSDOMWrapper>(exec, getJSIDBCursorWithValueConstructorTable(exec->vm()), jsCast<JSIDBCursorWithValueConstructor*>(object), propertyName, slot);
}

/* Hash table for prototype */

static const HashTableValue JSIDBCursorWithValuePrototypeTableValues[] =
{
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSIDBCursorWithValuePrototypeTable = { 1, 0, false, JSIDBCursorWithValuePrototypeTableValues, 0 };
static const HashTable& getJSIDBCursorWithValuePrototypeTable(VM& vm)
{
    return getHashTableForGlobalData(vm, JSIDBCursorWithValuePrototypeTable);
}

const ClassInfo JSIDBCursorWithValuePrototype::s_info = { "IDBCursorWithValuePrototype", &Base::s_info, 0, getJSIDBCursorWithValuePrototypeTable, CREATE_METHOD_TABLE(JSIDBCursorWithValuePrototype) };

JSObject* JSIDBCursorWithValuePrototype::self(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSIDBCursorWithValue>(vm, globalObject);
}

static const HashTable& getJSIDBCursorWithValueTable(VM& vm)
{
    return getHashTableForGlobalData(vm, JSIDBCursorWithValueTable);
}

const ClassInfo JSIDBCursorWithValue::s_info = { "IDBCursorWithValue", &Base::s_info, 0, getJSIDBCursorWithValueTable , CREATE_METHOD_TABLE(JSIDBCursorWithValue) };

JSIDBCursorWithValue::JSIDBCursorWithValue(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<IDBCursorWithValue> impl)
    : JSIDBCursor(structure, globalObject, impl)
{
}

void JSIDBCursorWithValue::finishCreation(VM& vm)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
}

JSObject* JSIDBCursorWithValue::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
    return JSIDBCursorWithValuePrototype::create(vm, globalObject, JSIDBCursorWithValuePrototype::createStructure(vm, globalObject, JSIDBCursorPrototype::self(vm, globalObject)));
}

bool JSIDBCursorWithValue::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSIDBCursorWithValue* thisObject = jsCast<JSIDBCursorWithValue*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    return getStaticValueSlot<JSIDBCursorWithValue, Base>(exec, getJSIDBCursorWithValueTable(exec->vm()), thisObject, propertyName, slot);
}

EncodedJSValue jsIDBCursorWithValueValue(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSIDBCursorWithValue* castedThis = jsDynamicCast<JSIDBCursorWithValue*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    IDBCursorWithValue& impl = castedThis->impl();
    JSValue result = (impl.value().hasNoValue() ? jsNull() : impl.value().jsValue());
    return JSValue::encode(result);
}


EncodedJSValue jsIDBCursorWithValueConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
    JSIDBCursorWithValue* domObject = jsDynamicCast<JSIDBCursorWithValue*>(JSValue::decode(thisValue));
    if (!domObject)
        return throwVMTypeError(exec);
    if (!domObject)
        return throwVMTypeError(exec);
    return JSValue::encode(JSIDBCursorWithValue::getConstructor(exec->vm(), domObject->globalObject()));
}

JSValue JSIDBCursorWithValue::getConstructor(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSIDBCursorWithValueConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
}


}

#endif // ENABLE(INDEXED_DATABASE)
