summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qmessageauthenticationcode.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-03-02 15:00:31 +0100
committerMarc Mutz <marc.mutz@qt.io>2023-03-16 17:27:29 +0100
commitc5d4dde67896611e171db778f2bff23e614b9d14 (patch)
treeaef158b20e3c2807da3545c400339beb463eb94d /src/corelib/tools/qmessageauthenticationcode.h
parent41fea4f5fa16d4dab96f0585848b0cf60284dd95 (diff)
QMessageAuthenticationCode: add move SMFs and swap()
QCryptographicHash is move-only these days, so QMessageAuthenticationCode should not be left behind. [ChangeLog][QtCore][QMessageAuthenticationCode] Added move constructor, move assignment operator and swap() function. Fixes: QTBUG-111677 Change-Id: I420f24c04828e8ad7043a9e8c9e7e2d47dd183e0 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools/qmessageauthenticationcode.h')
-rw-r--r--src/corelib/tools/qmessageauthenticationcode.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qmessageauthenticationcode.h b/src/corelib/tools/qmessageauthenticationcode.h
index a7fb13d201a..6be86823327 100644
--- a/src/corelib/tools/qmessageauthenticationcode.h
+++ b/src/corelib/tools/qmessageauthenticationcode.h
@@ -18,8 +18,14 @@ class Q_CORE_EXPORT QMessageAuthenticationCode
public:
explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method,
const QByteArray &key = QByteArray());
+ QMessageAuthenticationCode(QMessageAuthenticationCode &&other) noexcept
+ : d{std::exchange(other.d, nullptr)} {}
~QMessageAuthenticationCode();
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMessageAuthenticationCode)
+ void swap(QMessageAuthenticationCode &other) noexcept
+ { qt_ptr_swap(d, other.d); }
+
void reset();
void setKey(const QByteArray &key);