diff --git a/src/blackmisc/blackmiscfreefunctions.h b/src/blackmisc/blackmiscfreefunctions.h index 45f568661..5c4d3f3b2 100644 --- a/src/blackmisc/blackmiscfreefunctions.h +++ b/src/blackmisc/blackmiscfreefunctions.h @@ -198,4 +198,23 @@ namespace BlackMisc } // BlackMisc +/*! + * \brief Macro to make a ENUMs DBus streamable. + * \details Put this macro outside of any namespace, in the same header as the class defining the enumeration. + * \param ENUM The fully qualified name of the enumeration. + * \hideinitializer + * \ingroup Tuples + */ +#define BLACK_DBUS_ENUM_MARSHALLING(ENUM) \ + namespace BlackMisc \ + { \ + inline const QDBusArgument &operator >>(const QDBusArgument &arg, ENUM &enumType) \ + { \ + uint e; \ + arg >> e; \ + enumType = static_cast(e); \ + return arg; \ + }; \ + } + #endif // guard