diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-24 14:07:35 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-24 14:08:17 (GMT) |
commit | ba75712e86792730762677db5e53ec5e5aebca7f (patch) | |
tree | 66f5cd85f2839f8b2bd0ffdb033ac4973e3b75d0 /src/script | |
parent | dc3e85a9c3dd45c23a84bcd8ee5ee1df6c4f4337 (diff) | |
download | Qt-ba75712e86792730762677db5e53ec5e5aebca7f.zip Qt-ba75712e86792730762677db5e53ec5e5aebca7f.tar.gz Qt-ba75712e86792730762677db5e53ec5e5aebca7f.tar.bz2 |
pass engine pointer to QScriptValuePrivate
Just a little cleanup.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 3 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 48 | ||||
-rw-r--r-- | src/script/api/qscriptvalue_p.h | 2 |
3 files changed, 19 insertions, 34 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index b4b4f91..fb54c4c 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -856,8 +856,7 @@ QScriptValue QScriptEnginePrivate::scriptValueFromJSCValue(JSC::JSValue value) if (!value) return QScriptValue(); - QScriptValuePrivate *p_value = new (this)QScriptValuePrivate(); - p_value->engine = this; + QScriptValuePrivate *p_value = new (this)QScriptValuePrivate(this); p_value->initFrom(value); return QScriptValuePrivate::toPublic(p_value); } diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 4b92049..21aebd0 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -276,7 +276,8 @@ qsreal ToInteger(qsreal n) } // namespace QScript -QScriptValuePrivate::QScriptValuePrivate() : engine(0), prev(0), next(0) +QScriptValuePrivate::QScriptValuePrivate(QScriptEnginePrivate *e) + : engine(e), prev(0), next(0) { ref = 0; } @@ -456,9 +457,8 @@ QScriptValue::QScriptValue(const QScriptValue &other) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, QScriptValue::SpecialValue value) - : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); switch (value) { case NullValue: d_ptr->initFrom(JSC::jsNull()); @@ -478,9 +478,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, QScriptValue::SpecialValue val registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, bool val) - : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); d_ptr->initFrom(JSC::jsBoolean(val)); } @@ -492,9 +491,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, bool val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, int val) - : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); @@ -515,9 +513,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, int val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, uint val) - : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); @@ -538,9 +535,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, uint val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, qsreal val) - : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); @@ -561,9 +557,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, qsreal val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, const QString &val) - : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsString(exec, val)); @@ -582,9 +577,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const QString &val) #ifndef QT_NO_CAST_FROM_ASCII QScriptValue::QScriptValue(QScriptEngine *engine, const char *val) - : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsString(exec, val)); @@ -600,9 +594,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const char *val) Constructs a new QScriptValue with a special \a value. */ QScriptValue::QScriptValue(SpecialValue value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; switch (value) { case NullValue: d_ptr->initFrom(JSC::jsNull()); @@ -619,9 +612,8 @@ QScriptValue::QScriptValue(SpecialValue value) Constructs a new QScriptValue with a boolean \a value. */ QScriptValue::QScriptValue(bool value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(JSC::jsBoolean(value)); } @@ -631,9 +623,8 @@ QScriptValue::QScriptValue(bool value) Constructs a new QScriptValue with a number \a value. */ QScriptValue::QScriptValue(int value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; JSC::JSValue immediate = JSC::JSImmediate::from(value); if (immediate) d_ptr->initFrom(immediate); @@ -647,9 +638,8 @@ QScriptValue::QScriptValue(int value) Constructs a new QScriptValue with a number \a value. */ QScriptValue::QScriptValue(uint value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; JSC::JSValue immediate = JSC::JSImmediate::from(value); if (immediate) d_ptr->initFrom(immediate); @@ -663,9 +653,8 @@ QScriptValue::QScriptValue(uint value) Constructs a new QScriptValue with a number \a value. */ QScriptValue::QScriptValue(qsreal value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; JSC::JSValue immediate = JSC::JSImmediate::from(value); if (immediate) d_ptr->initFrom(immediate); @@ -679,9 +668,8 @@ QScriptValue::QScriptValue(qsreal value) Constructs a new QScriptValue with a string \a value. */ QScriptValue::QScriptValue(const QString &value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(value); } @@ -691,9 +679,8 @@ QScriptValue::QScriptValue(const QString &value) Constructs a new QScriptValue with a string \a value. */ QScriptValue::QScriptValue(const QLatin1String &value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(value); } @@ -705,9 +692,8 @@ QScriptValue::QScriptValue(const QLatin1String &value) #ifndef QT_NO_CAST_FROM_ASCII QScriptValue::QScriptValue(const char *value) - : d_ptr(new (/*engine=*/0)QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(QString::fromAscii(value)); } #endif diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 115c755..9773ba0 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -77,7 +77,7 @@ public: String }; - QScriptValuePrivate(); + QScriptValuePrivate(QScriptEnginePrivate*); ~QScriptValuePrivate(); void initFrom(JSC::JSValue value); |