diff options
author | Lei YU <mine260309@gmail.com> | 2020-02-03 14:13:16 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2020-02-04 14:57:31 +0800 |
commit | 14db20f044be9faba00e41214d4aa8765b43b355 (patch) | |
tree | 20d82c726b011acac6cd23793e1f344177f03234 | |
parent | 43ea426d71e70a2fec3aab27dfa5ad6de0e9fbfd (diff) | |
download | sdbusplus-14db20f044be9faba00e41214d4aa8765b43b355.tar.gz sdbusplus-14db20f044be9faba00e41214d4aa8765b43b355.zip |
Make interface string public
The interface string was private, and the users of sdbusplus have to
define their own strings for the D-Bus interfaces.
By making the interface string public, users do not have to define their
own and the generated string could be used instead.
E.g. one could directly use "Calculator::interface" instead of
"net.poettering.Calculator" in the example.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I0846d4e0609c8588d81e8a19bdd69fd79df83848
-rw-r--r-- | tools/sdbusplus/templates/interface.mako.server.cpp.in | 2 | ||||
-rw-r--r-- | tools/sdbusplus/templates/interface.mako.server.hpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/tools/sdbusplus/templates/interface.mako.server.cpp.in b/tools/sdbusplus/templates/interface.mako.server.cpp.in index 5af2749..060e32c 100644 --- a/tools/sdbusplus/templates/interface.mako.server.cpp.in +++ b/tools/sdbusplus/templates/interface.mako.server.cpp.in @@ -29,7 +29,7 @@ namespace server ${classname}::${classname}(bus::bus& bus, const char* path) : _${interface_instance()}( - bus, path, _interface, _vtable, this), _intf(bus.getInterface()) + bus, path, interface, _vtable, this), _intf(bus.getInterface()) { } diff --git a/tools/sdbusplus/templates/interface.mako.server.hpp b/tools/sdbusplus/templates/interface.mako.server.hpp index e5b17ea..a04c02e 100644 --- a/tools/sdbusplus/templates/interface.mako.server.hpp +++ b/tools/sdbusplus/templates/interface.mako.server.hpp @@ -121,6 +121,8 @@ ${p.camelCase}(${p.cppTypeParam(interface.name)} value); static ${e.name} convert${e.name}FromString(const std::string& s); % endfor + static constexpr auto interface = "${interface.name}"; + private: % for m in interface.methods: ${ m.cpp_prototype(loader, interface=interface, ptype='callback-header') } @@ -138,7 +140,6 @@ ${ m.cpp_prototype(loader, interface=interface, ptype='callback-header') } % endfor - static constexpr auto _interface = "${interface.name}"; static const vtable::vtable_t _vtable[]; sdbusplus::server::interface::interface _${"_".join(interface.name.split('.'))}_interface; |