diff options
author | Jesus Fernandez <jesus.fernandez@qt.io> | 2017-04-27 18:44:19 +0200 |
---|---|---|
committer | Jesus Fernandez <Jesus.Fernandez@qt.io> | 2017-04-28 12:50:34 +0000 |
commit | 99d809bd75582180a3a8178287862262024f8f33 (patch) | |
tree | f72bd51497c624df79702c0557014b4687b10f05 /src/sql/kernel/qsqlerror.cpp | |
parent | 7ef398e8fa7e283bf42eacfa9f0a514f6490aad2 (diff) |
Add move special member functions to QSqlError
Also mark as shared-come-qt6 and add member-swap.
[ChangeLog][QtSql][QSqlError] Added swap().
Coverity-Id: 168223
Change-Id: Iaad4dee383900b9d11856e860b0647780a81a505
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/sql/kernel/qsqlerror.cpp')
-rw-r--r-- | src/sql/kernel/qsqlerror.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp index d1fc5d4585..1427f58327 100644 --- a/src/sql/kernel/qsqlerror.cpp +++ b/src/sql/kernel/qsqlerror.cpp @@ -98,6 +98,34 @@ public: type \a type and the optional error number \a number. */ +/*! \fn QSqlError::QSqlError(QSqlError &&other) + Move-constructs a QSqlError instance, making it point at the same + object that \a other was pointing to. + + \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 5.10 +*/ + +/*! \fn QSqlError::operator=(QSqlError &&other) + Move-assigns \a other to this QSqlError 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 5.10 +*/ + +/*! \fn QSqlError::swap(QSqlError &other) + Swaps error \other with this error. This operation is very fast + and never fails. + + \since 5.10 +*/ + #if QT_DEPRECATED_SINCE(5, 3) QSqlError::QSqlError(const QString& driverText, const QString& databaseText, ErrorType type, int number) @@ -117,7 +145,6 @@ QSqlError::QSqlError(const QString& driverText, const QString& databaseText, Err driverText, the database-specific error text \a databaseText, the type \a type and the error code \a code. */ - QSqlError::QSqlError(const QString &driverText, const QString &databaseText, ErrorType type, const QString &code) { @@ -146,7 +173,10 @@ QSqlError::QSqlError(const QSqlError& other) QSqlError& QSqlError::operator=(const QSqlError& other) { - *d = *other.d; + if (d) + *d = *other.d; + else + d = new QSqlErrorPrivate(*other.d); return *this; } |