mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +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;
|
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.
|
* Operator for streaming pairs to QDBusArgument.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,28 +46,4 @@ Q_DECLARE_METATYPE(BlackMisc::Simulation::MatchingLog)
|
|||||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::MatchingLogFlag)
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::MatchingLogFlag)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::MatchingLog)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::MatchingLog)
|
||||||
|
|
||||||
/*!
|
|
||||||
* Operator for streaming enums to QDBusArgument.
|
|
||||||
*/
|
|
||||||
inline QDBusArgument &operator <<(QDBusArgument &arg, const BlackMisc::Simulation::MatchingLog &value)
|
|
||||||
{
|
|
||||||
arg.beginStructure();
|
|
||||||
arg << static_cast<int>(value);
|
|
||||||
arg.endStructure();
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Operator for streaming enums from QDBusArgument.
|
|
||||||
*/
|
|
||||||
inline const QDBusArgument &operator >>(const QDBusArgument &arg, BlackMisc::Simulation::MatchingLog &value)
|
|
||||||
{
|
|
||||||
int temp;
|
|
||||||
arg.beginStructure();
|
|
||||||
arg >> temp;
|
|
||||||
arg.endStructure();
|
|
||||||
value = static_cast<BlackMisc::Simulation::MatchingLog>(temp);
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -34,28 +34,4 @@ Q_DECLARE_METATYPE(BlackMisc::Simulation::ReverseLookupLogging)
|
|||||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::ReverseLookupLoggingFlag)
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::ReverseLookupLoggingFlag)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::ReverseLookupLogging)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::ReverseLookupLogging)
|
||||||
|
|
||||||
/*!
|
|
||||||
* Operator for streaming enums to QDBusArgument.
|
|
||||||
*/
|
|
||||||
inline QDBusArgument &operator <<(QDBusArgument &arg, const BlackMisc::Simulation::ReverseLookupLogging &value)
|
|
||||||
{
|
|
||||||
arg.beginStructure();
|
|
||||||
arg << static_cast<int>(value);
|
|
||||||
arg.endStructure();
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Operator for streaming enums from QDBusArgument.
|
|
||||||
*/
|
|
||||||
inline const QDBusArgument &operator >>(const QDBusArgument &arg, BlackMisc::Simulation::ReverseLookupLogging &value)
|
|
||||||
{
|
|
||||||
int temp;
|
|
||||||
arg.beginStructure();
|
|
||||||
arg >> temp;
|
|
||||||
arg.endStructure();
|
|
||||||
value = static_cast<BlackMisc::Simulation::ReverseLookupLogging>(temp);
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
Reference in New Issue
Block a user