summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2024-03-14 14:50:08 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2024-04-04 18:11:14 +0100
commit612ed28985736cabce722580d9b84c5af4460e05 (patch)
tree3c957caa0cb9037032caf255d1987a05d8ed83ed /src/corelib/text
parent7d5646c02e25a81f7b2e2c76b39505fba3c2c043 (diff)
QCollatorSortKey: Rule of Five: add missing move constructor
It has move assign, so should have move-construct. This turns out to need QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT() and QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QCollatorSortKeyPrivate). In the process, make the move assignment and constructor docs in qcollator.cpp conform to the usual pattern. Fixes: QTBUG-123326 Change-Id: I6fc9ed254dc396ff6130df09826b993e98dcf101 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/text')
-rw-r--r--src/corelib/text/qcollator.cpp27
-rw-r--r--src/corelib/text/qcollator.h2
2 files changed, 21 insertions, 8 deletions
diff --git a/src/corelib/text/qcollator.cpp b/src/corelib/text/qcollator.cpp
index 2b49b8178b..1f7e7459e7 100644
--- a/src/corelib/text/qcollator.cpp
+++ b/src/corelib/text/qcollator.cpp
@@ -11,6 +11,7 @@
#include "qthreadstorage.h"
QT_BEGIN_NAMESPACE
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QCollatorSortKeyPrivate)
namespace {
struct GenerationalCollator
@@ -150,19 +151,19 @@ QCollator &QCollator::operator=(const QCollator &other)
Move constructor. Moves from \a other into this collator.
- Note that a moved-from QCollator can only be destroyed or assigned to.
- The effect of calling other functions than the destructor or one of the
- assignment operators is undefined.
+//! [partially-formed]
+ \note The moved-from object \a other is placed in a partially-formed state,
+ in which the only valid operations are destruction and assignment of a new
+ value.
+//! [partially-formed]
*/
/*!
\fn QCollator & QCollator::operator=(QCollator && other)
- Move-assigns from \a other to this collator.
+ Move-assigns \a other to this QCollator instance.
- Note that a moved-from QCollator can only be destroyed or assigned to.
- The effect of calling other functions than the destructor or one of the
- assignment operators is undefined.
+ \include qcollator.cpp partially-formed
*/
/*!
@@ -424,6 +425,14 @@ QCollatorSortKey::QCollatorSortKey(const QCollatorSortKey &other)
}
/*!
+ \since 6.8
+ \fn QCollatorSortKey::QCollatorSortKey(QCollatorSortKey &&other)
+ Move-constructs a new QCollatorSortKey from \a other.
+
+ \include qcollator.cpp partially-formed
+*/
+
+/*!
Destroys the collator key.
*/
QCollatorSortKey::~QCollatorSortKey()
@@ -444,7 +453,9 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other)
/*!
\fn QCollatorSortKey &QCollatorSortKey::operator=(QCollatorSortKey && other)
- Move-assigns \a other to this collator key.
+ Move-assigns \a other to this QCollatorSortKey instance.
+
+ \include qcollator.cpp partially-formed
*/
/*!
diff --git a/src/corelib/text/qcollator.h b/src/corelib/text/qcollator.h
index 6f4882989b..9f61cfc22a 100644
--- a/src/corelib/text/qcollator.h
+++ b/src/corelib/text/qcollator.h
@@ -13,12 +13,14 @@ QT_BEGIN_NAMESPACE
class QCollatorPrivate;
class QCollatorSortKeyPrivate;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QCollatorSortKeyPrivate, Q_CORE_EXPORT)
class Q_CORE_EXPORT QCollatorSortKey
{
friend class QCollator;
public:
QCollatorSortKey(const QCollatorSortKey &other);
+ QCollatorSortKey(QCollatorSortKey &&other) noexcept = default;
~QCollatorSortKey();
QCollatorSortKey &operator=(const QCollatorSortKey &other);
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCollatorSortKey)