sdbus++: interface: simplify client.hpp

Use C++17 nested-namespace definition to simplify the header file.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I285f0d0b939b9b448b9117eb185ea6dd3f6eff49
diff --git a/tools/sdbusplus/interface.py b/tools/sdbusplus/interface.py
index e28425b..f35d0e3 100644
--- a/tools/sdbusplus/interface.py
+++ b/tools/sdbusplus/interface.py
@@ -34,11 +34,11 @@
         self.namespaces = self.name.split(".")
         self.classname = self.namespaces.pop()
 
-    def cppNamespace(self):
-        return "::".join(self.namespaces) + "::server"
+    def cppNamespace(self, typename="server"):
+        return "::".join(self.namespaces) + "::" + typename
 
-    def cppNamespacedClass(self):
-        return self.cppNamespace() + "::" + self.classname
+    def cppNamespacedClass(self, typename="server"):
+        return self.cppNamespace(typename) + "::" + self.classname
 
     def joinedName(self, join_str, append):
         return join_str.join(self.namespaces + [self.classname, append])
diff --git a/tools/sdbusplus/templates/interface.client.hpp.mako b/tools/sdbusplus/templates/interface.client.hpp.mako
index 78f7125..38c5be0 100644
--- a/tools/sdbusplus/templates/interface.client.hpp.mako
+++ b/tools/sdbusplus/templates/interface.client.hpp.mako
@@ -1,21 +1,8 @@
 #pragma once
 
-namespace sdbusplus
-{
-% for s in interface.namespaces:
-namespace ${s}
-{
-% endfor
-namespace client
-{
-namespace ${interface.classname}
+namespace sdbusplus::${interface.cppNamespacedClass("client")}
 {
 
 static constexpr auto interface = "${interface.name}";
 
-} // namespace ${interface.classname}
-} // namespace client
-% for s in reversed(interface.namespaces):
-} // namespace ${s}
-% endfor
-} // namespace sdbusplus
+} // namespace sdbusplus::${interface.cppNamespacedClass("client")}