mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #199 , moved operator for enum/DBus to own file. This operator is not CValueObject specific.
This commit is contained in:
23
src/blackmisc/dbus.h
Normal file
23
src/blackmisc/dbus.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef BLACKMISC_DBUS_H
|
||||
#define BLACKMISC_DBUS_H
|
||||
|
||||
#include <QDBusArgument>
|
||||
#include <type_traits>
|
||||
|
||||
/*!
|
||||
* Non-member non-friend operator for streaming enums to QDBusArgument.
|
||||
*
|
||||
* \param argument
|
||||
* \param enumType
|
||||
* \return
|
||||
* \remarks Currently outside namespace for OSX build, see https://dev.vatsim-germany.org/issues/184
|
||||
*/
|
||||
template <class ENUM> typename std::enable_if<std::is_enum<ENUM>::value, QDBusArgument>::type const &
|
||||
operator>>(const QDBusArgument &argument, ENUM &enumType)
|
||||
{
|
||||
uint e;
|
||||
argument >> e;
|
||||
enumType = static_cast<ENUM>(e);
|
||||
return argument;
|
||||
}
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user