aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi/qjsvalue.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-14 12:50:34 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-21 18:22:47 +0100
commitd8131513b07d3f0a6d749c9961b294fc955fed6d (patch)
tree8d757fffe19623bd1ea78a40240dc41c25b81a8f /src/qml/jsapi/qjsvalue.h
parent630f118f043edb88501e387d779c62c86b1030d4 (diff)
Add C++11 move operators, and a simpler internal constructor
Move semantics should optimize some copy operations on QJSValues, and the internal constructor will simplify refactoring the QJSValue class to get rid of the extra allocated private. Change-Id: I24863b30523af2432aa81ad6b87fda7fe35749c4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsapi/qjsvalue.h')
-rw-r--r--src/qml/jsapi/qjsvalue.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/jsapi/qjsvalue.h b/src/qml/jsapi/qjsvalue.h
index d184cf6537..4ff86b1edc 100644
--- a/src/qml/jsapi/qjsvalue.h
+++ b/src/qml/jsapi/qjsvalue.h
@@ -41,7 +41,6 @@
QT_BEGIN_NAMESPACE
-
class QJSValue;
class QJSEngine;
class QVariant;
@@ -51,6 +50,10 @@ class QDateTime;
typedef QList<QJSValue> QJSValueList;
class QJSValuePrivate;
+namespace QV4 {
+ struct ExecutionEngine;
+ struct Value;
+}
class Q_QML_EXPORT QJSValue
{
@@ -65,6 +68,12 @@ public:
~QJSValue();
QJSValue(const QJSValue &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QJSValue(QJSValue && other) : d(other.d) { other.d = 0; }
+ inline QJSValue &operator=(QJSValue &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
+
QJSValue(bool value);
QJSValue(int value);
QJSValue(uint value);
@@ -125,7 +134,7 @@ public:
QT_DEPRECATED QJSEngine *engine() const;
#endif
- QJSValue(QJSValuePrivate *dd);
+ QJSValue(QV4::ExecutionEngine *e, quint64 val);
private:
friend class QJSValuePrivate;
// force compile error, prevent QJSValue(bool) to be called