[telepathy-qt4/master] Use fully private implementation in ProtocolInfo

Olli Salli "XXX CHANGETHISINVALIDADDRESSTOSOMETHINGSENSIBLEWHENWORKINGONANEWREPOXXX" at dhansak.collabora.co.uk
Tue Jun 30 13:04:51 PDT 2009


---
 TelepathyQt4/connection-manager.cpp |   23 ++++++++++++++++-------
 TelepathyQt4/connection-manager.h   |    6 ++----
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/TelepathyQt4/connection-manager.cpp b/TelepathyQt4/connection-manager.cpp
index b1382f4..2b76635 100644
--- a/TelepathyQt4/connection-manager.cpp
+++ b/TelepathyQt4/connection-manager.cpp
@@ -138,7 +138,12 @@ bool ProtocolParameter::operator==(const QString &name) const
 
 struct ProtocolInfo::Private
 {
+    QString cmName;
+    QString name;
     ProtocolParameterList params;
+
+    Private(const QString &cmName, const QString &name)
+        : cmName(cmName), name(name) {}
 };
 
 /**
@@ -156,9 +161,7 @@ struct ProtocolInfo::Private
  * \param name Name of the protocol.
  */
 ProtocolInfo::ProtocolInfo(const QString &cmName, const QString &name)
-    : mPriv(new Private()),
-      mCmName(cmName),
-      mName(name)
+    : mPriv(new Private(cmName, name))
 {
 }
 
@@ -170,19 +173,21 @@ ProtocolInfo::~ProtocolInfo()
     foreach (ProtocolParameter *param, mPriv->params) {
         delete param;
     }
+
+    delete mPriv;
 }
 
 /**
- * \fn QString ProtocolInfo::cmName() const
- *
  * Get the short name of the connection manager (e.g. "gabble").
  *
  * \return The name of the connection manager.
  */
+QString ProtocolInfo::cmName() const
+{
+    return mPriv->cmName;
+}
 
 /**
- * \fn QString ProtocolInfo::name() const
- *
  * Get the string identifying the protocol as described in the Telepathy
  * D-Bus API Specification (e.g. "jabber").
  *
@@ -191,6 +196,10 @@ ProtocolInfo::~ProtocolInfo()
  *
  * \return A string identifying the protocol.
  */
+QString ProtocolInfo::name() const
+{
+    return mPriv->name;
+}
 
 /**
  * Return all supported parameters. The parameters' names
diff --git a/TelepathyQt4/connection-manager.h b/TelepathyQt4/connection-manager.h
index 771be7a..20675b7 100644
--- a/TelepathyQt4/connection-manager.h
+++ b/TelepathyQt4/connection-manager.h
@@ -85,9 +85,9 @@ class ProtocolInfo
 public:
     ~ProtocolInfo();
 
-    QString cmName() const { return mCmName; }
+    QString cmName() const;
 
-    QString name() const { return mName; }
+    QString name() const;
 
     const ProtocolParameterList &parameters() const;
     bool hasParameter(const QString &name) const;
@@ -105,8 +105,6 @@ private:
     friend class Private;
     friend class ConnectionManager;
     Private *mPriv;
-    QString mCmName;
-    QString mName;
 };
 
 class ConnectionManager : public StatelessDBusProxy,
-- 
1.5.6.5




More information about the telepathy-commits mailing list