diff options
| author | Linus Jahn <lnj@kaidan.im> | 2022-06-17 18:26:01 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-06-18 12:45:19 +0200 |
| commit | 31ef165cbbf918ba0ddd00f86c6dee257a0b936b (patch) | |
| tree | e891a37cf70fbc60354d9a9cd69d4e9cb7d34a80 /src/base/QXmppStanza.cpp | |
| parent | 675f57b1d7facab15eff303f022c332a8220777e (diff) | |
| download | qxmpp-31ef165cbbf918ba0ddd00f86c6dee257a0b936b.tar.gz | |
Add move constructors and move assignment operators everywhere
This is so std::move() on implicitly-shared types actually moves the
content and doesn't call the copy ctor/assignment operator.
Diffstat (limited to 'src/base/QXmppStanza.cpp')
| -rw-r--r-- | src/base/QXmppStanza.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/base/QXmppStanza.cpp b/src/base/QXmppStanza.cpp index d225b829..e4192128 100644 --- a/src/base/QXmppStanza.cpp +++ b/src/base/QXmppStanza.cpp @@ -186,11 +186,13 @@ QXmppExtendedAddress::QXmppExtendedAddress() /// Default copy-constructur QXmppExtendedAddress::QXmppExtendedAddress(const QXmppExtendedAddress &other) = default; - +/// Default move-constructur +QXmppExtendedAddress::QXmppExtendedAddress(QXmppExtendedAddress &&) = default; QXmppExtendedAddress::~QXmppExtendedAddress() = default; - /// Default assignment operator QXmppExtendedAddress &QXmppExtendedAddress::operator=(const QXmppExtendedAddress &other) = default; +/// Default assignment operator +QXmppExtendedAddress &QXmppExtendedAddress::operator=(QXmppExtendedAddress &&) = default; /// /// Returns the human-readable description of the address. @@ -321,6 +323,8 @@ QXmppStanza::Error::Error() /// Copy constructor QXmppStanza::Error::Error(const QXmppStanza::Error &) = default; +/// Move constructor +QXmppStanza::Error::Error(QXmppStanza::Error &&) = default; /// /// Initializes an error with a type, condition and text. @@ -347,9 +351,10 @@ QXmppStanza::Error::Error(const QString &type, const QString &cond, /// Default destructor QXmppStanza::Error::~Error() = default; - /// Copy operator QXmppStanza::Error &QXmppStanza::Error::operator=(const QXmppStanza::Error &) = default; +/// Move operator +QXmppStanza::Error &QXmppStanza::Error::operator=(QXmppStanza::Error &&) = default; /// /// Returns the human-readable description of the error. @@ -725,21 +730,15 @@ QXmppE2eeMetadata::QXmppE2eeMetadata(QSharedDataPointer<QXmppE2eeMetadataPrivate } /// \endcond -/// -/// Constructs a copy of \a other. -/// -/// \param other -/// +/// Copy-constructor. QXmppE2eeMetadata::QXmppE2eeMetadata(const QXmppE2eeMetadata &other) = default; - +/// Move-constructor. +QXmppE2eeMetadata::QXmppE2eeMetadata(QXmppE2eeMetadata &&) = default; QXmppE2eeMetadata::~QXmppE2eeMetadata() = default; - -/// -/// Assigns \a other to this end-to-end encryption metadata class. -/// -/// \param other -/// +/// Assignment operator. QXmppE2eeMetadata &QXmppE2eeMetadata::operator=(const QXmppE2eeMetadata &other) = default; +/// Assignment move-operator. +QXmppE2eeMetadata &QXmppE2eeMetadata::operator=(QXmppE2eeMetadata &&) = default; /// /// Returns the used encryption protocol. @@ -865,12 +864,14 @@ QXmppStanza::QXmppStanza(const QString &from, const QString &to) /// Constructs a copy of \a other. QXmppStanza::QXmppStanza(const QXmppStanza &other) = default; - +/// Move constructor. +QXmppStanza::QXmppStanza(QXmppStanza &&) = default; /// Destroys a QXmppStanza. QXmppStanza::~QXmppStanza() = default; - /// Assigns \a other to this stanza. QXmppStanza &QXmppStanza::operator=(const QXmppStanza &other) = default; +/// Move-assignment operator. +QXmppStanza &QXmppStanza::operator=(QXmppStanza &&) = default; /// /// Returns the stanza's recipient JID. |
