settings: handle multiple objects/interfaces

Handle the fact that a settings object can now implement multiple
interfaces, and also the fact that multiple settings objects
can implement the same interface.

Change-Id: Icf55b08fe2d355a10f7007489dfddb128e05d90e
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/settings.cpp b/settings.cpp
index cb86d99..59f9f33 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -46,8 +46,19 @@
     for (auto& iter : result)
     {
         const auto& path = iter.first;
-        auto& interface = iter.second.begin()->second[0];
-        map.emplace(std::move(interface), path);
+        for (auto& interface : iter.second.begin()->second)
+        {
+            auto found = map.find(interface);
+            if (map.end() != found)
+            {
+                auto& paths = found->second;
+                paths.push_back(path);
+            }
+            else
+            {
+                map.emplace(std::move(interface), std::vector<Path>({path}));
+            }
+        }
     }
 }