[telepathy-qt4/master] PendingOperation: Fixed coding-style.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Thu Jun 18 08:42:54 PDT 2009


---
 TelepathyQt4/pending-operation.cpp       |   82 ++++++++++++------------------
 TelepathyQt4/pending-operation.h         |    8 ++--
 TelepathyQt4/simple-pending-operations.h |   10 ++--
 3 files changed, 41 insertions(+), 59 deletions(-)

diff --git a/TelepathyQt4/pending-operation.cpp b/TelepathyQt4/pending-operation.cpp
index d3c02cf..3f13aa9 100644
--- a/TelepathyQt4/pending-operation.cpp
+++ b/TelepathyQt4/pending-operation.cpp
@@ -39,37 +39,32 @@ namespace Tp
 
 struct PendingOperation::Private
 {
-    inline Private()
-      : errorName(QString()),
-        errorMessage(QString()),
-        finished(false)
-    { }
+    Private() : finished(false)
+    {
+    }
 
     QString errorName;
     QString errorMessage;
     bool finished;
 };
 
-
-PendingOperation::PendingOperation(QObject* parent)
-  : QObject(parent),
-    mPriv(new Private())
+PendingOperation::PendingOperation(QObject *parent)
+    : QObject(parent),
+      mPriv(new Private())
 {
 }
 
-
 PendingOperation::~PendingOperation()
 {
     if (!mPriv->finished) {
-        warning() << this
-                << "still pending when it was deleted - finished will "
-                   "never be emitted";
+        warning() << this <<
+            "still pending when it was deleted - finished will "
+            "never be emitted";
     }
 
     delete mPriv;
 }
 
-
 void PendingOperation::emitFinished()
 {
     Q_ASSERT(mPriv->finished);
@@ -77,16 +72,16 @@ void PendingOperation::emitFinished()
     deleteLater();
 }
 
-
 void PendingOperation::setFinished()
 {
     if (mPriv->finished) {
-        if (mPriv->errorName.isEmpty())
+        if (mPriv->errorName.isEmpty()) {
             warning() << this << "trying to finish with success, but already"
-              " failed with" << errorName() << ":" << errorMessage();
-        else
+                " failed with" << errorName() << ":" << errorMessage();
+        } else {
             warning() << this << "trying to finish with success, but already"
-              " succeeded";
+                " succeeded";
+        }
         return;
     }
 
@@ -95,26 +90,25 @@ void PendingOperation::setFinished()
     QTimer::singleShot(0, this, SLOT(emitFinished()));
 }
 
-
-void PendingOperation::setFinishedWithError(const QString& name,
-        const QString& message)
+void PendingOperation::setFinishedWithError(const QString &name,
+        const QString &message)
 {
     if (mPriv->finished) {
-        if (mPriv->errorName.isEmpty())
+        if (mPriv->errorName.isEmpty()) {
             warning() << this << "trying to fail with" << name <<
-              "but already failed with" << errorName() << ":" <<
-              errorMessage();
-        else
+                "but already failed with" << errorName() << ":" <<
+                errorMessage();
+        } else {
             warning() << this << "trying to fail with" << name <<
-              "but already succeeded";
+                "but already succeeded";
+        }
         return;
     }
 
     if (name.isEmpty()) {
         warning() << this << "should be given a non-empty error name";
         mPriv->errorName = "org.freedesktop.Telepathy.Qt4.ErrorHandlingError";
-    }
-    else {
+    } else {
         mPriv->errorName = name;
     }
 
@@ -124,63 +118,51 @@ void PendingOperation::setFinishedWithError(const QString& name,
     QTimer::singleShot(0, this, SLOT(emitFinished()));
 }
 
-
-void PendingOperation::setFinishedWithError(const QDBusError& error)
+void PendingOperation::setFinishedWithError(const QDBusError &error)
 {
     setFinishedWithError(error.name(), error.message());
 }
 
-
 bool PendingOperation::isValid() const
 {
     return (mPriv->finished && mPriv->errorName.isEmpty());
 }
 
-
 bool PendingOperation::isFinished() const
 {
     return mPriv->finished;
 }
 
-
 bool PendingOperation::isError() const
 {
     return (mPriv->finished && !mPriv->errorName.isEmpty());
 }
 
-
 QString PendingOperation::errorName() const
 {
     return mPriv->errorName;
 }
 
-
 QString PendingOperation::errorMessage() const
 {
     return mPriv->errorMessage;
 }
 
 
-PendingVoidMethodCall::PendingVoidMethodCall(QObject* proxy,
-    QDBusPendingCall call)
-  : PendingOperation(proxy),
-    mPriv(0)
+PendingVoidMethodCall::PendingVoidMethodCall(QObject *proxy,
+        QDBusPendingCall call)
+  : PendingOperation(proxy)
 {
     connect(new QDBusPendingCallWatcher(call),
-        SIGNAL(finished(QDBusPendingCallWatcher*)),
-        this,
-        SLOT(watcherFinished(QDBusPendingCallWatcher*)));
+            SIGNAL(finished(QDBusPendingCallWatcher*)),
+            SLOT(watcherFinished(QDBusPendingCallWatcher*)));
 }
 
-
-void PendingVoidMethodCall::watcherFinished(QDBusPendingCallWatcher* watcher)
+void PendingVoidMethodCall::watcherFinished(QDBusPendingCallWatcher *watcher)
 {
-    if (watcher->isError())
-    {
+    if (watcher->isError()) {
         setFinishedWithError(watcher->error());
-    }
-    else
-    {
+    } else {
         setFinished();
     }
 }
diff --git a/TelepathyQt4/pending-operation.h b/TelepathyQt4/pending-operation.h
index 4445246..fbb876d 100644
--- a/TelepathyQt4/pending-operation.h
+++ b/TelepathyQt4/pending-operation.h
@@ -131,7 +131,7 @@ Q_SIGNALS:
      * \param operation This operation object, from which further information
      *    may be obtained
      */
-    void finished(Tp::PendingOperation* operation);
+    void finished(Tp::PendingOperation *operation);
 
 protected:
     /**
@@ -139,7 +139,7 @@ protected:
      *
      * \param parent The object on which this pending operation takes place
      */
-    PendingOperation(QObject* parent);
+    PendingOperation(QObject *parent);
 
 protected Q_SLOTS:
     /**
@@ -155,7 +155,7 @@ protected Q_SLOTS:
      * \param name A D-Bus error name, which must be non-empty
      * \param message A debugging message
      */
-    void setFinishedWithError(const QString& name, const QString& message);
+    void setFinishedWithError(const QString &name, const QString &message);
 
     /**
      * Record that this pending operation has finished with an error, and
@@ -163,7 +163,7 @@ protected Q_SLOTS:
      *
      * \param error A QtDBus error
      */
-    void setFinishedWithError(const QDBusError& error);
+    void setFinishedWithError(const QDBusError &error);
 
 private Q_SLOTS:
     void emitFinished();
diff --git a/TelepathyQt4/simple-pending-operations.h b/TelepathyQt4/simple-pending-operations.h
index a4579ac..06f1aa9 100644
--- a/TelepathyQt4/simple-pending-operations.h
+++ b/TelepathyQt4/simple-pending-operations.h
@@ -42,7 +42,7 @@ class PendingSuccess : public PendingOperation
     Q_DISABLE_COPY(PendingSuccess)
 
 public:
-    PendingSuccess(QObject* parent)
+    PendingSuccess(QObject *parent)
         : PendingOperation(parent)
     {
         setFinished();
@@ -59,14 +59,14 @@ class PendingFailure : public PendingOperation
     Q_DISABLE_COPY(PendingFailure)
 
 public:
-    PendingFailure(QObject* parent, const QString& name,
-            const QString& message)
+    PendingFailure(QObject *parent, const QString &name,
+            const QString &message)
         : PendingOperation(parent)
     {
         setFinishedWithError(name, message);
     }
 
-    PendingFailure(QObject* parent, const QDBusError& error)
+    PendingFailure(QObject *parent, const QDBusError &error)
         : PendingOperation(parent)
     {
         setFinishedWithError(error);
@@ -95,7 +95,7 @@ public:
      *             Telepathy API; if the method returns anything, the return
      *             value(s) will be ignored
      */
-    PendingVoidMethodCall(QObject* parent, QDBusPendingCall call);
+    PendingVoidMethodCall(QObject *parent, QDBusPendingCall call);
 
 private Q_SLOTS:
     void watcherFinished(QDBusPendingCallWatcher*);
-- 
1.5.6.5




More information about the telepathy-commits mailing list