mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 19:35:32 +08:00
Ref T597 Generic DBus marshalling operators for QFlags.
This commit is contained in:
@@ -160,6 +160,32 @@ const QDBusArgument &operator >>(const QDBusArgument &arg, E &value)
|
||||
return arg;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Operator for streaming QFlags to QDBusArgument.
|
||||
*/
|
||||
template <class T>
|
||||
QDBusArgument &operator <<(QDBusArgument &arg, const QFlags<T> &value)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << static_cast<typename QFlags<T>::Int>(value);
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Operator for streaming QFlags from QDBusArgument.
|
||||
*/
|
||||
template <class T>
|
||||
const QDBusArgument &operator >>(const QDBusArgument &arg, QFlags<T> &value)
|
||||
{
|
||||
typename QFlags<T>::Int temp = 0;
|
||||
arg.beginStructure();
|
||||
arg >> temp;
|
||||
arg.endStructure();
|
||||
value = static_cast<QFlags<T>>(temp);
|
||||
return arg;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Operator for streaming pairs to QDBusArgument.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user