6 #ifndef SWIFT_MISC_MIXIN_MIXINDBUS_H
7 #define SWIFT_MISC_MIXIN_MIXINDBUS_H
11 #include <QDBusArgument>
37 template <
class Derived,
class...>
42 friend const QDBusArgument &
operator>>(
const QDBusArgument &arg, Derived &obj)
45 obj.unmarshallFromDbus(arg);
51 friend QDBusArgument &
operator<<(QDBusArgument &arg,
const Derived &obj)
54 obj.marshallToDbus(arg);
59 template <
class Derived>
69 template <
class Derived,
class... Tags>
80 const Derived *derived()
const;
84 static void baseMarshall(
const T *base, QDBusArgument &arg);
86 static void baseUnmarshall(T *base,
const QDBusArgument &arg);
87 static void baseMarshall(
const void *, QDBusArgument &);
88 static void baseUnmarshall(
void *,
const QDBusArgument &);
89 static void baseMarshall(
const CEmpty *, QDBusArgument &);
90 static void baseUnmarshall(
CEmpty *,
const QDBusArgument &);
93 template <
class Derived,
class... Tags>
97 introspect<Derived>().forEachMember([&,
this](
auto member) {
100 const auto &value = member.in(*this->derived());
107 else { value.marshallToDbus(arg); }
109 else { arg << value; }
114 template <
class Derived,
class... Tags>
118 introspect<Derived>().forEachMember([&,
this](
auto member) {
121 auto &value = member.in(*this->derived());
128 else { value.unmarshallFromDbus(arg); }
130 else { arg >> value; }
135 template <
class Derived,
class... Tags>
138 return static_cast<const Derived *
>(
this);
141 template <
class Derived,
class... Tags>
142 Derived *DBusByMetaClass<Derived, Tags...>::derived()
144 return static_cast<Derived *
>(
this);
147 template <
class Derived,
class... Tags>
148 template <
typename T>
149 void DBusByMetaClass<Derived, Tags...>::baseMarshall(
const T *base, QDBusArgument &arg)
154 template <
class Derived,
class... Tags>
155 template <
typename T>
156 void DBusByMetaClass<Derived, Tags...>::baseUnmarshall(T *base,
const QDBusArgument &arg)
158 base->unmarshallFromDbus(arg, Tags()...);
161 template <
class Derived,
class... Tags>
162 void DBusByMetaClass<Derived, Tags...>::baseMarshall(
const void *, QDBusArgument &)
165 template <
class Derived,
class... Tags>
166 void DBusByMetaClass<Derived, Tags...>::baseUnmarshall(
void *,
const QDBusArgument &)
169 template <
class Derived,
class... Tags>
170 void DBusByMetaClass<Derived, Tags...>::baseMarshall(
const CEmpty *, QDBusArgument &)
173 template <
class Derived,
class... Tags>
174 void DBusByMetaClass<Derived, Tags...>::baseUnmarshall(CEmpty *,
const QDBusArgument &)
182 #define SWIFT_MISC_DECLARE_USING_MIXIN_DBUS(DERIVED, ...) \
183 using ::swift::misc::mixin::DBusByMetaClass<DERIVED SWIFT_TRAILING_VA_ARGS(__VA_ARGS__)>::marshallToDbus; \
184 using ::swift::misc::mixin::DBusByMetaClass<DERIVED SWIFT_TRAILING_VA_ARGS(__VA_ARGS__)>::unmarshallFromDbus;
Default base class for CValueObject.
Tag type signifying overloaded marshalling methods that preserve data at the expense of size.
CRTP class template which will generate marshalling operators for a derived class with its own marsha...
friend const QDBusArgument & operator>>(const QDBusArgument &arg, Derived &obj)
Unmarshalling operator >>, DBus to object.
friend QDBusArgument & operator<<(QDBusArgument &arg, const Derived &obj)
Marshalling operator <<, object to DBus.
Free functions in swift::misc.
typename TBaseOf< T >::type TBaseOfT
Alias for typename TBaseOf<T>::type.
Trait which is true if T has methods marshallToDbus and unmarshallFromDbus.