Nazara Engine
0.4
A fast, complete, cross-platform API designed for game development
|
Core class used to combine enumeration values into flags bitfield. More...
Public Types | |
using | BitField = typename std::conditional<(EnumAsFlags< E >::max > 32), UInt64, UInt32 >::type |
Public Member Functions | |
constexpr | Flags (BitField value=0) |
Constructs a Flags object using a bitfield. More... | |
constexpr | Flags (E enumVal) |
Constructs a Flags object using an Enum value. More... | |
constexpr | operator bool () const |
Tests a Flags. More... | |
constexpr | operator BitField () const |
Converts to a bitfield. More... | |
constexpr Flags | operator~ () const |
Reverse flag states. More... | |
constexpr Flags | operator & (const Flags &rhs) const |
constexpr Flags | operator| (const Flags &rhs) const |
Combine flag states. More... | |
constexpr Flags | operator^ (const Flags &rhs) const |
XOR flag states. More... | |
constexpr bool | operator== (const Flags &rhs) const |
Check equality with flag object. More... | |
constexpr bool | operator!= (const Flags &rhs) const |
Check inequality with flag object. More... | |
Flags & | operator|= (const Flags &rhs) |
Combine flag states. More... | |
Flags & | operator &= (const Flags &rhs) |
Flags & | operator^= (const Flags &rhs) |
XOR flag states. More... | |
Static Public Member Functions | |
static constexpr BitField | GetFlagValue (E enumValue) |
Returns a bitfield corresponding to an enum value. More... | |
Static Public Attributes | |
static constexpr BitField | ValueMask = ((BitField(1) << (EnumAsFlags<E>::max + 1)) - 1) |
Core class used to combine enumeration values into flags bitfield.
Constructs a Flags object using a bitfield.
value | Bitfield to be used |
Uses a bitfield to builds the flag value. (e.g. if bit 0 is active, then Enum value 0 will be set as active).
|
static |
Returns a bitfield corresponding to an enum value.
enumValue | Enumeration value to get as a bitfield. |
Internally, every enum option is turned into a bit, this function allows to get a bitfield with only the bit of the enumeration value enabled.
|
explicit |
Converts to a bitfield.
This will convert to a bitfield value.
|
explicit |
Tests a Flags.
This will convert to a boolean value allowing to check if any flag is set.
constexpr Flags< E > Nz::Flags< E >::operator^ | ( | const Flags< E > & | rhs | ) | const |
XOR flag states.
rhs | Flags to XOR with. |
This performs a XOR (Exclusive OR) on a copy of the flag object. This will returns a copy of the object with disabled common flags and enabled unique ones.
Combine flag states.
rhs | Flags to combine with. |
This will enable flags which are enabled in parameter object and not in Flag object.
Reverse flag states.
This will returns a copy of the Flags object with reversed flags states.