aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppIq.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-06-17 18:26:01 +0200
committerLinus Jahn <lnj@kaidan.im>2022-06-18 12:45:19 +0200
commit31ef165cbbf918ba0ddd00f86c6dee257a0b936b (patch)
treee891a37cf70fbc60354d9a9cd69d4e9cb7d34a80 /src/base/QXmppIq.cpp
parent675f57b1d7facab15eff303f022c332a8220777e (diff)
downloadqxmpp-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/QXmppIq.cpp')
-rw-r--r--src/base/QXmppIq.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/base/QXmppIq.cpp b/src/base/QXmppIq.cpp
index efb35396..3d9f5422 100644
--- a/src/base/QXmppIq.cpp
+++ b/src/base/QXmppIq.cpp
@@ -22,10 +22,11 @@ public:
QXmppIq::Type type;
};
+///
/// Constructs a QXmppIq with the specified \a type.
///
/// \param type
-
+///
QXmppIq::QXmppIq(QXmppIq::Type type)
: QXmppStanza(), d(new QXmppIqPrivate)
{
@@ -34,37 +35,29 @@ QXmppIq::QXmppIq(QXmppIq::Type type)
}
/// Constructs a copy of \a other.
-
-QXmppIq::QXmppIq(const QXmppIq &other)
- : QXmppStanza(other), d(other.d)
-{
-}
-
-QXmppIq::~QXmppIq()
-{
-}
+QXmppIq::QXmppIq(const QXmppIq &other) = default;
+/// Default move-constructor.
+QXmppIq::QXmppIq(QXmppIq &&) = default;
+QXmppIq::~QXmppIq() = default;
/// Assigns \a other to this IQ.
+QXmppIq &QXmppIq::operator=(const QXmppIq &other) = default;
+/// Move-assignment operator.
+QXmppIq &QXmppIq::operator=(QXmppIq &&) = default;
-QXmppIq &QXmppIq::operator=(const QXmppIq &other)
-{
- QXmppStanza::operator=(other);
- d = other.d;
- return *this;
-}
-
+///
/// Returns the IQ's type.
///
-
QXmppIq::Type QXmppIq::type() const
{
return d->type;
}
+///
/// Sets the IQ's type.
///
/// \param type
-
+///
void QXmppIq::setType(QXmppIq::Type type)
{
d->type = type;