xentara-utils v2.0.4
The Xentara Utility Library
|
A set of flags that are indexed by an enum. More...
#include <xentara/utils/core/Flags.hpp>
Public Types | |
using | size_type = std::underlying_type_t< Flag > |
The type used for the size. | |
using | key_type = Flag |
The type used as a key. | |
using | mapped_type = bool |
The type the set maps to. | |
using | value_type = bool |
The type used as a key. | |
using | reference = typename Bitset::reference |
The type used as a reference. | |
Public Member Functions | |
constexpr | Flags () noexcept=default |
Creates an empty object with no flags set. | |
constexpr | Flags (Flag flag) noexcept |
Creates an object with one flag set. | |
auto | operator&= (const Flags &rhs) noexcept -> Flags & |
Clears flags not found in another object. | |
auto | operator|= (const Flags &rhs) noexcept -> Flags & |
Sets flags found in another object. | |
auto | operator^= (const Flags &rhs) noexcept -> Flags & |
Inverts flags found in another object. | |
auto | operator&= (Flag rhs) noexcept -> Flags & |
Clears all but one flag. | |
auto | operator|= (Flag rhs) noexcept -> Flags & |
Sets a single flag. | |
auto | operator^= (Flag rhs) noexcept -> Flags & |
Inverts a single flag. | |
auto | operator~ () const noexcept -> Flags |
Creates an Object with all flags inverted. | |
constexpr auto | operator[] (Flag flag) const -> bool |
Gets the state of a certain flag. | |
auto | operator[] (Flag flag) -> reference |
Gets the state of a certain flag. | |
auto | operator== (const Flags &) const noexcept -> bool=default |
Comparison operator. | |
constexpr auto | test (Flag flag) const -> bool |
Gets the state of a certain flag. | |
auto | all () const noexcept -> bool |
Checks if all the bits are set. | |
auto | any () const noexcept -> bool |
Checks if any of the bits are set. | |
auto | none () const noexcept -> bool |
Checks if any the bits are cleared. | |
auto | count () const noexcept -> size_type |
Returns the number of Flags that are set. | |
auto | set () noexcept -> Flags & |
Sets all flags. | |
auto | set (Flag flag, bool value=true) -> Flags & |
Sets or resets a certain flag. | |
auto | reset () noexcept -> Flags & |
Resets all flags. | |
auto | reset (Flag flag) -> Flags & |
Resets a certain flag. | |
auto | flip () noexcept -> Flags & |
Inverts all flags. | |
auto | flip (Flag flag) -> Flags & |
Inverts a certain flag. | |
Static Public Member Functions | |
static constexpr auto | size () -> size_type |
Returns the number of Flags that the object can hold. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<xentara::utils::core::FlagEnum Flag> | |
constexpr auto | operator| (Flag lhs, Flag rhs) -> xentara::utils::core::Flags< Flag > |
Generates the union between two flags. | |
template<xentara::utils::core::FlagEnum Flag> | |
constexpr auto | operator& (Flag lhs, Flag rhs) -> xentara::utils::core::Flags< Flag > |
Generates the intersection between two flags. | |
template<xentara::utils::core::FlagEnum Flag> | |
constexpr auto | operator^ (Flag lhs, Flag rhs) -> xentara::utils::core::Flags< Flag > |
Generates the symmetric difference between two flags. | |
template<xentara::utils::core::FlagEnum Flag> | |
constexpr auto | operator~ (Flag flag) -> xentara::utils::core::Flags< Flag > |
Generates the inverse of a flag. | |
A set of flags that are indexed by an enum.
Flag | The type to use for the individual flags |
using xentara::utils::core::Flags< Flag >::key_type = Flag |
The type used as a key.
using xentara::utils::core::Flags< Flag >::mapped_type = bool |
The type the set maps to.
using xentara::utils::core::Flags< Flag >::reference = typename Bitset::reference |
The type used as a reference.
using xentara::utils::core::Flags< Flag >::size_type = std::underlying_type_t<Flag> |
The type used for the size.
using xentara::utils::core::Flags< Flag >::value_type = bool |
The type used as a key.
|
constexprdefaultnoexcept |
Creates an empty object with no flags set.
|
constexprnoexcept |
Creates an object with one flag set.
flag | The flag to set |
|
noexcept |
Checks if all the bits are set.
|
noexcept |
Checks if any of the bits are set.
|
noexcept |
Returns the number of Flags that are set.
|
noexcept |
Inverts all flags.
auto xentara::utils::core::Flags< Flag >::flip | ( | Flag | flag | ) | -> Flags & |
Inverts a certain flag.
flag | The flag to invert |
|
noexcept |
Checks if any the bits are cleared.
|
noexcept |
Clears flags not found in another object.
rhs | The other object |
|
noexcept |
Clears all but one flag.
rhs | The flag |
|
defaultnoexcept |
Comparison operator.
auto xentara::utils::core::Flags< Flag >::operator[] | ( | Flag | flag | ) | -> reference |
Gets the state of a certain flag.
flag | The flag |
|
constexpr |
Gets the state of a certain flag.
flag | The flag |
|
noexcept |
Inverts flags found in another object.
rhs | The other object |
|
noexcept |
Inverts a single flag.
rhs | The flag |
|
noexcept |
Sets flags found in another object.
rhs | The other object |
|
noexcept |
Sets a single flag.
rhs | The flag |
|
noexcept |
Creates an Object with all flags inverted.
|
noexcept |
Resets all flags.
auto xentara::utils::core::Flags< Flag >::reset | ( | Flag | flag | ) | -> Flags & |
Resets a certain flag.
flag | The flag to reset |
|
noexcept |
Sets all flags.
auto xentara::utils::core::Flags< Flag >::set | ( | Flag | flag, |
bool | value = true |
||
) | -> Flags & |
Sets or resets a certain flag.
flag | The flag to set |
value | The new value for the flag |
|
staticconstexpr |
Returns the number of Flags that the object can hold.
|
constexpr |
Gets the state of a certain flag.
flag | The flag |
|
related |
Generates the intersection between two flags.
lhs | The first flag |
rhs | The second flag |
|
related |
Generates the symmetric difference between two flags.
lhs | The first flag |
rhs | The second flag |
|
related |
Generates the union between two flags.
lhs | The first flag |
rhs | The second flag |
|
related |
Generates the inverse of a flag.
flag | The flag |