[telepathy-qt4/master] Use a private implementation in ProtocolParameter

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


---
 TelepathyQt4/connection-manager.cpp |   53 ++++++++++++++++++++++++++++------
 TelepathyQt4/connection-manager.h   |   13 ++------
 2 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/TelepathyQt4/connection-manager.cpp b/TelepathyQt4/connection-manager.cpp
index c59bc27..b1382f4 100644
--- a/TelepathyQt4/connection-manager.cpp
+++ b/TelepathyQt4/connection-manager.cpp
@@ -62,45 +62,78 @@
 namespace Tp
 {
 
+struct ProtocolParameter::Private
+{
+    QString name;
+    QDBusSignature dbusSignature;
+    QVariant::Type type;
+    QVariant defaultValue;
+    ConnMgrParamFlag flags;
+
+    Private(const QString &name, const QDBusSignature &dbusSignature, QVariant::Type type,
+            const QVariant &defaultValue, ConnMgrParamFlag flags)
+        : name(name), dbusSignature(dbusSignature), type(type), defaultValue(defaultValue),
+          flags(flags) {}
+};
+
 ProtocolParameter::ProtocolParameter(const QString &name,
                                      const QDBusSignature &dbusSignature,
                                      QVariant defaultValue,
                                      ConnMgrParamFlag flags)
-    : mName(name),
-      mDBusSignature(dbusSignature),
-      mType(ManagerFile::variantTypeFromDBusSignature(dbusSignature.signature())),
-      mDefaultValue(defaultValue),
-      mFlags(flags)
+    : mPriv(new Private(name, dbusSignature,
+                ManagerFile::variantTypeFromDBusSignature(dbusSignature.signature()), defaultValue,
+                flags))
 {
 }
 
 ProtocolParameter::~ProtocolParameter()
 {
+    delete mPriv;
+}
+
+QString ProtocolParameter::name() const
+{
+    return mPriv->name;
+}
+
+QDBusSignature ProtocolParameter::dbusSignature() const
+{
+    return mPriv->dbusSignature;
+}
+
+QVariant::Type ProtocolParameter::type() const
+{
+    return mPriv->type;
+}
+
+QVariant ProtocolParameter::defaultValue() const
+{
+    return mPriv->defaultValue;
 }
 
 bool ProtocolParameter::isRequired() const
 {
-    return mFlags & ConnMgrParamFlagRequired;
+    return mPriv->flags & ConnMgrParamFlagRequired;
 }
 
 bool ProtocolParameter::isSecret() const
 {
-    return mFlags & ConnMgrParamFlagSecret;
+    return mPriv->flags & ConnMgrParamFlagSecret;
 }
 
 bool ProtocolParameter::requiredForRegistration() const
 {
-    return mFlags & ConnMgrParamFlagRegister;
+    return mPriv->flags & ConnMgrParamFlagRegister;
 }
 
 bool ProtocolParameter::operator==(const ProtocolParameter &other) const
 {
-    return (mName == other.name());
+    return (mPriv->name == other.name());
 }
 
 bool ProtocolParameter::operator==(const QString &name) const
 {
-    return (mName == name);
+    return (mPriv->name == name);
 }
 
 struct ProtocolInfo::Private
diff --git a/TelepathyQt4/connection-manager.h b/TelepathyQt4/connection-manager.h
index 9dd0be4..771be7a 100644
--- a/TelepathyQt4/connection-manager.h
+++ b/TelepathyQt4/connection-manager.h
@@ -60,10 +60,10 @@ public:
                       ConnMgrParamFlag flags);
     ~ProtocolParameter();
 
-    QString name() const { return mName; }
-    QDBusSignature dbusSignature() const { return mDBusSignature; }
-    QVariant::Type type() const { return mType; }
-    QVariant defaultValue() const { return mDefaultValue; }
+    QString name() const;
+    QDBusSignature dbusSignature() const;
+    QVariant::Type type() const;
+    QVariant defaultValue() const;
 
     bool isRequired() const;
     bool isSecret() const;
@@ -78,11 +78,6 @@ private:
     struct Private;
     friend struct Private;
     Private *mPriv;
-    QString mName;
-    QDBusSignature mDBusSignature;
-    QVariant::Type mType;
-    QVariant mDefaultValue;
-    ConnMgrParamFlag mFlags;
 };
 
 class ProtocolInfo
-- 
1.5.6.5




More information about the telepathy-commits mailing list