lib/dbus/ObjectManager: use TypeTraits instead of CPP macro

This commit is contained in:
Max Kellermann
2018-06-03 20:26:15 +02:00
parent d3793dfe5b
commit aea6d354b7
2 changed files with 18 additions and 25 deletions

View File

@@ -21,36 +21,29 @@
#define ODBUS_OBJECT_MANAGER_HXX
#include "ReadIter.hxx"
#include "Types.hxx"
#include <dbus/dbus.h>
#define DBUS_OM_INTERFACE "org.freedesktop.DBus.ObjectManager"
#define DBUS_OM_PROPERTIES_SIGNATURE \
DBUS_TYPE_ARRAY_AS_STRING \
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING \
DBUS_TYPE_STRING_AS_STRING \
DBUS_TYPE_VARIANT_AS_STRING \
DBUS_DICT_ENTRY_END_CHAR_AS_STRING
#define DBUS_OM_INTERFACES_SIGNATURE \
DBUS_TYPE_ARRAY_AS_STRING \
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING \
DBUS_TYPE_STRING_AS_STRING \
DBUS_OM_PROPERTIES_SIGNATURE \
DBUS_DICT_ENTRY_END_CHAR_AS_STRING
#define DBUS_OM_INTERFACES_ADDED_SIGNATURE \
DBUS_TYPE_OBJECT_PATH_AS_STRING \
DBUS_OM_INTERFACES_SIGNATURE
#define DBUS_OM_INTERFACES_REMOVED_SIGNATURE \
DBUS_TYPE_OBJECT_PATH_AS_STRING \
DBUS_TYPE_ARRAY_AS_STRING \
DBUS_TYPE_STRING_AS_STRING
namespace ODBus {
using PropertiesType =
ArrayTypeTraits<DictEntryTypeTraits<StringTypeTraits,
VariantTypeTraits>>;
using InterfacesType =
ArrayTypeTraits<DictEntryTypeTraits<StringTypeTraits,
PropertiesType>>;
using InterfacesAddedType =
ConcatTypeAsString<ObjectPathTypeTraits,
InterfacesType>;
using InterfacesRemovedType = ConcatTypeAsString<ObjectPathTypeTraits,
ArrayTypeTraits<StringTypeTraits>>;
template<typename F>
inline void
RecurseInterfaceDictEntry(ReadMessageIter &&i, F &&f)