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.
|
|
| Flags (const std::string &str) |
|
| Flags (Flags &&) noexcept=default |
|
constexpr | Flags (T flag) noexcept |
| Set a single flag.
|
|
| ~Flags () noexcept=default |
|
bool | clear () noexcept |
| Clear all flags.
|
|
bool | clear (T flag) noexcept |
| Clear a single flag.
|
|
void | from_string (const std::string &str) |
| Convert from string.
|
|
constexpr Flags< T > | operator& (const T &flag) const noexcept |
| And operator.
|
|
Flags & | operator= (const Flags &rhs) |
| Assignment operator.
|
|
Flags & | operator= (Flags &&) noexcept=default |
|
constexpr Flags< T > | operator| (const T &flag) const noexcept |
| Or operator.
|
|
bool | set (std::initializer_list< T > flags) noexcept |
| Set multiple flags.
|
|
bool | set (T flag) noexcept |
| Set a single flag.
|
|
EGT_NODISCARD std::string | to_string () const |
| Convert the flags to strings.
|
|
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.
|
|
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.