formatting is changed according to last astyle settings
[qtrapids] / src / include / qtrapids / dbus.hpp
index c7e91c4..79d1cd5 100644 (file)
 namespace qtrapids
 {
 
-struct TorrentState
-{
-
-    enum torrent_action
-    {
-        action_add,
-        action_remove,
-        action_update
-    };
-
-    TorrentState()
-            : hash("")
-            , name("")
-            , state(0)
-            , progress(0)
-            , down_rate(0)
-            , up_rate(0)
-            , seeds(0)
-            , leeches(0)
-            , ratio(0)
-            , total_size(0)
-    { }
-
-    QString hash;
-    QString name;
-    torrent_action action;
-    uint state;
-    uint progress;
-    uint down_rate;
-    uint up_rate;
-    uint seeds;
-    uint leeches;
-    uint ratio;
-    qulonglong total_size;
+struct TorrentState {
+
+       enum torrent_action {
+               action_add,
+               action_remove,
+               action_update
+       };
+
+       TorrentState()
+                       : hash("")
+                       , name("")
+                       , state(0)
+                       , progress(0)
+                       , down_rate(0)
+                       , up_rate(0)
+                       , seeds(0)
+                       , leeches(0)
+                       , ratio(0)
+                       , total_size(0) { }
+
+       QString hash;
+       QString name;
+       torrent_action action;
+       uint state;
+       uint progress;
+       uint down_rate;
+       uint up_rate;
+       uint seeds;
+       uint leeches;
+       uint ratio;
+       qulonglong total_size;
 };
 
 typedef QHash<QString, QString> ParamsMap_t;
@@ -55,61 +52,59 @@ typedef QHash<QString, QString>::const_iterator ParamsMapConstIterator_t;
 static inline QDBusArgument& operator << (QDBusArgument& argument
         , TorrentState const& state)
 {
-    std::cout << "serialize" << std::endl;
-    argument.beginStructure();
-    argument << state.hash << state.name << (uint)(state.action) << state.state << state.progress
-    << state.down_rate << state.up_rate << state.seeds
-    << state.leeches << state.ratio << state.total_size;
-    argument.endStructure();
-    return argument;
+       std::cout << "serialize" << std::endl;
+       argument.beginStructure();
+       argument << state.hash << state.name << (uint)(state.action) << state.state << state.progress
+       << state.down_rate << state.up_rate << state.seeds
+       << state.leeches << state.ratio << state.total_size;
+       argument.endStructure();
+       return argument;
 }
 
 static inline QDBusArgument const& operator >> (QDBusArgument const& argument
         , TorrentState& state)
 {
-    std::cout << "deserialize" << std::endl;
-    argument.beginStructure();
-    uint action;
-    argument >> state.hash >> state.name >> action >> state.state >> state.progress
-    >> state.down_rate >> state.up_rate >> state.seeds
-    >> state.leeches >> state.ratio >> state.total_size;
-    state.action = (TorrentState::torrent_action)action;
-    argument.endStructure();
-    return argument;
+       std::cout << "deserialize" << std::endl;
+       argument.beginStructure();
+       uint action;
+       argument >> state.hash >> state.name >> action >> state.state >> state.progress
+       >> state.down_rate >> state.up_rate >> state.seeds
+       >> state.leeches >> state.ratio >> state.total_size;
+       state.action = (TorrentState::torrent_action)action;
+       argument.endStructure();
+       return argument;
 }
 
 static inline QDBusArgument& operator << (QDBusArgument& argument
         , ParamsMapConst_t& params)
 {
-    ParamsMapConstIterator_t p;
-    std::cout << "serialize params" << std::endl;
-    argument.beginMap();
-    for (p = params.constBegin(); p != params.constEnd(); ++p)
-    {
-        argument.beginMapEntry();
-        argument << p.key() << p.value();
-        argument.endMapEntry();
-    }
-    argument.endMap();
-    return argument;
+       ParamsMapConstIterator_t p;
+       std::cout << "serialize params" << std::endl;
+       argument.beginMap();
+       for (p = params.constBegin(); p != params.constEnd(); ++p) {
+               argument.beginMapEntry();
+               argument << p.key() << p.value();
+               argument.endMapEntry();
+       }
+       argument.endMap();
+       return argument;
 }
 
 static inline QDBusArgument const& operator >> (QDBusArgument const& argument
         , ParamsMap_t& params)
 {
-    ParamsMapConstIterator_t p;
-    QString key, value;
-    std::cout << "deserialize params" << std::endl;
-    argument.beginMap();
-    for (p = params.constBegin(); p != params.constEnd(); ++p)
-    {
-        argument.beginMapEntry();
-        argument >> key >> value;
-        params[key] = value;
-        argument.endMapEntry();
-    }
-    argument.endMap();
-    return argument;
+       ParamsMapConstIterator_t p;
+       QString key, value;
+       std::cout << "deserialize params" << std::endl;
+       argument.beginMap();
+       for (p = params.constBegin(); p != params.constEnd(); ++p) {
+               argument.beginMapEntry();
+               argument >> key >> value;
+               params[key] = value;
+               argument.endMapEntry();
+       }
+       argument.endMap();
+       return argument;
 }