diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-03-25 16:48:06 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-03-31 18:36:29 +0200 |
commit | 46e909a37a38289a601333ae6f205e8946152287 (patch) | |
tree | f03d27076b848006aee42abcae32dd7734398340 /src/sql | |
parent | 9f44553b3d297f7a423c51451c4e18c0e5a25d19 (diff) |
QSqlIndex: add move ctor & move operator
Add the move ctor and move operator for QSqlIndex, also add an explicit
testcase for QSqlIndex
Task-number: QTBUG-109938
Change-Id: I46cc6a24c2e7d5b23d2ac3427cafd01b9ba257ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/kernel/qsqlindex.cpp | 20 | ||||
-rw-r--r-- | src/sql/kernel/qsqlindex.h | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/sql/kernel/qsqlindex.cpp b/src/sql/kernel/qsqlindex.cpp index 25b032f336..77af6f0fb8 100644 --- a/src/sql/kernel/qsqlindex.cpp +++ b/src/sql/kernel/qsqlindex.cpp @@ -41,6 +41,25 @@ QSqlIndex::QSqlIndex(const QSqlIndex& other) { } +/*! \fn QSqlIndex::QSqlIndex(QSqlIndex &&other) + Move-constructs a new QSqlIndex from \a other. + + \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. + + \since 6.6 +*/ +/*! \fn QSqlIndex& QSqlIndex::operator=(QSqlIndex &&other) + Move-assigns \a other to this QSqlIndex instance. + + \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. + + \since 6.6 +*/ + /*! Sets the index equal to \a other. */ @@ -54,6 +73,7 @@ QSqlIndex& QSqlIndex::operator=(const QSqlIndex& other) return *this; } + /*! Destroys the object and frees any allocated resources. */ diff --git a/src/sql/kernel/qsqlindex.h b/src/sql/kernel/qsqlindex.h index 08ef14b614..67eeb2a9e0 100644 --- a/src/sql/kernel/qsqlindex.h +++ b/src/sql/kernel/qsqlindex.h @@ -17,8 +17,11 @@ class Q_SQL_EXPORT QSqlIndex : public QSqlRecord public: explicit QSqlIndex(const QString &cursorName = QString(), const QString &name = QString()); QSqlIndex(const QSqlIndex &other); + QSqlIndex(QSqlIndex &&other) noexcept = default; ~QSqlIndex(); QSqlIndex &operator=(const QSqlIndex &other); + QSqlIndex &operator=(QSqlIndex &&other) = default; + void setCursorName(const QString &cursorName); inline QString cursorName() const { return cursor; } void setName(const QString& name); @@ -32,6 +35,7 @@ public: private: QString createField(int i, const QString& prefix, bool verbose) const; + // ### Qt7: move to d-ptr QString cursor; QString nm; QList<bool> sorts; |