summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptdeclarativeclass_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-11 04:21:18 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-11 04:21:18 (GMT)
commitece224f79dfe3b859910cb24d64e96277b3c737f (patch)
tree9dd6f037ac81bd492cc553870d1e390520e58200 /src/script/bridge/qscriptdeclarativeclass_p.h
parente1dfba9da8e093255c6020cb61b1b0ea68d2c012 (diff)
downloadQt-ece224f79dfe3b859910cb24d64e96277b3c737f.zip
Qt-ece224f79dfe3b859910cb24d64e96277b3c737f.tar.gz
Qt-ece224f79dfe3b859910cb24d64e96277b3c737f.tar.bz2
Optimization: Add QScriptDeclarativeClass::Value
This class is essentially the same as QScriptValue, but it is faster as it doesn't reference objects. Thus, they might be collected if the gc runs. For return values from QScriptDeclarativeClass this isn't a problem, of course.
Diffstat (limited to 'src/script/bridge/qscriptdeclarativeclass_p.h')
-rw-r--r--src/script/bridge/qscriptdeclarativeclass_p.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h
index f2557bd..87ab964 100644
--- a/src/script/bridge/qscriptdeclarativeclass_p.h
+++ b/src/script/bridge/qscriptdeclarativeclass_p.h
@@ -47,16 +47,45 @@ class QScriptContext;
class Q_SCRIPT_EXPORT QScriptDeclarativeClass
{
public:
+ class Value
+ {
+ public:
+ Value();
+ Value(const Value &);
+ Value(const QScriptValue &);
+
+ Value(QScriptContext *, int);
+ Value(QScriptContext *, uint);
+ Value(QScriptContext *, bool);
+ Value(QScriptContext *, double);
+ Value(QScriptContext *, float);
+ Value(QScriptContext *, const QString &);
+ Value(QScriptEngine *, int);
+ Value(QScriptEngine *, uint);
+ Value(QScriptEngine *, bool);
+ Value(QScriptEngine *, double);
+ Value(QScriptEngine *, float);
+ Value(QScriptEngine *, const QString &);
+ ~Value();
+
+ QScriptValue toScriptValue(QScriptEngine *) const;
+ private:
+ char dummy[8];
+ };
+
typedef void* Identifier;
struct Object { virtual ~Object() {} };
static QScriptValue newObject(QScriptEngine *, QScriptDeclarativeClass *, Object *);
+ static Value newObjectValue(QScriptEngine *, QScriptDeclarativeClass *, Object *);
static QScriptDeclarativeClass *scriptClass(const QScriptValue &);
static Object *object(const QScriptValue &);
static QScriptValue function(const QScriptValue &, const Identifier &);
static QScriptValue property(const QScriptValue &, const Identifier &);
+ static Value functionValue(const QScriptValue &, const Identifier &);
+ static Value propertyValue(const QScriptValue &, const Identifier &);
static QScriptValue scopeChainValue(QScriptContext *, int index);
static QScriptContext *pushCleanContext(QScriptEngine *);
@@ -91,7 +120,7 @@ public:
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
QScriptClass::QueryFlags flags);
- virtual QScriptValue property(Object *, const Identifier &);
+ virtual Value property(Object *, const Identifier &);
virtual void setProperty(Object *, const Identifier &name, const QScriptValue &);
virtual QScriptValue::PropertyFlags propertyFlags(Object *, const Identifier &);