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

#include "JSSVGPathSeg.h"

#include "KURL.h"
#include "SVGPathSeg.h"
#include <runtime/JSNumberCell.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

ASSERT_CLASS_FITS_IN_CELL(JSSVGPathSeg);

/* Hash table */

static const HashTableValue JSSVGPathSegTableValues[4] =
{
    { "pathSegType", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPathSegType), (intptr_t)0 },
    { "pathSegTypeAsLetter", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPathSegTypeAsLetter), (intptr_t)0 },
    { "constructor", DontEnum|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegConstructor), (intptr_t)0 },
    { 0, 0, 0, 0 }
};

static JSC_CONST_HASHTABLE HashTable JSSVGPathSegTable =
#if ENABLE(PERFECT_HASH_SIZE)
    { 7, JSSVGPathSegTableValues, 0 };
#else
    { 8, 7, JSSVGPathSegTableValues, 0 };
#endif

/* Hash table for constructor */

static const HashTableValue JSSVGPathSegConstructorTableValues[21] =
{
    { "PATHSEG_UNKNOWN", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_UNKNOWN), (intptr_t)0 },
    { "PATHSEG_CLOSEPATH", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CLOSEPATH), (intptr_t)0 },
    { "PATHSEG_MOVETO_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_MOVETO_ABS), (intptr_t)0 },
    { "PATHSEG_MOVETO_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_MOVETO_REL), (intptr_t)0 },
    { "PATHSEG_LINETO_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_ABS), (intptr_t)0 },
    { "PATHSEG_LINETO_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_REL), (intptr_t)0 },
    { "PATHSEG_ARC_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_ARC_ABS), (intptr_t)0 },
    { "PATHSEG_ARC_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_ARC_REL), (intptr_t)0 },
    { "PATHSEG_LINETO_HORIZONTAL_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_HORIZONTAL_ABS), (intptr_t)0 },
    { "PATHSEG_LINETO_HORIZONTAL_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_HORIZONTAL_REL), (intptr_t)0 },
    { "PATHSEG_LINETO_VERTICAL_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_VERTICAL_ABS), (intptr_t)0 },
    { "PATHSEG_LINETO_VERTICAL_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_VERTICAL_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_SMOOTH_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_SMOOTH_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_SMOOTH_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_SMOOTH_REL), (intptr_t)0 },
    { 0, 0, 0, 0 }
};

static JSC_CONST_HASHTABLE HashTable JSSVGPathSegConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
    { 2047, JSSVGPathSegConstructorTableValues, 0 };
#else
    { 70, 63, JSSVGPathSegConstructorTableValues, 0 };
#endif

class JSSVGPathSegConstructor : public DOMConstructorObject {
public:
    JSSVGPathSegConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
        : DOMConstructorObject(JSSVGPathSegConstructor::createStructure(globalObject->objectPrototype()), globalObject)
    {
        putDirect(exec->propertyNames().prototype, JSSVGPathSegPrototype::self(exec, globalObject), None);
    }
    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    virtual const ClassInfo* classInfo() const { return &s_info; }
    static const ClassInfo s_info;

    static PassRefPtr<Structure> createStructure(JSValue proto) 
    { 
        return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); 
    }
    
protected:
    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
};

const ClassInfo JSSVGPathSegConstructor::s_info = { "SVGPathSegConstructor", 0, &JSSVGPathSegConstructorTable, 0 };

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

bool JSSVGPathSegConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSSVGPathSegConstructor, DOMObject>(exec, &JSSVGPathSegConstructorTable, this, propertyName, descriptor);
}

/* Hash table for prototype */

static const HashTableValue JSSVGPathSegPrototypeTableValues[21] =
{
    { "PATHSEG_UNKNOWN", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_UNKNOWN), (intptr_t)0 },
    { "PATHSEG_CLOSEPATH", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CLOSEPATH), (intptr_t)0 },
    { "PATHSEG_MOVETO_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_MOVETO_ABS), (intptr_t)0 },
    { "PATHSEG_MOVETO_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_MOVETO_REL), (intptr_t)0 },
    { "PATHSEG_LINETO_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_ABS), (intptr_t)0 },
    { "PATHSEG_LINETO_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_REL), (intptr_t)0 },
    { "PATHSEG_ARC_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_ARC_ABS), (intptr_t)0 },
    { "PATHSEG_ARC_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_ARC_REL), (intptr_t)0 },
    { "PATHSEG_LINETO_HORIZONTAL_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_HORIZONTAL_ABS), (intptr_t)0 },
    { "PATHSEG_LINETO_HORIZONTAL_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_HORIZONTAL_REL), (intptr_t)0 },
    { "PATHSEG_LINETO_VERTICAL_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_VERTICAL_ABS), (intptr_t)0 },
    { "PATHSEG_LINETO_VERTICAL_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_LINETO_VERTICAL_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_SMOOTH_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_CUBIC_SMOOTH_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_CUBIC_SMOOTH_REL), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS), (intptr_t)0 },
    { "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_SMOOTH_REL), (intptr_t)0 },
    { 0, 0, 0, 0 }
};

static JSC_CONST_HASHTABLE HashTable JSSVGPathSegPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
    { 2047, JSSVGPathSegPrototypeTableValues, 0 };
#else
    { 70, 63, JSSVGPathSegPrototypeTableValues, 0 };
#endif

const ClassInfo JSSVGPathSegPrototype::s_info = { "SVGPathSegPrototype", 0, &JSSVGPathSegPrototypeTable, 0 };

JSObject* JSSVGPathSegPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSSVGPathSeg>(exec, globalObject);
}

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

bool JSSVGPathSegPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSSVGPathSegPrototype, JSObject>(exec, &JSSVGPathSegPrototypeTable, this, propertyName, descriptor);
}

const ClassInfo JSSVGPathSeg::s_info = { "SVGPathSeg", 0, &JSSVGPathSegTable, 0 };

JSSVGPathSeg::JSSVGPathSeg(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGPathSeg> impl)
    : DOMObjectWithGlobalPointer(structure, globalObject)
    , m_impl(impl)
{
}

JSSVGPathSeg::~JSSVGPathSeg()
{
    forgetDOMObject(this, impl());
    JSSVGContextCache::forgetWrapper(this);
}

JSObject* JSSVGPathSeg::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
    return new (exec) JSSVGPathSegPrototype(JSSVGPathSegPrototype::createStructure(globalObject->objectPrototype()));
}

bool JSSVGPathSeg::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSSVGPathSeg, Base>(exec, &JSSVGPathSegTable, this, propertyName, slot);
}

bool JSSVGPathSeg::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSSVGPathSeg, Base>(exec, &JSSVGPathSegTable, this, propertyName, descriptor);
}

JSValue jsSVGPathSegPathSegType(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSSVGPathSeg* castedThis = static_cast<JSSVGPathSeg*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    SVGPathSeg* imp = static_cast<SVGPathSeg*>(castedThis->impl());
    JSValue result = jsNumber(exec, imp->pathSegType());
    return result;
}

JSValue jsSVGPathSegPathSegTypeAsLetter(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSSVGPathSeg* castedThis = static_cast<JSSVGPathSeg*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    SVGPathSeg* imp = static_cast<SVGPathSeg*>(castedThis->impl());
    JSValue result = jsString(exec, imp->pathSegTypeAsLetter());
    return result;
}

JSValue jsSVGPathSegConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSSVGPathSeg* domObject = static_cast<JSSVGPathSeg*>(asObject(slotBase));
    return JSSVGPathSeg::getConstructor(exec, domObject->globalObject());
}
JSValue JSSVGPathSeg::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSSVGPathSegConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
}

// Constant getters

JSValue jsSVGPathSegPATHSEG_UNKNOWN(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(0));
}

JSValue jsSVGPathSegPATHSEG_CLOSEPATH(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(1));
}

JSValue jsSVGPathSegPATHSEG_MOVETO_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(2));
}

JSValue jsSVGPathSegPATHSEG_MOVETO_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(3));
}

JSValue jsSVGPathSegPATHSEG_LINETO_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(4));
}

JSValue jsSVGPathSegPATHSEG_LINETO_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(5));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_CUBIC_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(6));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_CUBIC_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(7));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(8));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(9));
}

JSValue jsSVGPathSegPATHSEG_ARC_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(10));
}

JSValue jsSVGPathSegPATHSEG_ARC_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(11));
}

JSValue jsSVGPathSegPATHSEG_LINETO_HORIZONTAL_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(12));
}

JSValue jsSVGPathSegPATHSEG_LINETO_HORIZONTAL_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(13));
}

JSValue jsSVGPathSegPATHSEG_LINETO_VERTICAL_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(14));
}

JSValue jsSVGPathSegPATHSEG_LINETO_VERTICAL_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(15));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_CUBIC_SMOOTH_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(16));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_CUBIC_SMOOTH_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(17));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(18));
}

JSValue jsSVGPathSegPATHSEG_CURVETO_QUADRATIC_SMOOTH_REL(ExecState* exec, JSValue, const Identifier&)
{
    return jsNumber(exec, static_cast<int>(19));
}

SVGPathSeg* toSVGPathSeg(JSC::JSValue value)
{
    return value.inherits(&JSSVGPathSeg::s_info) ? static_cast<JSSVGPathSeg*>(asObject(value))->impl() : 0;
}

}

#endif // ENABLE(SVG)
