mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 14:07:35 +08:00
Ref T566, added DBus streaming operators so the DECLARED enums can be used with DBus
This commit is contained in:
committed by
Mat Sutcliffe
parent
df119c6e98
commit
269bad3c42
@@ -14,6 +14,7 @@
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QStringList>
|
||||
#include <QMetaType>
|
||||
#include <QDBusArgument>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -45,4 +46,28 @@ Q_DECLARE_METATYPE(BlackMisc::Simulation::MatchingLog)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::MatchingLogFlag)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user