summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine_p.h
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-02 14:38:52 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-02 14:38:52 (GMT)
commit2b54a6831ebf8af0540c72519173a9c5e2d94aef (patch)
tree7b019f9d143e4c52f6df3fc220b06671b65ad2c1 /src/script/api/qscriptengine_p.h
parent0357533025a7e4066def7665f3c77337f1ab21db (diff)
downloadQt-2b54a6831ebf8af0540c72519173a9c5e2d94aef.zip
Qt-2b54a6831ebf8af0540c72519173a9c5e2d94aef.tar.gz
Qt-2b54a6831ebf8af0540c72519173a9c5e2d94aef.tar.bz2
implement a fair amount of the QScriptClass functionality
Enumeration is missing, as is the ability to change the class of an object after it has been created.
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r--src/script/api/qscriptengine_p.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 8a81fd3..b1b0d2d 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -48,6 +48,7 @@ namespace QScript
class QObjectPrototype;
class QMetaObjectPrototype;
class QVariantPrototype;
+ class ClassObjectPrototype;
#ifndef QT_NO_QOBJECT
class QObjectData;
#endif
@@ -142,11 +143,16 @@ public:
QScript::QObjectPrototype *qobjectPrototype;
WTF::RefPtr<JSC::Structure> qobjectWrapperObjectStructure;
+
QScript::QMetaObjectPrototype *qmetaobjectPrototype;
WTF::RefPtr<JSC::Structure> qmetaobjectWrapperObjectStructure;
+
QScript::QVariantPrototype *variantPrototype;
WTF::RefPtr<JSC::Structure> variantWrapperObjectStructure;
+ QScript::ClassObjectPrototype *classObjectPrototype;
+ WTF::RefPtr<JSC::Structure> classObjectStructure;
+
QScriptEngineAgent *agent;
QHash<JSC::JSCell*, QBasicAtomicInt> keepAliveValues;
QHash<int, QScriptTypeInfo*> m_typeInfos;
@@ -176,7 +182,57 @@ public:
QScriptEnginePrivate *engine;
};
-}
+// ### move
+class ClassObject : public JSC::JSObject
+{
+public:
+ // work around CELL_SIZE limitation
+ struct Data
+ {
+ QScriptClass *scriptClass;
+
+ Data(QScriptClass *sc)
+ : scriptClass(sc) {}
+ };
+
+ explicit ClassObject(QScriptClass *scriptClass,
+ WTF::PassRefPtr<JSC::Structure> sid);
+ ~ClassObject();
+
+ virtual bool getOwnPropertySlot(JSC::ExecState*,
+ const JSC::Identifier& propertyName,
+ JSC::PropertySlot&);
+ virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName,
+ JSC::JSValue, JSC::PutPropertySlot&);
+ virtual bool deleteProperty(JSC::ExecState*,
+ const JSC::Identifier& propertyName);
+ virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&,
+ unsigned&) const;
+ virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);
+
+ virtual const JSC::ClassInfo* classInfo() const;
+ static const JSC::ClassInfo info;
+
+ static WTF::PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType));
+ }
+
+ QScriptClass *scriptClass() const;
+ void setScriptClass(QScriptClass *scriptClass);
+
+private:
+ Data *data;
+};
+
+class ClassObjectPrototype : public ClassObject
+{
+public:
+ ClassObjectPrototype(JSC::ExecState*, WTF::PassRefPtr<JSC::Structure>,
+ JSC::Structure* prototypeFunctionStructure);
+};
+
+} // namespace QScript
QT_END_NAMESPACE