mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +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
@@ -12,20 +12,21 @@
|
||||
#define BLACKMISC_SIMULATION_REVERSELOOKUP_H
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QDBusArgument>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
//! Lookup log.messages
|
||||
enum ReverseLookupLoggingFlag
|
||||
{
|
||||
RevLogDisabled = 0,
|
||||
RevLogEnabled = 1 << 0,
|
||||
RevLogSimplifiedInfo = 1 << 1,
|
||||
RevLogEnabledSimplified = RevLogEnabled | RevLogSimplifiedInfo
|
||||
};
|
||||
Q_DECLARE_FLAGS(ReverseLookupLogging, ReverseLookupLoggingFlag)
|
||||
//! Lookup log.messages
|
||||
enum ReverseLookupLoggingFlag
|
||||
{
|
||||
RevLogDisabled = 0,
|
||||
RevLogEnabled = 1 << 0,
|
||||
RevLogSimplifiedInfo = 1 << 1,
|
||||
RevLogEnabledSimplified = RevLogEnabled | RevLogSimplifiedInfo
|
||||
};
|
||||
Q_DECLARE_FLAGS(ReverseLookupLogging, ReverseLookupLoggingFlag)
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -33,4 +34,28 @@ Q_DECLARE_METATYPE(BlackMisc::Simulation::ReverseLookupLogging)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::ReverseLookupLoggingFlag)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user