![]() |
Gamedev Framework (gf)
0.12.0
A C++14 framework for 2D games
|
Bitfield relying on an enumeration. More...
#include <gf/Flags.h>
Public Types | |
| using | Type = typename std::underlying_type< E >::type |
| The underlying type of the enum. More... | |
Public Member Functions | |
| Flags ()=default | |
| Default constructor. More... | |
| constexpr | Flags (NoneType) |
| Constructor with no flag set. More... | |
| constexpr | Flags (AllType) |
| Constructor with all flags set. More... | |
| constexpr | Flags (E e) |
| Constructor with an enum value. More... | |
| constexpr Flags< E > | operator~ () const |
| Binary NOT operator. More... | |
| constexpr Flags | operator| (Flags flags) const |
| Binary OR between two bitfields. More... | |
| Flags< E > & | operator|= (Flags< E > flags) |
| Binary OR and assignment. More... | |
| constexpr Flags | operator & (Flags flags) const |
| Binary AND between two bitfields. More... | |
| Flags< E > & | operator &= (Flags< E > flags) |
| Binary AND and assignment. More... | |
| constexpr | operator bool () const |
| Test if any flag is set. More... | |
| constexpr 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 > | |
| constexpr Flags< E > | operator| (Flags< E > lhs, E rhs) |
| Binary OR between a bitfield and a flag. More... | |
| template<typename E > | |
| constexpr Flags< E > | operator| (E lhs, Flags< E > rhs) |
| Binary OR between a flag and a bitfield. More... | |
| template<typename E > | |
| constexpr Flags< E > | operator& (Flags< E > lhs, E rhs) |
| Binary AND between a bitfield and a flag. More... | |
| template<typename E > | |
| constexpr Flags< E > | operator& (E lhs, Flags< E > rhs) |
| Binary AND between a flag and a bitfield. More... | |
| template<typename E > | |
| constexpr Flags< E > | combineFlags (E flag) |
| Combine a single enum value into a flag value. More... | |
| template<typename E , typename ... F> | |
| constexpr Flags< E > | combineFlags (E flag, F ... others) |
| Combine several enum values into a flag value. 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.
The underlying type of the enum.
Constructor with no flag set.
Constructor with all flags set.
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.
Binary AND between two bitfields.
| flags | Another bitfield |
Binary AND and assignment.
| flags | Another bitfield |
Test if any flag is set.
Binary OR between two bitfields.
| 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 |
Combine a single enum value into a flag value.
| flag | An enum value |
|
related |
Combine several enum values into a flag value.
| flag | An enum value |
| others | The other enum values |
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 a bitfield and a flag.
| lhs | The bitfield |
| rhs | The flag |
1.8.13