diff contact.h @ 7:017925589d4c

Contact (formerly ContactT) now use shared data
author Goffi <goffi@goffi.org>
date Sun, 14 Aug 2011 18:03:54 +0200
parents 48045176d1c6
children
line wrap: on
line diff
--- a/contact.h	Fri Aug 12 22:08:37 2011 +0200
+++ b/contact.h	Sun Aug 14 18:03:54 2011 +0200
@@ -19,25 +19,20 @@
 #ifndef CONTACT_H
 #define CONTACT_H
 
-#include <QtGui>
+#include <QSharedData>
+#include <QString>
+#include <QHash>
+#include <QList>
 #include "jid.h"
 
-class ContactT {
+class ContactData: public QSharedData
+{
     public:
-        ContactT();
-        ~ContactT();
-        QList<QString> groups;
+        ContactData();
+        ContactData(const ContactData& other);
+        
         Jid jid;
-        void setProfile(const QString& profile);
-        const QString& getProfile() const;
-        void setAttributes(const QHash<QString, QString>& attr);
-        QHash<QString, QString> getAttributes() const;
-        const QString& getName() const;
-
-        bool isConnected();
-
-
-    private:
+        QList<QString> groups;
         bool m_connected;
         bool m_presence_to, m_presence_from, m_presence_ask;
         QString m_profile, m_name;
@@ -45,5 +40,26 @@
         
 };
 
+class Contact {
+    public:
+        Contact();
+        Contact(const Contact &other);
+       
+        Jid& getJid();
+        const Jid& getJid() const;
+        QList<QString>& getGroups();
+        const QList<QString>& getGroups() const;
+        void setProfile(const QString& profile);
+        const QString& getProfile() const;
+        void setAttributes(const QHash<QString, QString>& attr);
+        QHash<QString, QString> getAttributes() const;
+        const QString& getName() const;
+        void setName(const QString& name);
+        bool isConnected();
+
+    private:
+        QExplicitlySharedDataPointer<ContactData> d;
+};
+
 
 #endif