[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:07:17 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=8274c27

The following commit has been merged in the master branch:
commit 8274c275380718ec989eb647a2ed9922fa7df23d
Author: George Goldberg <george.goldberg at collabora.co.uk>
Date:   Fri Jan 28 16:03:35 2011 +0000

    Dario Review: make ContactIdentifier and ContactResources classes be implicitly shared.
---
 kpeople/nepomuk-feeder/nepomuk-storage.cpp | 73 ++++++++++++++++++++++++++----
 kpeople/nepomuk-feeder/nepomuk-storage.h   | 11 +++--
 2 files changed, 72 insertions(+), 12 deletions(-)

diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index c6e1607..68fd37f 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -42,11 +42,38 @@
 #include <Nepomuk/Query/QueryServiceClient>
 #include <Nepomuk/Query/Result>
 
+#include <QtCore/QSharedData>
+
 #include <TelepathyQt4/Constants>
 
+class ContactIdentifier::Data : public QSharedData {
+public:
+    Data(const QString &a, const QString &c)
+      : accountId(a),
+        contactId(c)
+    { }
+
+    Data(const Data &other)
+      : QSharedData(other),
+        accountId(other.accountId),
+        contactId(other.contactId)
+    { }
+
+    ~Data()
+    { }
+
+    QString accountId;
+    QString contactId;
+};
+
 ContactIdentifier::ContactIdentifier(const QString &accountId, const QString &contactId)
-  : m_accountId(accountId),
-    m_contactId(contactId)
+  : d(new Data(accountId, contactId))
+{
+
+}
+
+ContactIdentifier::ContactIdentifier(const ContactIdentifier &other)
+  : d(other.d)
 {
 
 }
@@ -58,12 +85,12 @@ ContactIdentifier::~ContactIdentifier()
 
 const QString &ContactIdentifier::accountId() const
 {
-    return m_accountId;
+    return d->accountId;
 }
 
 const QString &ContactIdentifier::contactId() const
 {
-    return m_contactId;
+    return d->contactId;
 }
 
 bool ContactIdentifier::operator==(const ContactIdentifier& other) const
@@ -76,15 +103,45 @@ bool ContactIdentifier::operator!=(const ContactIdentifier& other) const
     return !(*this == other);
 }
 
+
+class ContactResources::Data : public QSharedData {
+public:
+    Data(const Nepomuk::PersonContact &p, const Nepomuk::IMAccount &i)
+      : personContact(p),
+        imAccount(i)
+    { }
+
+    Data()
+    { }
+
+    Data(const Data &other)
+      : QSharedData(other),
+        personContact(other.personContact),
+        imAccount(other.imAccount)
+    { }
+
+    ~Data()
+    { }
+
+    Nepomuk::PersonContact personContact;
+    Nepomuk::IMAccount imAccount;
+};
+
 ContactResources::ContactResources(const Nepomuk::PersonContact &personContact,
                                    const Nepomuk::IMAccount &imAccount)
-  : m_personContact(personContact),
-    m_imAccount(imAccount)
+  : d(new Data(personContact, imAccount))
 {
 
 }
 
 ContactResources::ContactResources()
+  : d(new Data())
+{
+
+}
+
+ContactResources::ContactResources(const ContactResources &other)
+  : d(other.d)
 {
 
 }
@@ -96,12 +153,12 @@ ContactResources::~ContactResources()
 
 const Nepomuk::PersonContact &ContactResources::personContact() const
 {
-    return m_personContact;
+    return d->personContact;
 }
 
 const Nepomuk::IMAccount &ContactResources::imAccount() const
 {
-    return m_imAccount;
+    return d->imAccount;
 }
 
 
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.h b/kpeople/nepomuk-feeder/nepomuk-storage.h
index 8452811..f0ea5ab 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.h
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.h
@@ -28,6 +28,7 @@
 #include "ontologies/personcontact.h"
 
 #include <QtCore/QObject>
+#include <QtCore/QSharedDataPointer>
 #include <QtCore/QString>
 
 #include <TelepathyQt4/Contact>
@@ -40,6 +41,7 @@ namespace Nepomuk {
 class ContactIdentifier {
 public:
     ContactIdentifier(const QString &accountId, const QString &contactId);
+    ContactIdentifier(const ContactIdentifier &other);
     ~ContactIdentifier();
 
     const QString &accountId() const;
@@ -49,8 +51,8 @@ public:
     bool operator!=(const ContactIdentifier &other) const;
 
 private:
-    QString m_accountId;
-    QString m_contactId;
+    class Data;
+    QSharedDataPointer<Data> d;
 };
 
 int qHash(ContactIdentifier c);
@@ -59,6 +61,7 @@ class ContactResources {
 public:
     ContactResources(const Nepomuk::PersonContact &personContact,
                      const Nepomuk::IMAccount &imAccount);
+    ContactResources(const ContactResources &other);
     ContactResources();
     ~ContactResources();
 
@@ -66,8 +69,8 @@ public:
     const Nepomuk::IMAccount &imAccount() const;
 
 private:
-    Nepomuk::PersonContact m_personContact;
-    Nepomuk::IMAccount m_imAccount;
+    class Data;
+    QSharedDataPointer<Data> d;
 };
 
 /**

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list