aboutsummaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2019-10-14 18:40:21 +0200
committerLNJ <lnj@kaidan.im>2019-10-15 21:46:50 +0200
commit79d50af3088abba7f3c0760197cee3c57ea00f71 (patch)
treebe1771cde2f1f03010a6049a68555dfc40261536 /src/base
parent926536fe32c2ea0057bdfd0b7f68a255a49d5a78 (diff)
downloadqxmpp-79d50af3088abba7f3c0760197cee3c57ea00f71.tar.gz
Use QSharedData for QXmppRosterIqPrivate and ItemPrivate
Diffstat (limited to 'src/base')
-rw-r--r--src/base/QXmppRosterIq.cpp19
-rw-r--r--src/base/QXmppRosterIq.h11
2 files changed, 16 insertions, 14 deletions
diff --git a/src/base/QXmppRosterIq.cpp b/src/base/QXmppRosterIq.cpp
index 3dfb32b4..1aed24cc 100644
--- a/src/base/QXmppRosterIq.cpp
+++ b/src/base/QXmppRosterIq.cpp
@@ -23,6 +23,7 @@
*/
#include <QDomElement>
+#include <QSharedData>
#include <QXmlStreamWriter>
#include "QXmppRosterIq.h"
@@ -44,9 +45,9 @@ QXmppRosterIq::QXmppRosterIq()
{
}
-QXmppRosterIq::~QXmppRosterIq()
-{
-}
+QXmppRosterIq::~QXmppRosterIq() = default;
+
+QXmppRosterIq &QXmppRosterIq::operator=(const QXmppRosterIq &) = default;
/// Adds an item to the roster IQ.
///
@@ -168,15 +169,11 @@ QXmppRosterIq::Item::Item()
d->type = NotSet;
}
-QXmppRosterIq::Item::~Item()
-{
-}
+QXmppRosterIq::Item::Item(const QXmppRosterIq::Item &other) = default;
-QXmppRosterIq::Item& QXmppRosterIq::Item::operator=(const Item &other)
-{
- d = other.d;
- return *this;
-}
+QXmppRosterIq::Item::~Item() = default;
+
+QXmppRosterIq::Item& QXmppRosterIq::Item::operator=(const Item &other) = default;
/// Returns the bareJid of the roster entry.
///
diff --git a/src/base/QXmppRosterIq.h b/src/base/QXmppRosterIq.h
index 4d0205d4..86ec537d 100644
--- a/src/base/QXmppRosterIq.h
+++ b/src/base/QXmppRosterIq.h
@@ -29,6 +29,7 @@
#include "QXmppIq.h"
#include <QList>
#include <QSet>
+#include <QSharedDataPointer>
class QXmppRosterIqPrivate;
@@ -62,9 +63,10 @@ public:
};
Item();
+ Item(const Item &other);
~Item();
- Item& operator=(const Item &other);
+ Item &operator=(const Item &other);
QString bareJid() const;
QSet<QString> groups() const;
@@ -94,12 +96,15 @@ public:
QString getSubscriptionTypeStr() const;
void setSubscriptionTypeFromStr(const QString&);
- ItemPrivate *d;
+ QSharedDataPointer<ItemPrivate> d;
};
QXmppRosterIq();
+ QXmppRosterIq(const QXmppRosterIq &);
~QXmppRosterIq() override;
+ QXmppRosterIq &operator=(const QXmppRosterIq &);
+
QString version() const;
void setVersion(const QString&);
@@ -121,7 +126,7 @@ protected:
/// \endcond
private:
- QXmppRosterIqPrivate *d;
+ QSharedDataPointer<QXmppRosterIqPrivate> d;
};
#endif // QXMPPROSTERIQ_H