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

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


---
 TelepathyQt4/referenced-handles.cpp |   79 ++++++----
 TelepathyQt4/referenced-handles.h   |  302 +++++++++++++++++-----------------
 2 files changed, 197 insertions(+), 184 deletions(-)

diff --git a/TelepathyQt4/referenced-handles.cpp b/TelepathyQt4/referenced-handles.cpp
index 6ae26cf..a727629 100644
--- a/TelepathyQt4/referenced-handles.cpp
+++ b/TelepathyQt4/referenced-handles.cpp
@@ -43,17 +43,18 @@ struct ReferencedHandles::Private : public QSharedData
     }
 
     Private(const ConnectionPtr &connection, uint handleType,
-            const UIntList& handles)
+            const UIntList &handles)
         : connection(connection), handleType(handleType), handles(handles)
     {
         Q_ASSERT(connection);
         Q_ASSERT(handleType != 0);
 
-        foreach (uint handle, handles)
+        foreach (uint handle, handles) {
             connection->refHandle(handleType, handle);
+        }
     }
 
-    Private(const Private& a)
+    Private(const Private &a)
         : QSharedData(a),
           connection(a.connection),
           handleType(a.handleType),
@@ -61,14 +62,13 @@ struct ReferencedHandles::Private : public QSharedData
     {
         if (!handles.isEmpty()) {
             if (!connection) {
-                debug() << "  Destroyed after Connection, so the Connection has already released the handles";
+                debug() << "  Destroyed after Connection, so the Connection "
+                    "has already released the handles";
                 return;
             }
 
             ConnectionPtr conn(connection);
-            for (const_iterator i = handles.begin();
-                                i != handles.end();
-                                ++i) {
+            for (const_iterator i = handles.begin(); i != handles.end(); ++i) {
                 conn->refHandle(handleType, *i);
             }
         }
@@ -78,14 +78,13 @@ struct ReferencedHandles::Private : public QSharedData
     {
         if (!handles.isEmpty()) {
             if (!connection) {
-                debug() << "  Destroyed after Connection, so the Connection has already released the handles";
+                debug() << "  Destroyed after Connection, so the Connection "
+                    "has already released the handles";
                 return;
             }
 
             ConnectionPtr conn(connection);
-            for (const_iterator i = handles.begin();
-                                i != handles.end();
-                                ++i) {
+            for (const_iterator i = handles.begin(); i != handles.end(); ++i) {
                 conn->unrefHandle(handleType, *i);
             }
         }
@@ -100,7 +99,7 @@ ReferencedHandles::ReferencedHandles()
 {
 }
 
-ReferencedHandles::ReferencedHandles(const ReferencedHandles& other)
+ReferencedHandles::ReferencedHandles(const ReferencedHandles &other)
     : mPriv(other.mPriv)
 {
 }
@@ -166,7 +165,8 @@ int ReferencedHandles::lastIndexOf(uint handle, int from) const
 
 ReferencedHandles ReferencedHandles::mid(int pos, int length) const
 {
-    return ReferencedHandles(connection(), handleType(), mPriv->handles.mid(pos, length));
+    return ReferencedHandles(connection(), handleType(),
+            mPriv->handles.mid(pos, length));
 }
 
 int ReferencedHandles::size() const
@@ -183,7 +183,8 @@ void ReferencedHandles::clear()
                 conn->unrefHandle(handleType(), handle);
             }
         } else {
-            warning() << "Connection already destroyed in ReferencedHandles::clear() so can't unref!";
+            warning() << "Connection already destroyed in "
+                "ReferencedHandles::clear() so can't unref!";
         }
     }
 
@@ -202,11 +203,13 @@ int ReferencedHandles::removeAll(uint handle)
     if (count > 0) {
         if (mPriv->connection) {
             ConnectionPtr conn(mPriv->connection);
-            for (int i = 0; i < count; i++) {
+            for (int i = 0; i < count; ++i) {
                 conn->unrefHandle(handleType(), handle);
             }
         } else {
-            warning() << "Connection already destroyed in ReferencedHandles::removeAll() with handle ==" << handle << "so can't unref!";
+            warning() << "Connection already destroyed in "
+                "ReferencedHandles::removeAll() with handle ==" <<
+                handle << "so can't unref!";
         }
     }
 
@@ -218,9 +221,11 @@ void ReferencedHandles::removeAt(int i)
     if (mPriv->connection) {
         ConnectionPtr conn(mPriv->connection);
         conn->unrefHandle(handleType(), at(i));
+    } else {
+        warning() << "Connection already destroyed in "
+            "ReferencedHandles::removeAt() with i ==" <<
+            i << "so can't unref!";
     }
-    else
-        warning() << "Connection already destroyed in ReferencedHandles::removeAt() with i ==" << i << "so can't unref!";
 
     mPriv->handles.removeAt(i);
 }
@@ -233,9 +238,11 @@ bool ReferencedHandles::removeOne(uint handle)
         if (mPriv->connection) {
             ConnectionPtr conn(mPriv->connection);
             conn->unrefHandle(handleType(), handle);
+        } else {
+            warning() << "Connection already destroyed in "
+                "ReferencedHandles::removeOne() with handle ==" <<
+                handle << "so can't unref!";
         }
-        else
-            warning() << "Connection already destroyed in ReferencedHandles::removeOne() with handle ==" << handle << "so can't unref!";
     }
 
     return wasThere;
@@ -251,37 +258,43 @@ uint ReferencedHandles::takeAt(int i)
     if (mPriv->connection) {
         ConnectionPtr conn(mPriv->connection);
         conn->unrefHandle(handleType(), at(i));
+    } else {
+        warning() << "Connection already destroyed in "
+            "ReferencedHandles::takeAt() with i ==" <<
+            i << "so can't unref!";
     }
-    else
-        warning() << "Connection already destroyed in ReferencedHandles::takeAt() with i ==" << i << "so can't unref!";
 
     return mPriv->handles.takeAt(i);
 }
 
-ReferencedHandles ReferencedHandles::operator+(const ReferencedHandles& another) const
+ReferencedHandles ReferencedHandles::operator+(const ReferencedHandles &another) const
 {
-    if (connection() != another.connection() || handleType() != another.handleType()) {
-        warning() << "Tried to concatenate ReferencedHandles instances with different connection and/or handle type";
+    if (connection() != another.connection() ||
+        handleType() != another.handleType()) {
+        warning() << "Tried to concatenate ReferencedHandles instances "
+            "with different connection and/or handle type";
         return *this;
     }
 
-    return ReferencedHandles(connection(), handleType(), mPriv->handles + another.mPriv->handles);
+    return ReferencedHandles(connection(), handleType(),
+            mPriv->handles + another.mPriv->handles);
 }
 
-ReferencedHandles& ReferencedHandles::operator=(const ReferencedHandles& another)
+ReferencedHandles &ReferencedHandles::operator=(
+        const ReferencedHandles &another)
 {
     mPriv = another.mPriv;
     return *this;
 }
 
-bool ReferencedHandles::operator==(const ReferencedHandles& another) const
+bool ReferencedHandles::operator==(const ReferencedHandles &another) const
 {
-    return connection() == another.connection()
-        && handleType() == another.handleType()
-        && mPriv->handles == another.mPriv->handles;
+    return connection() == another.connection() &&
+        handleType() == another.handleType() &&
+        mPriv->handles == another.mPriv->handles;
 }
 
-bool ReferencedHandles::operator==(const UIntList& list) const
+bool ReferencedHandles::operator==(const UIntList &list) const
 {
     return mPriv->handles == list;
 }
@@ -292,7 +305,7 @@ UIntList ReferencedHandles::toList() const
 }
 
 ReferencedHandles::ReferencedHandles(const ConnectionPtr &connection,
-        uint handleType, const UIntList& handles)
+        uint handleType, const UIntList &handles)
     : mPriv(new Private(connection, handleType, handles))
 {
 }
diff --git a/TelepathyQt4/referenced-handles.h b/TelepathyQt4/referenced-handles.h
index 36cc700..a740bba 100644
--- a/TelepathyQt4/referenced-handles.h
+++ b/TelepathyQt4/referenced-handles.h
@@ -82,211 +82,211 @@ class Connection;
  */
 class ReferencedHandles
 {
-    public:
-        typedef UIntList::const_iterator const_iterator;
-        typedef UIntList::ConstIterator ConstIterator;
-        typedef UIntList::const_pointer const_pointer;
-        typedef UIntList::const_reference const_reference;
-        typedef UIntList::difference_type difference_type;
-        typedef UIntList::pointer pointer;
-        typedef UIntList::reference reference;
-        typedef UIntList::size_type size_type;
-        typedef UIntList::value_type value_type;
+public:
+    typedef UIntList::const_iterator const_iterator;
+    typedef UIntList::ConstIterator ConstIterator;
+    typedef UIntList::const_pointer const_pointer;
+    typedef UIntList::const_reference const_reference;
+    typedef UIntList::difference_type difference_type;
+    typedef UIntList::pointer pointer;
+    typedef UIntList::reference reference;
+    typedef UIntList::size_type size_type;
+    typedef UIntList::value_type value_type;
 
-        ReferencedHandles();
-        ReferencedHandles(const ReferencedHandles& other);
-        ~ReferencedHandles();
+    ReferencedHandles();
+    ReferencedHandles(const ReferencedHandles& other);
+    ~ReferencedHandles();
 
-        ConnectionPtr connection() const;
-        uint handleType() const;
+    ConnectionPtr connection() const;
+    uint handleType() const;
 
-        uint at(int i) const;
+    uint at(int i) const;
 
-        inline uint back() const
-        {
-            return last();
-        }
+    inline uint back() const
+    {
+        return last();
+    }
 
-        inline uint first() const
-        {
-            return at(0);
-        }
+    inline uint first() const
+    {
+        return at(0);
+    }
 
-        inline uint front() const
-        {
-            return first();
-        }
+    inline uint front() const
+    {
+        return first();
+    }
 
-        inline uint last() const
-        {
-            return at(size() - 1);
-        }
+    inline uint last() const
+    {
+        return at(size() - 1);
+    }
 
-        uint value(int i, uint defaultValue = 0) const;
+    uint value(int i, uint defaultValue = 0) const;
 
-        const_iterator begin() const;
+    const_iterator begin() const;
 
-        inline const_iterator constBegin() const
-        {
-            return begin();
-        }
+    inline const_iterator constBegin() const
+    {
+        return begin();
+    }
 
-        inline const_iterator constEnd() const
-        {
-            return end();
-        }
+    inline const_iterator constEnd() const
+    {
+        return end();
+    }
 
-        const_iterator end() const;
+    const_iterator end() const;
 
-        bool contains(uint handle) const;
+    bool contains(uint handle) const;
 
-        int count(uint handle) const;
+    int count(uint handle) const;
 
-        inline int count() const
-        {
-            return size();
-        }
+    inline int count() const
+    {
+        return size();
+    }
 
-        inline bool empty() const
-        {
-            return isEmpty();
-        }
+    inline bool empty() const
+    {
+        return isEmpty();
+    }
 
-        inline bool endsWith(uint handle) const
-        {
-            return !isEmpty() && last() == handle;
-        }
+    inline bool endsWith(uint handle) const
+    {
+        return !isEmpty() && last() == handle;
+    }
 
-        int indexOf(uint handle, int from = 0) const;
+    int indexOf(uint handle, int from = 0) const;
 
-        bool isEmpty() const;
+    bool isEmpty() const;
 
-        int lastIndexOf(uint handle, int from = -1) const;
+    int lastIndexOf(uint handle, int from = -1) const;
 
-        inline int length() const
-        {
-            return count();
-        }
+    inline int length() const
+    {
+        return count();
+    }
 
-        ReferencedHandles mid(int pos, int length = -1) const;
+    ReferencedHandles mid(int pos, int length = -1) const;
 
-        int size() const;
+    int size() const;
 
-        inline bool startsWith(uint handle) const
-        {
-            return !isEmpty() && first() == handle;
-        }
+    inline bool startsWith(uint handle) const
+    {
+        return !isEmpty() && first() == handle;
+    }
 
-        inline void append(const ReferencedHandles& another)
-        {
-            *this = *this + another;
-        }
+    inline void append(const ReferencedHandles& another)
+    {
+        *this = *this + another;
+    }
 
-        void clear();
-        void move(int from, int to);
+    void clear();
+    void move(int from, int to);
 
-        inline void pop_back()
-        {
-            return removeLast();
-        }
+    inline void pop_back()
+    {
+        return removeLast();
+    }
 
-        inline void pop_front()
-        {
-            return removeFirst();
-        }
+    inline void pop_front()
+    {
+        return removeFirst();
+    }
 
-        int removeAll(uint handle);
+    int removeAll(uint handle);
 
-        void removeAt(int i);
+    void removeAt(int i);
 
-        inline void removeFirst()
-        {
-            return removeAt(0);
-        }
+    inline void removeFirst()
+    {
+        return removeAt(0);
+    }
 
-        inline void removeLast()
-        {
-            return removeAt(size() - 1);
-        }
+    inline void removeLast()
+    {
+        return removeAt(size() - 1);
+    }
 
-        bool removeOne(uint handle);
+    bool removeOne(uint handle);
 
-        void swap(int i, int j);
+    void swap(int i, int j);
 
-        uint takeAt(int i);
+    uint takeAt(int i);
 
-        inline uint takeFirst()
-        {
-            return takeAt(0);
-        }
+    inline uint takeFirst()
+    {
+        return takeAt(0);
+    }
 
-        inline uint takeLast()
-        {
-            return takeAt(size() - 1);
-        }
+    inline uint takeLast()
+    {
+        return takeAt(size() - 1);
+    }
 
-        bool operator!=(const ReferencedHandles& another) const
-        {
-            return !(*this == another);
-        }
+    bool operator!=(const ReferencedHandles& another) const
+    {
+        return !(*this == another);
+    }
 
-        bool operator!=(const UIntList& another) const
-        {
-            return !(*this == another);
-        }
+    bool operator!=(const UIntList& another) const
+    {
+        return !(*this == another);
+    }
 
-        ReferencedHandles operator+(const ReferencedHandles& another) const;
+    ReferencedHandles operator+(const ReferencedHandles& another) const;
 
-        inline ReferencedHandles& operator+=(const ReferencedHandles& another)
-        {
-            return *this = (*this + another);
-        }
+    inline ReferencedHandles& operator+=(const ReferencedHandles& another)
+    {
+        return *this = (*this + another);
+    }
 
-        ReferencedHandles& operator<<(const ReferencedHandles& another)
-        {
-            return *this += another;
-        }
+    ReferencedHandles& operator<<(const ReferencedHandles& another)
+    {
+        return *this += another;
+    }
 
-        ReferencedHandles& operator=(const ReferencedHandles& another);
+    ReferencedHandles& operator=(const ReferencedHandles& another);
 
-        bool operator==(const ReferencedHandles& another) const;
-        bool operator==(const UIntList& list) const;
+    bool operator==(const ReferencedHandles& another) const;
+    bool operator==(const UIntList& list) const;
 
-        inline uint operator[](int i) const
-        {
-            return at(i);
-        }
+    inline uint operator[](int i) const
+    {
+        return at(i);
+    }
 
-        UIntList toList() const;
+    UIntList toList() const;
 
-        inline QSet<uint> toSet() const
-        {
-            return toList().toSet();
-        }
+    inline QSet<uint> toSet() const
+    {
+        return toList().toSet();
+    }
 
 #ifndef QT_NO_STL
-        inline std::list<uint> toStdList() const
-        {
-            return toList().toStdList();
-        }
+    inline std::list<uint> toStdList() const
+    {
+        return toList().toStdList();
+    }
 #endif
 
-        inline QVector<uint> toVector() const
-        {
-            return toList().toVector();
-        }
+    inline QVector<uint> toVector() const
+    {
+        return toList().toVector();
+    }
 
-    private:
-        // For access to the "prime" constructor
-        friend class PendingContactAttributes;
-        friend class PendingContacts;
-        friend class PendingHandles;
+private:
+    // For access to the "prime" constructor
+    friend class PendingContactAttributes;
+    friend class PendingContacts;
+    friend class PendingHandles;
 
-        ReferencedHandles(const ConnectionPtr &connection,
-                uint handleType, const UIntList& handles);
+    ReferencedHandles(const ConnectionPtr &connection,
+            uint handleType, const UIntList& handles);
 
-        struct Private;
-        QSharedDataPointer<Private> mPriv;
+    struct Private;
+    QSharedDataPointer<Private> mPriv;
 };
 
 typedef QListIterator<uint> ReferencedHandlesIterator;
-- 
1.5.6.5




More information about the telepathy-commits mailing list