QUrlQuery: add missing move constructor
It wasn't added when this class was created in 5.0 because we couldn't add move constructors and still keep the ability to compile Qt with C++98 compilers. We've forgot to correct this shortcoming since 5.6. Fixes: QTBUG-109842 Change-Id: I69ecc04064514f939896fffd17376b8243b73c52 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit fc8dad2f10e7976cfa778ca7d75e651012629b21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b1684da6ec
commit
03635c2677
@ -363,6 +363,16 @@ QUrlQuery::QUrlQuery(const QUrlQuery &other)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 6.5
|
||||||
|
Moves the contents of the \a other QUrlQuery object, including the query
|
||||||
|
delimiters.
|
||||||
|
*/
|
||||||
|
QUrlQuery::QUrlQuery(QUrlQuery &&other) noexcept
|
||||||
|
: d(std::move(other.d))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Copies the contents of the \a other QUrlQuery object, including the query
|
Copies the contents of the \a other QUrlQuery object, including the query
|
||||||
delimiters.
|
delimiters.
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QUrlQuery(const QUrlQuery &other);
|
QUrlQuery(const QUrlQuery &other);
|
||||||
|
QUrlQuery(QUrlQuery &&other) noexcept;
|
||||||
QUrlQuery &operator=(const QUrlQuery &other);
|
QUrlQuery &operator=(const QUrlQuery &other);
|
||||||
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrlQuery)
|
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrlQuery)
|
||||||
~QUrlQuery();
|
~QUrlQuery();
|
||||||
|
@ -172,6 +172,7 @@ void tst_QUrlQuery::constructing()
|
|||||||
QVERIFY(other != empty);
|
QVERIFY(other != empty);
|
||||||
QVERIFY(!(other == empty));
|
QVERIFY(!(other == empty));
|
||||||
|
|
||||||
|
// copy-construct
|
||||||
QUrlQuery copy(other);
|
QUrlQuery copy(other);
|
||||||
QCOMPARE(copy, other);
|
QCOMPARE(copy, other);
|
||||||
|
|
||||||
@ -179,10 +180,33 @@ void tst_QUrlQuery::constructing()
|
|||||||
QVERIFY(copy.isEmpty());
|
QVERIFY(copy.isEmpty());
|
||||||
QVERIFY(copy != other);
|
QVERIFY(copy != other);
|
||||||
|
|
||||||
|
// copy-assign
|
||||||
copy = other;
|
copy = other;
|
||||||
QVERIFY(!copy.isEmpty());
|
QVERIFY(!copy.isEmpty());
|
||||||
QCOMPARE(copy, other);
|
QCOMPARE(copy, other);
|
||||||
|
|
||||||
|
// move-construct
|
||||||
|
QUrlQuery moved(std::move(other));
|
||||||
|
QCOMPARE(moved, copy);
|
||||||
|
|
||||||
|
// self move-assign
|
||||||
|
moved = std::move(moved);
|
||||||
|
QCOMPARE(moved, copy);
|
||||||
|
|
||||||
|
// self move-assign of moved-from (Hinnant Criterion)
|
||||||
|
other = std::move(other);
|
||||||
|
// shouldn't crash; here, or further down
|
||||||
|
|
||||||
|
// copy-assign to moved-from object
|
||||||
|
other = copy;
|
||||||
|
QCOMPARE(other, copy);
|
||||||
|
QCOMPARE(other, moved);
|
||||||
|
|
||||||
|
// move-assign
|
||||||
|
moved = std::move(other);
|
||||||
|
QCOMPARE(moved, copy);
|
||||||
|
|
||||||
|
// (move-)assign default-constructed
|
||||||
copy = QUrlQuery();
|
copy = QUrlQuery();
|
||||||
QVERIFY(copy.isEmpty());
|
QVERIFY(copy.isEmpty());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user