Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
Bitfield relying on an enumeration. More...
#include <gf/Flags.h>
Public Types | |
using | Type = typename std::underlying_type< E >::type |
Public Member Functions | |
Flags ()=default | |
Default constructor. More... | |
constexpr | Flags (NoneType) |
constexpr | Flags (AllType) |
constexpr | Flags (E e) |
Constructor with an enum value. More... | |
constexpr Flags< E > | operator~ () const |
Binary NOT operator. More... | |
Flags< E > & | operator|= (Flags< E > flags) |
Binary OR and assignment. More... | |
Flags< E > & | operator&= (Flags< E > flags) |
Binary AND and assignment. More... | |
operator bool () const | |
Test if any flag is set. More... | |
bool | test (E flag) const |
Test if a specified flag is set. More... | |
void | set (E flag) |
Set a flag. More... | |
void | reset (E flag) |
Reset a flag. More... | |
Type | getValue () const |
Get the underlying value of the flags. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename E > | |
Flags< E > | operator| (Flags< E > lhs, Flags< E > rhs) |
Binary OR between two bitfields. More... | |
template<typename E > | |
Flags< E > | operator| (Flags< E > lhs, E rhs) |
Binary OR between a bitfield and a flag. More... | |
template<typename E > | |
Flags< E > | operator| (E lhs, Flags< E > rhs) |
Binary OR between a flag and a bitfield. More... | |
template<typename E > | |
Flags< E > | operator& (Flags< E > lhs, Flags< E > rhs) |
Binary AND between two bitfields. More... | |
template<typename E > | |
Flags< E > | operator& (Flags< E > lhs, E rhs) |
Binary AND between a bitfield and a flag. More... | |
template<typename E > | |
Flags< E > | operator& (E lhs, Flags< E > rhs) |
Binary AND between a flag and a bitfield. More... | |
Bitfield relying on an enumeration.
If you do not initialize flags, then the state is undefined. You can use semantic constants gf::All and gf::None to set all the flags or none.
Constructor with an enum value.
e | An enum value |
Get the underlying value of the flags.
This function should not be used in normal cases.
Test if any flag is set.
Binary AND and assignment.
flags | Another bitfield |
Binary OR and assignment.
flags | Another bitfield |
Binary NOT operator.
Reset a flag.
flag | The flag to reset |
Set a flag.
flag | The flag to set |
Test if a specified flag is set.
flag | The flag to test |
Binary AND between two bitfields.
lhs | The first bitfield |
rhs | The second bitfield |
Binary AND between a bitfield and a flag.
lhs | The bitfield |
rhs | The flag |
Binary AND between a flag and a bitfield.
lhs | The flag |
rhs | The bitfield |
Binary OR between two bitfields.
lhs | The first bitfield |
rhs | The second bitfield |
Binary OR between a bitfield and a flag.
lhs | The bitfield |
rhs | The flag |