![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Core/Flags.h>
Utility class to store a type-safe combination of enum-based bit fields. More...
Utility class to store a type-safe combination of enum-based bit fields.
Enum | Enumeration to use for accessing individual bits. You must ensure yourself that the underlying enum values are chosen to form a proper bit field. Flags can not perform any checks on this. |
Public Types | |
using | BaseType = typename std::underlying_type<Enum>::type |
Public Member Functions | |
Flags ()=default | |
Default constructor creates an empty bitfield. | |
Flags (Enum f) | |
Constructs a Flags instance with a single bit set. | |
Flags (BaseType val) | |
Construct a Flags instance from an integer value, no range checks are performed. | |
Flags (std::initializer_list< Enum > initializerList) | |
Constructs a Flags instance from an initializer list of enum values, all given bits will be set. | |
bool | testFlag (Enum flag) const |
Returns whether all bits of the given flag are set. | |
void | setFlag (Enum flag, bool value=true) |
Sets all bits of the given flag to value. | |
void | toggleFlag (Enum flag) |
Toggles all bits of the given flag. | |
BaseType | value () const |
Returns the underlying value as integral type. | |
Flags & | operator&= (Flags f) |
Flags & | operator&= (Enum mask) |
Flags & | operator|= (Flags f) |
Flags & | operator|= (Enum f) |
Flags & | operator^= (Flags f) |
Flags & | operator^= (Enum f) |
operator Enum () const | |
Flags | operator| (Flags f) const |
Flags | operator| (Enum f) const |
Flags | operator^ (Flags f) const |
Flags | operator^ (Enum f) const |
Flags | operator& (Flags f) const |
Flags | operator& (Enum f) const |
Flags | operator~ () const |
bool | operator! () const |
bool | operator== (Enum f) const |
bool | operator== (const Flags< Enum > &f) const |
bool | operator!= (Enum f) const |
|
inline |
Returns whether all bits of the given flag are set.
If flag is 0, returns whether no bit is set.