fix: make REGISTER_STRUCT functions inline

This makes that you can use these macros in headers as well as
source files.
Else you will get a warning about multiple definitions of the same
function.
This commit is contained in:
Marcel Hellwig
2024-05-13 12:05:56 +02:00
committed by Stanislav Angelovič
parent 3d3aa26255
commit 50cc636058

View File

@ -437,11 +437,11 @@ struct std::tuple_size<sdbus::Struct<_ValueTypes...>>
namespace sdbus { \
static_assert(SDBUSCPP_PP_NARG(__VA_ARGS__) <= 16, \
"Not more than 16 struct members are supported, please open an issue if you need more"); \
sdbus::Message& operator<<(sdbus::Message& msg, const STRUCT& items) \
inline sdbus::Message& operator<<(sdbus::Message& msg, const STRUCT& items) \
{ \
return msg << sdbus::Struct{std::forward_as_tuple(SDBUSCPP_STRUCT_MEMBERS(items, __VA_ARGS__))}; \
} \
sdbus::Message& operator>>(sdbus::Message& msg, STRUCT& items) \
inline sdbus::Message& operator>>(sdbus::Message& msg, STRUCT& items) \
{ \
sdbus::Struct s{std::forward_as_tuple(SDBUSCPP_STRUCT_MEMBERS(items, __VA_ARGS__))}; \
return msg >> s; \