|
Line 0
a/WebCore/bindings/scripts/test/JS/JSTestJSONObj.cpp_sec1
|
|
|
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 |
#include "JSTestJSONObj.h" |
| 23 |
|
| 24 |
#include "JSTestObj.h" |
| 25 |
#include "KURL.h" |
| 26 |
#include "TestJSONObj.h" |
| 27 |
#include "TestObj.h" |
| 28 |
#include <runtime/JSNumberCell.h> |
| 29 |
#include <runtime/JSString.h> |
| 30 |
#include <wtf/GetPtr.h> |
| 31 |
|
| 32 |
using namespace JSC; |
| 33 |
|
| 34 |
namespace WebCore { |
| 35 |
|
| 36 |
ASSERT_CLASS_FITS_IN_CELL(JSTestJSONObj); |
| 37 |
|
| 38 |
/* Hash table */ |
| 39 |
#if ENABLE(JIT) |
| 40 |
#define THUNK_GENERATOR(generator) , generator |
| 41 |
#else |
| 42 |
#define THUNK_GENERATOR(generator) |
| 43 |
#endif |
| 44 |
|
| 45 |
static const HashTableValue JSTestJSONObjTableValues[7] = |
| 46 |
{ |
| 47 |
{ "intAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSONObjIntAttr), (intptr_t)setJSTestJSONObjIntAttr THUNK_GENERATOR(0) }, |
| 48 |
{ "longLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSONObjLongLongAttr), (intptr_t)setJSTestJSONObjLongLongAttr THUNK_GENERATOR(0) }, |
| 49 |
{ "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSONObjUnsignedLongLongAttr), (intptr_t)setJSTestJSONObjUnsignedLongLongAttr THUNK_GENERATOR(0) }, |
| 50 |
{ "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSONObjStringAttr), (intptr_t)setJSTestJSONObjStringAttr THUNK_GENERATOR(0) }, |
| 51 |
{ "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSONObjTestObjAttr), (intptr_t)setJSTestJSONObjTestObjAttr THUNK_GENERATOR(0) }, |
| 52 |
{ "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSONObjConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
| 53 |
{ 0, 0, 0, 0 THUNK_GENERATOR(0) } |
| 54 |
}; |
| 55 |
|
| 56 |
#undef THUNK_GENERATOR |
| 57 |
static JSC_CONST_HASHTABLE HashTable JSTestJSONObjTable = { 16, 15, JSTestJSONObjTableValues, 0 }; |
| 58 |
/* Hash table for constructor */ |
| 59 |
#if ENABLE(JIT) |
| 60 |
#define THUNK_GENERATOR(generator) , generator |
| 61 |
#else |
| 62 |
#define THUNK_GENERATOR(generator) |
| 63 |
#endif |
| 64 |
|
| 65 |
static const HashTableValue JSTestJSONObjConstructorTableValues[1] = |
| 66 |
{ |
| 67 |
{ 0, 0, 0, 0 THUNK_GENERATOR(0) } |
| 68 |
}; |
| 69 |
|
| 70 |
#undef THUNK_GENERATOR |
| 71 |
static JSC_CONST_HASHTABLE HashTable JSTestJSONObjConstructorTable = { 1, 0, JSTestJSONObjConstructorTableValues, 0 }; |
| 72 |
class JSTestJSONObjConstructor : public DOMConstructorObject { |
| 73 |
public: |
| 74 |
JSTestJSONObjConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
| 75 |
|
| 76 |
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
| 77 |
virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
| 78 |
virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
| 79 |
static const JSC::ClassInfo s_info; |
| 80 |
static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
| 81 |
{ |
| 82 |
return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
| 83 |
} |
| 84 |
protected: |
| 85 |
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
| 86 |
}; |
| 87 |
|
| 88 |
const ClassInfo JSTestJSONObjConstructor::s_info = { "TestJSONObjConstructor", 0, &JSTestJSONObjConstructorTable, 0 }; |
| 89 |
|
| 90 |
JSTestJSONObjConstructor::JSTestJSONObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
| 91 |
: DOMConstructorObject(JSTestJSONObjConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
| 92 |
{ |
| 93 |
putDirect(exec->propertyNames().prototype, JSTestJSONObjPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
| 94 |
} |
| 95 |
|
| 96 |
bool JSTestJSONObjConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
| 97 |
{ |
| 98 |
return getStaticValueSlot<JSTestJSONObjConstructor, DOMObject>(exec, &JSTestJSONObjConstructorTable, this, propertyName, slot); |
| 99 |
} |
| 100 |
|
| 101 |
bool JSTestJSONObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
| 102 |
{ |
| 103 |
return getStaticValueDescriptor<JSTestJSONObjConstructor, DOMObject>(exec, &JSTestJSONObjConstructorTable, this, propertyName, descriptor); |
| 104 |
} |
| 105 |
|
| 106 |
/* Hash table for prototype */ |
| 107 |
#if ENABLE(JIT) |
| 108 |
#define THUNK_GENERATOR(generator) , generator |
| 109 |
#else |
| 110 |
#define THUNK_GENERATOR(generator) |
| 111 |
#endif |
| 112 |
|
| 113 |
static const HashTableValue JSTestJSONObjPrototypeTableValues[1] = |
| 114 |
{ |
| 115 |
{ 0, 0, 0, 0 THUNK_GENERATOR(0) } |
| 116 |
}; |
| 117 |
|
| 118 |
#undef THUNK_GENERATOR |
| 119 |
static JSC_CONST_HASHTABLE HashTable JSTestJSONObjPrototypeTable = { 1, 0, JSTestJSONObjPrototypeTableValues, 0 }; |
| 120 |
const ClassInfo JSTestJSONObjPrototype::s_info = { "TestJSONObjPrototype", 0, &JSTestJSONObjPrototypeTable, 0 }; |
| 121 |
|
| 122 |
JSObject* JSTestJSONObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
| 123 |
{ |
| 124 |
return getDOMPrototype<JSTestJSONObj>(exec, globalObject); |
| 125 |
} |
| 126 |
|
| 127 |
const ClassInfo JSTestJSONObj::s_info = { "TestJSONObj", 0, &JSTestJSONObjTable, 0 }; |
| 128 |
|
| 129 |
JSTestJSONObj::JSTestJSONObj(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestJSONObj> impl) |
| 130 |
: DOMObjectWithGlobalPointer(structure, globalObject) |
| 131 |
, m_impl(impl) |
| 132 |
{ |
| 133 |
} |
| 134 |
|
| 135 |
JSTestJSONObj::~JSTestJSONObj() |
| 136 |
{ |
| 137 |
forgetDOMObject(this, impl()); |
| 138 |
} |
| 139 |
|
| 140 |
JSObject* JSTestJSONObj::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
| 141 |
{ |
| 142 |
return new (exec) JSTestJSONObjPrototype(globalObject, JSTestJSONObjPrototype::createStructure(globalObject->objectPrototype())); |
| 143 |
} |
| 144 |
|
| 145 |
bool JSTestJSONObj::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
| 146 |
{ |
| 147 |
return getStaticValueSlot<JSTestJSONObj, Base>(exec, &JSTestJSONObjTable, this, propertyName, slot); |
| 148 |
} |
| 149 |
|
| 150 |
bool JSTestJSONObj::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
| 151 |
{ |
| 152 |
return getStaticValueDescriptor<JSTestJSONObj, Base>(exec, &JSTestJSONObjTable, this, propertyName, descriptor); |
| 153 |
} |
| 154 |
|
| 155 |
JSValue jsTestJSONObjIntAttr(ExecState* exec, JSValue slotBase, const Identifier&) |
| 156 |
{ |
| 157 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(asObject(slotBase)); |
| 158 |
UNUSED_PARAM(exec); |
| 159 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 160 |
JSValue result = jsNumber(exec, imp->intAttr()); |
| 161 |
return result; |
| 162 |
} |
| 163 |
|
| 164 |
JSValue jsTestJSONObjLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&) |
| 165 |
{ |
| 166 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(asObject(slotBase)); |
| 167 |
UNUSED_PARAM(exec); |
| 168 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 169 |
JSValue result = jsNumber(exec, imp->longLongAttr()); |
| 170 |
return result; |
| 171 |
} |
| 172 |
|
| 173 |
JSValue jsTestJSONObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&) |
| 174 |
{ |
| 175 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(asObject(slotBase)); |
| 176 |
UNUSED_PARAM(exec); |
| 177 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 178 |
JSValue result = jsNumber(exec, imp->unsignedLongLongAttr()); |
| 179 |
return result; |
| 180 |
} |
| 181 |
|
| 182 |
JSValue jsTestJSONObjStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) |
| 183 |
{ |
| 184 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(asObject(slotBase)); |
| 185 |
UNUSED_PARAM(exec); |
| 186 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 187 |
JSValue result = jsString(exec, imp->stringAttr()); |
| 188 |
return result; |
| 189 |
} |
| 190 |
|
| 191 |
JSValue jsTestJSONObjTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) |
| 192 |
{ |
| 193 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(asObject(slotBase)); |
| 194 |
UNUSED_PARAM(exec); |
| 195 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 196 |
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->testObjAttr())); |
| 197 |
return result; |
| 198 |
} |
| 199 |
|
| 200 |
JSValue jsTestJSONObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
| 201 |
{ |
| 202 |
JSTestJSONObj* domObject = static_cast<JSTestJSONObj*>(asObject(slotBase)); |
| 203 |
return JSTestJSONObj::getConstructor(exec, domObject->globalObject()); |
| 204 |
} |
| 205 |
void JSTestJSONObj::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
| 206 |
{ |
| 207 |
lookupPut<JSTestJSONObj, Base>(exec, propertyName, value, &JSTestJSONObjTable, this, slot); |
| 208 |
} |
| 209 |
|
| 210 |
void setJSTestJSONObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value) |
| 211 |
{ |
| 212 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(thisObject); |
| 213 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 214 |
imp->setIntAttr(value.toInt32(exec)); |
| 215 |
} |
| 216 |
|
| 217 |
void setJSTestJSONObjLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value) |
| 218 |
{ |
| 219 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(thisObject); |
| 220 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 221 |
imp->setLongLongAttr(static_cast<long long>(value.toInteger(exec))); |
| 222 |
} |
| 223 |
|
| 224 |
void setJSTestJSONObjUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value) |
| 225 |
{ |
| 226 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(thisObject); |
| 227 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 228 |
imp->setUnsignedLongLongAttr(static_cast<unsigned long long>(value.toInteger(exec))); |
| 229 |
} |
| 230 |
|
| 231 |
void setJSTestJSONObjStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) |
| 232 |
{ |
| 233 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(thisObject); |
| 234 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 235 |
imp->setStringAttr(ustringToString(value.toString(exec))); |
| 236 |
} |
| 237 |
|
| 238 |
void setJSTestJSONObjTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue value) |
| 239 |
{ |
| 240 |
JSTestJSONObj* castedThis = static_cast<JSTestJSONObj*>(thisObject); |
| 241 |
TestJSONObj* imp = static_cast<TestJSONObj*>(castedThis->impl()); |
| 242 |
imp->setTestObjAttr(toTestObj(value)); |
| 243 |
} |
| 244 |
|
| 245 |
JSValue JSTestJSONObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
| 246 |
{ |
| 247 |
return getDOMConstructor<JSTestJSONObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
| 248 |
} |
| 249 |
|
| 250 |
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestJSONObj* object) |
| 251 |
{ |
| 252 |
return getDOMObjectWrapper<JSTestJSONObj>(exec, globalObject, object); |
| 253 |
} |
| 254 |
TestJSONObj* toTestJSONObj(JSC::JSValue value) |
| 255 |
{ |
| 256 |
return value.inherits(&JSTestJSONObj::s_info) ? static_cast<JSTestJSONObj*>(asObject(value))->impl() : 0; |
| 257 |
} |
| 258 |
|
| 259 |
} |