|
|
constexpr | Bitmask () noexcept |
| | Default constructor initializes the bitmask to zero.
|
| |
| constexpr | Bitmask (E value) noexcept |
| | Constructor initializes the bitmask with a specific enum value.
|
| |
| constexpr | Bitmask (const Bitmask &other) noexcept=default |
| | Copy constructor.
|
| |
| constexpr | Bitmask (Bitmask &&other) noexcept=default |
| | Move constructor.
|
| |
|
virtual constexpr | ~Bitmask () noexcept=default |
| | Destructor.
|
| |
| constexpr Bitmask & | operator= (const Bitmask &other) noexcept=default |
| | Copy assignment operator.
|
| |
| constexpr Bitmask & | operator= (Bitmask &&other) noexcept=default |
| | Move assignment operator.
|
| |
| constexpr bool | operator== (const Bitmask &other) const noexcept |
| | Equality operator.
|
| |
| constexpr bool | operator!= (const Bitmask &other) const noexcept |
| | Inequality operator.
|
| |
| constexpr Derived | operator| (const Bitmask &other) const noexcept |
| | Bitwise OR operator.
|
| |
| constexpr Derived | operator& (const Bitmask &other) const noexcept |
| | Bitwise AND operator.
|
| |
| constexpr Derived | operator^ (const Bitmask &other) const noexcept |
| | Bitwise XOR operator.
|
| |
| constexpr Derived | operator~ () const noexcept |
| | Bitwise NOT operator.
|
| |
| constexpr Bitmask & | operator|= (const Bitmask &other) noexcept |
| | Bitwise OR assignment operator.
|
| |
| constexpr Bitmask & | operator&= (const Bitmask &other) noexcept |
| | Bitwise AND assignment operator.
|
| |
| constexpr Bitmask & | operator^= (const Bitmask &other) noexcept |
| | Bitwise XOR assignment operator.
|
| |
| constexpr void | Add (E value) noexcept |
| | Add a flag to the bitmask.
|
| |
| constexpr void | Remove (E value) noexcept |
| | Remove a flag from the bitmask.
|
| |
| constexpr E | Value () const noexcept |
| | Get the current value of the bitmask.
|
| |
| constexpr bool | Has (E value) const noexcept |
| | Check if the bitmask has a specific flag set.
|
| |
| constexpr bool | Has (const Bitmask &other) const noexcept |
| | Check if the bitmask has all flags set from another bitmask.
|
| |
| constexpr bool | HasAny (E value) const noexcept |
| | Check if any of the specified flags are set in the bitmask.
|
| |
| constexpr bool | HasAny (const Bitmask &other) const noexcept |
| | Check if any of the flags from another bitmask are set in this bitmask.
|
| |
| constexpr bool | HasNone (E value) const noexcept |
| | Check if none of the specified flags are set in the bitmask.
|
| |
| constexpr bool | HasNone (const Bitmask &other) const noexcept |
| | Check if none of the flags from another bitmask are set in this bitmask.
|
| |
template<typename Derived, Type::UnsignedEnum E>
class StormByte::Bitmask< Derived, E >
Bitmask class template for managing enum class flags.
- Template Parameters
-
| Derived | The derived class type. |
| E | The enumeration type representing the flags. |
This class provides bitwise operations for enum class types, allowing easy manipulation of flag combinations.
Example usage:
enum class MyFlags : uint8_t {
FlagA = 0x01,
FlagB = 0x02,
FlagC = 0x04
};
class MyBitmask :
public Bitmask<MyBitmask, MyFlags> {
public:
using Bitmask<MyBitmask, MyFlags>::Bitmask;
};
MyBitmask mask(MyFlags::FlagA);
mask |= MyBitmask(MyFlags::FlagB);
if (mask.Has(MyFlags::FlagA)) { ... }
Bitmask class template for managing enum class flags.
Definition bitmask.hxx:95