Add move constructor to QSslCertificate

The class has a move assignment operator, it should have a move
constructor as well.

Found by an Axivion scan.

Task-number: QTBUG-125026
Change-Id: I71fe066a84baede3a8cd309977a4a73d849dcfd1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 488362257d668760eb7bb60eb860570bd8b70d4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mate Barany 2024-07-02 15:36:51 +02:00 committed by Qt Cherry-pick Bot
parent 7fa938754a
commit 8b2ff809f6
2 changed files with 17 additions and 0 deletions

View File

@ -134,6 +134,8 @@ QSslCertificatePrivate::QSslCertificatePrivate()
QSslCertificatePrivate::~QSslCertificatePrivate() = default;
QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QSslCertificatePrivate)
/*!
Constructs a QSslCertificate by reading \a format encoded data
from \a device and using the first certificate found. You can
@ -198,6 +200,18 @@ QSslCertificate::QSslCertificate(const QSslCertificate &other) : d(other.d)
{
}
/*!
\fn QSslCertificate::QSslCertificate(QSslCertificate &&other)
\since 6.8
Move-constructs a new QSslCertificate from \a other.
\note The moved-from object \a other is placed in a partially-formed state,
in which the only valid operations are destructions and assignment of a new
value.
*/
/*!
Destroys the QSslCertificate.
*/

View File

@ -31,6 +31,8 @@ class QSslCertificate;
Q_NETWORK_EXPORT size_t qHash(const QSslCertificate &key, size_t seed = 0) noexcept;
class QSslCertificatePrivate;
QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QSslCertificatePrivate)
class Q_NETWORK_EXPORT QSslCertificate
{
public:
@ -56,6 +58,7 @@ public:
explicit QSslCertificate(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
explicit QSslCertificate(const QByteArray &data = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem);
QSslCertificate(const QSslCertificate &other);
QSslCertificate(QSslCertificate &&other) noexcept = default;
~QSslCertificate();
QSslCertificate &operator=(QSslCertificate &&other) noexcept { swap(other); return *this; }
QSslCertificate &operator=(const QSslCertificate &other);