From 8a375341cf7a7cf38ef427bc0c9f1abde05a471d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 22 Feb 2017 11:49:24 +0000 Subject: QJson*: value semantics cleanup Re-add the move operations, add a swap(), mark as shared (we're already using them in containers). QJsonValue is slightly tricky, because it has an anonymous union, which can't be easily moved in C++. Use the implementation of the copy constructor as inspiration for the move. [ChangeLog][QtCore][JSON] QJsonArray, QJsonDocument, QJsonObject and QJsonValue now have move operations and a swap() member function. Change-Id: Idfb94a93370ace96100efbd6559ef05b4c5adc39 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/corelib/json/qjsonvalue.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/corelib/json/qjsonvalue.cpp') diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 4b52014db1e..cd7c1c63fca 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -283,6 +283,27 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other) return *this; } +/*! + \fn QJsonValue::QJsonValue(QJsonValue &&other) + \since 5.10 + + Move-constructs a QJsonValue from \a other. +*/ + +/*! + \fn QJsonValue &QJsonValue::operator =(QJsonValue &&other) + \since 5.10 + + Move-assigns \a other to this value. +*/ + +/*! + \fn void QJsonValue::swap(QJsonValue &other) + \since 5.10 + + Swaps the value \a other with this. This operation is very fast and never fails. +*/ + /*! \fn bool QJsonValue::isNull() const -- cgit v1.2.3