Utility class for managing a set of flags with the ability to observe changes to the flags.
More...
|
constexpr | Flags () noexcept=default |
|
| Flags (const char *str) |
|
constexpr | Flags (const Flags &rhs) noexcept |
| Copy constructor. More...
|
|
| Flags (const std::string &str) |
|
| Flags (Flags &&) noexcept=default |
|
constexpr | Flags (T flag) noexcept |
| Set a single flag. More...
|
|
| ~Flags () noexcept=default |
|
bool | clear () noexcept |
| Clear all flags. More...
|
|
bool | clear (T flag) noexcept |
| Clear a single flag. More...
|
|
void | from_string (const std::string &str) |
| Convert from string. More...
|
|
constexpr Flags< T > | operator& (const T &flag) const noexcept |
| And operator. More...
|
|
Flags & | operator= (const Flags &rhs) |
| Assignment operator. More...
|
|
Flags & | operator= (Flags &&) noexcept=default |
|
constexpr Flags< T > | operator| (const T &flag) const noexcept |
| Or operator. More...
|
|
bool | set (std::initializer_list< T > flags) noexcept |
| Set multiple flags. More...
|
|
bool | set (T flag) noexcept |
| Set a single flag. More...
|
|
EGT_NODISCARD std::string | to_string () const |
| Convert the flags to strings. More...
|
|
constexpr | FlagsBase () noexcept=default |
|
constexpr | FlagsBase (const T flag) noexcept |
| Construct with a single flag. More...
|
|
constexpr | FlagsBase (std::initializer_list< T > flags) noexcept |
| Construct with an initializer_list of flags. More...
|
|
constexpr bool | clear () noexcept |
| Unset all flags. More...
|
|
constexpr bool | clear (const T flag) noexcept |
| Clear, or unset, the specified flag. More...
|
|
constexpr EGT_NODISCARD bool | empty () const noexcept |
| Returns true if there are no flags set. More...
|
|
EGT_NODISCARD std::set< T > | get () const |
| Get a std::set of all set flags. More...
|
|
constexpr EGT_NODISCARD bool | is_set (const T flag) const noexcept |
| Test if the specified flag is set. More...
|
|
constexpr EGT_NODISCARD bool | is_set (std::initializer_list< T > flags) const noexcept |
| Test if the specified flags are set. More...
|
|
constexpr Underlying & | raw () |
| Get the raw underlying value. More...
|
|
constexpr EGT_NODISCARD const Underlying & | raw () const |
| Get the raw underlying value. More...
|
|
constexpr bool | set (const T flag) noexcept |
| Set the specified flag. More...
|
|
constexpr bool | set (std::initializer_list< T > flags) noexcept |
| Set the specified flags. More...
|
|
template<class T>
class egt::v1::Flags< T >
Utility class for managing a set of flags with the ability to observe changes to the flags.
This supports at most flag values supported by the number of bits in the underlying enum type.
- Warning
- All flags must be a power of 2.