/*
    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 <wtf/Platform.h>


#if ENABLE(VIDEO)

#include "JSMediaError.h"

#include <wtf/GetPtr.h>

#include <kjs/ExecState.h>

using namespace KJS;

#include "MediaError.h"

using namespace KJS;

namespace khtml {

/* Hash table */

static const HashEntry JSMediaErrorTableEntries[] =
{
    { 0, 0, 0, 0, 0 },
    { "code", JSMediaError::CodeAttrNum, DontDelete|ReadOnly, 0, &JSMediaErrorTableEntries[4] },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { "constructor", JSMediaError::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
};

static const HashTable JSMediaErrorTable = 
{
    2, 5, JSMediaErrorTableEntries, 4
};

/* Hash table for constructor */

static const HashEntry JSMediaErrorConstructorTableEntries[] =
{
    { "MEDIA_ERR_DECODE", MediaError::MEDIA_ERR_DECODE, DontDelete|ReadOnly, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { "MEDIA_ERR_NETWORK", MediaError::MEDIA_ERR_NETWORK, DontDelete|ReadOnly, 0, &JSMediaErrorConstructorTableEntries[8] },
    { "MEDIA_ERR_ABORTED", MediaError::MEDIA_ERR_ABORTED, DontDelete|ReadOnly, 0, 0 },
    { "MEDIA_ERR_SRC_NOT_SUPPORTED", MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED, DontDelete|ReadOnly, 0, 0 }
};

static const HashTable JSMediaErrorConstructorTable = 
{
    2, 9, JSMediaErrorConstructorTableEntries, 8
};

class JSMediaErrorConstructor : public DOMObject {
public:
    JSMediaErrorConstructor(ExecState* exec)
    {
        setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
        putDirect(exec->propertyNames().prototype, JSMediaErrorPrototype::self(exec), None);
    }
    using KJS::JSObject::getOwnPropertySlot;
    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    JSValue* getValueProperty(ExecState*, int token) const;
    virtual const ClassInfo* classInfo() const { return &s_info; }
    static const ClassInfo s_info;

    virtual bool implementsHasInstance() const { return true; }
};

const ClassInfo JSMediaErrorConstructor::s_info = { "MediaErrorConstructor", 0, &JSMediaErrorConstructorTable, 0 };

bool JSMediaErrorConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSMediaErrorConstructor, DOMObject>(exec, &JSMediaErrorConstructorTable, this, propertyName, slot);
}

JSValue* JSMediaErrorConstructor::getValueProperty(ExecState*, int token) const
{
    // The token is the numeric value of its associated constant
    return jsNumber(token);
}

/* Hash table for prototype */

static const HashEntry JSMediaErrorPrototypeTableEntries[] =
{
    { "MEDIA_ERR_DECODE", MediaError::MEDIA_ERR_DECODE, DontDelete|ReadOnly, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { "MEDIA_ERR_NETWORK", MediaError::MEDIA_ERR_NETWORK, DontDelete|ReadOnly, 0, &JSMediaErrorPrototypeTableEntries[8] },
    { "MEDIA_ERR_ABORTED", MediaError::MEDIA_ERR_ABORTED, DontDelete|ReadOnly, 0, 0 },
    { "MEDIA_ERR_SRC_NOT_SUPPORTED", MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED, DontDelete|ReadOnly, 0, 0 }
};

static const HashTable JSMediaErrorPrototypeTable = 
{
    2, 9, JSMediaErrorPrototypeTableEntries, 8
};

const ClassInfo JSMediaErrorPrototype::s_info = { "MediaErrorPrototype", 0, &JSMediaErrorPrototypeTable, 0 };

JSObject* JSMediaErrorPrototype::self(ExecState* exec)
{
    return ::cacheGlobalObject<JSMediaErrorPrototype>(exec, "[[JSMediaError.prototype]]");
}

bool JSMediaErrorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSMediaErrorPrototype, JSObject>(exec, &JSMediaErrorPrototypeTable, this, propertyName, slot);
}

JSValue* JSMediaErrorPrototype::getValueProperty(ExecState*, int token) const
{
    // The token is the numeric value of its associated constant
    return jsNumber(token);
}

const ClassInfo JSMediaError::s_info = { "MediaError", 0, &JSMediaErrorTable , 0 };

JSMediaError::JSMediaError(ExecState* exec, MediaError* impl)
    : m_impl(impl)
{
    setPrototype(JSMediaErrorPrototype::self(exec));
}

JSMediaError::~JSMediaError()
{
    ScriptInterpreter::forgetDOMObject(m_impl.get());

}

bool JSMediaError::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSMediaError, KJS::DOMObject>(exec, &JSMediaErrorTable, this, propertyName, slot);
}

JSValue* JSMediaError::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case CodeAttrNum: {
        MediaError* imp = static_cast<MediaError*>(impl());

        return jsNumber(imp->code());
    }
    case ConstructorAttrNum:
        return getConstructor(exec);
    }
    return 0;
}

JSValue* JSMediaError::getConstructor(ExecState* exec)
{
    return ::cacheGlobalObject<JSMediaErrorConstructor>(exec, "[[MediaError.constructor]]");
}
KJS::JSValue* toJS(KJS::ExecState* exec, MediaError* obj)
{
    return KJS::cacheDOMObject<MediaError, JSMediaError>(exec, obj);
}
MediaError* toMediaError(KJS::JSValue* val)
{
    return val->isObject(&JSMediaError::s_info) ? static_cast<JSMediaError*>(val)->impl() : 0;
}

}

#endif // ENABLE(VIDEO)
