summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-24 16:02:14 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-24 16:13:53 (GMT)
commitec30175915542e3b5c9cff2d807c62ad93d39a54 (patch)
tree9bc9cb9081da5767c444ea66b324e01cfe396096 /src/script
parentd6dca535c9620482d5f9d252a3d0c5dd292f6a0f (diff)
downloadQt-ec30175915542e3b5c9cff2d807c62ad93d39a54.zip
Qt-ec30175915542e3b5c9cff2d807c62ad93d39a54.tar.gz
Qt-ec30175915542e3b5c9cff2d807c62ad93d39a54.tar.bz2
add an internal QScriptValue ctor to initialize from d-pointer
Avoid having to create a dummy QScriptValue (which will have its d_ptr set to 0).
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptvalue.cpp8
-rw-r--r--src/script/api/qscriptvalue.h2
-rw-r--r--src/script/api/qscriptvalue_p.h4
3 files changed, 11 insertions, 3 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index b0e09de..494eac8 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -371,6 +371,14 @@ void QScriptValuePrivate::operator delete(void *ptr)
}
/*!
+ \internal
+*/
+QScriptValue::QScriptValue(QScriptValuePrivate *d)
+ : d_ptr(d)
+{
+}
+
+/*!
Constructs an invalid QScriptValue.
*/
QScriptValue::QScriptValue()
diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h
index 67b9514..afa247a 100644
--- a/src/script/api/qscriptvalue.h
+++ b/src/script/api/qscriptvalue.h
@@ -220,6 +220,8 @@ private:
// force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called
inline QScriptValue(QScriptEngine *, void *);
+ QScriptValue(QScriptValuePrivate*);
+
private:
QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr;
diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h
index 06bc927..0933865 100644
--- a/src/script/api/qscriptvalue_p.h
+++ b/src/script/api/qscriptvalue_p.h
@@ -96,9 +96,7 @@ public:
static inline QScriptValue toPublic(QScriptValuePrivate *d)
{
- QScriptValue tmp;
- tmp.d_ptr = d;
- return tmp;
+ return QScriptValue(d);
}
QScriptValue property(const JSC::Identifier &id, int resolveMode) const;