24 #include <type_traits>
29 #ifndef DOXYGEN_SHOULD_SKIP_THIS
93 : m_data(
static_cast<Type>(e))
104 return Flags(~m_data);
114 m_data |= flags.m_data;
125 m_data &= flags.m_data;
145 return (m_data &
static_cast<Type>(flag)) != 0;
154 m_data |=
static_cast<Type>(flag);
163 m_data &= ~
static_cast<Type>(flag);
166 using Type =
typename std::underlying_type<E>::type;
285 #ifndef DOXYGEN_SHOULD_SKIP_THIS
289 #ifndef DOXYGEN_SHOULD_SKIP_THIS
292 struct EnableBitmaskOperators {
293 static constexpr bool value =
false;
300 #ifndef DOXYGEN_SHOULD_SKIP_THIS
302 typename std::enable_if<
gf::EnableBitmaskOperators<E>::value,
gf::
Flags<E>>::type
303 operator|(E lhs, E rhs) {
310 typename std::enable_if<
gf::EnableBitmaskOperators<E>::value,
gf::
Flags<E>>::type
311 operator&(E lhs, E rhs) {
318 typename std::enable_if<
gf::EnableBitmaskOperators<E>::value,
gf::
Flags<E>>::type
Flags< E > operator|(E lhs, Flags< E > rhs)
Binary OR between a flag and a bitfield.
Definition: Flags.h:231
operator bool() const
Test if any flag is set.
Definition: Flags.h:134
Semantic type to represent "none".
Definition: Types.h:37
Bitfield relying on an enumeration.
Definition: Flags.h:68
Type getValue() const
Get the underlying value of the flags.
Definition: Flags.h:175
void reset(E flag)
Reset a flag.
Definition: Flags.h:162
constexpr Flags(NoneType)
Definition: Flags.h:75
Flags< E > operator&(Flags< E > lhs, Flags< E > rhs)
Binary AND between two bitfields.
Definition: Flags.h:247
Semantic type to represent "all".
Definition: Types.h:53
constexpr Flags(AllType)
Definition: Flags.h:81
void set(E flag)
Set a flag.
Definition: Flags.h:153
constexpr Flags(E e)
Constructor with an enum value.
Definition: Flags.h:92
Flags()=default
Default constructor.
Flags< E > & operator|=(Flags< E > flags)
Binary OR and assignment.
Definition: Flags.h:113
Flags< E > operator|(Flags< E > lhs, Flags< E > rhs)
Binary OR between two bitfields.
Definition: Flags.h:199
bool test(E flag) const
Test if a specified flag is set.
Definition: Flags.h:144
Flags< E > operator|(Flags< E > lhs, E rhs)
Binary OR between a bitfield and a flag.
Definition: Flags.h:215
constexpr Flags< E > operator~() const
Binary NOT operator.
Definition: Flags.h:103
Flags< E > & operator&=(Flags< E > flags)
Binary AND and assignment.
Definition: Flags.h:124
Flags< E > operator&(E lhs, Flags< E > rhs)
Binary AND between a flag and a bitfield.
Definition: Flags.h:279
Flags< E > operator&(Flags< E > lhs, E rhs)
Binary AND between a bitfield and a flag.
Definition: Flags.h:263