merge with master
[platform/framework/web/wrt-plugins-common.git] / src / plugins-api-support / CallbackSupport.h
index f460fd1..bcaa849 100644 (file)
 #include <string>
 #include <dpl/foreach.h>
 
-namespace WrtPluginsApi
-{
-
+namespace WrtPluginsApi {
 template<typename Sig>
 class CallbackSupport
 {
-public:
+  public:
     typedef typename Sig::Signature SlotSignature;
     typedef typename Sig::Type SlotType;
     typedef std::string GroupType;
@@ -41,8 +39,7 @@ public:
     void Connect(const GroupType& group, const SlotType& slot)
     {
         auto groupIt = m_slots.find(group);
-        if (m_slots.end() == groupIt)
-        {
+        if (m_slots.end() == groupIt) {
             groupIt = m_slots.insert(std::make_pair(group, SlotList())).first;
         }
         groupIt->second.push_back(slot);
@@ -53,36 +50,33 @@ public:
         m_slots.erase(group);
     }
 
-    template<typename...Args>
-    void Invoke(const Args&... args)
+    template<typename ... Args>
+    void Invoke(const Args& ... args)
     {
-
         FOREACH(groupIt, m_slots)
         {
             FOREACH(slotIt, groupIt->second)
             {
-                (*slotIt)(args...);
+                (*slotIt)(args ...);
             }
         }
     }
 
-    template<typename...Args>
-    void InvokeGroup(const GroupType& group, const Args&... args)
+    template<typename ... Args>
+    void InvokeGroup(const GroupType& group, const Args& ... args)
     {
         auto groupIt = m_slots.find(group);
 
-        if (m_slots.end() != groupIt)
-        {
-            FOREACH (slotIt, groupIt->second)
+        if (m_slots.end() != groupIt) {
+            FOREACH(slotIt, groupIt->second)
             {
-                (*slotIt)(args...);
+                (*slotIt)(args ...);
             }
         }
     }
 
-private:
+  private:
     std::map<GroupType, SlotList> m_slots;
 };
-
 }
 #endif