From 79d50af3088abba7f3c0760197cee3c57ea00f71 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Mon, 14 Oct 2019 18:40:21 +0200 Subject: Use QSharedData for QXmppRosterIqPrivate and ItemPrivate --- src/base/QXmppRosterIq.cpp | 19 ++++++++----------- src/base/QXmppRosterIq.h | 11 ++++++++--- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'src/base') 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 +#include #include #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 #include +#include 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 groups() const; @@ -94,12 +96,15 @@ public: QString getSubscriptionTypeStr() const; void setSubscriptionTypeFromStr(const QString&); - ItemPrivate *d; + QSharedDataPointer 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 d; }; #endif // QXMPPROSTERIQ_H -- cgit v1.2.3