1.10 |
Utility class for managing a set of flags. More...
#include <flagsbase.h>
Public Types | |
using | Underlying = typename std::underlying_type< T >::type |
This is the underlying type of the flags, which is used internally for efficient bitwise operation on flags. | |
Public Member Functions | |
constexpr | FlagsBase () noexcept=default |
constexpr | FlagsBase (const T flag) noexcept |
Construct with a single flag. | |
constexpr | FlagsBase (std::initializer_list< T > flags) noexcept |
Construct with an initializer_list of flags. | |
constexpr bool | clear () noexcept |
Unset all flags. | |
constexpr bool | clear (const T flag) noexcept |
Clear, or unset, the specified flag. | |
EGT_NODISCARD constexpr bool | empty () const noexcept |
Returns true if there are no flags set. | |
EGT_NODISCARD std::set< T > | get () const |
Get a std::set of all set flags. | |
EGT_NODISCARD constexpr bool | is_set (const T flag) const noexcept |
Test if the specified flag is set. | |
EGT_NODISCARD constexpr bool | is_set (std::initializer_list< T > flags) const noexcept |
Test if the specified flags are set. | |
constexpr Underlying & | raw () |
Get the raw underlying value. | |
EGT_NODISCARD constexpr const Underlying & | raw () const |
Get the raw underlying value. | |
constexpr bool | set (const T flag) noexcept |
Set the specified flag. | |
constexpr bool | set (std::initializer_list< T > flags) noexcept |
Set the specified flags. | |
Protected Attributes | |
Underlying | m_flags {} |
The flags. | |
Utility class for managing a set of flags.
This supports at most flag values supported by the number of bits in the underlying enum type.
using Underlying = typename std::underlying_type<T>::type |
This is the underlying type of the flags, which is used internally for efficient bitwise operation on flags.
|
constexprdefaultnoexcept |
|
inlineconstexprnoexcept |
Construct with a single flag.
|
inlineconstexprnoexcept |
Construct with an initializer_list of flags.
|
inlineconstexprnoexcept |
Unset all flags.
|
inlineconstexprnoexcept |
Clear, or unset, the specified flag.
flag | Flag to clear. |
|
inlineconstexprnoexcept |
Returns true if there are no flags set.
|
inline |
Get a std::set of all set flags.
|
inlineconstexprnoexcept |
Test if the specified flag is set.
flag | The flag to test. |
|
inlineconstexprnoexcept |
Test if the specified flags are set.
All must be set to return true.
flags | The flags to test. |
|
inlineconstexpr |
Get the raw underlying value.
|
inlineconstexpr |
Get the raw underlying value.
|
inlineconstexprnoexcept |
Set the specified flag.
flag | The flag to set. |
|
inlineconstexprnoexcept |
|
protected |
The flags.