OpenTTD Source 20250428-master-ga5578166bb
|
Enum-as-bit-set wrapper. More...
#include <enum_type.hpp>
Public Types | |
using | EnumType = BaseClass::ValueType |
![]() | |
using | ValueType = Tvalue_type |
Value type of this BaseBitSet. | |
using | BaseType = Tstorage |
Storage type of this BaseBitSet, be ConvertibleThroughBase. | |
Public Member Functions | |
constexpr | EnumBitSet (Tenum value) |
constexpr | EnumBitSet (Tstorage data) |
constexpr | EnumBitSet (std::initializer_list< const Tenum > values) |
Construct an EnumBitSet from a list of enum values. | |
constexpr auto | operator<=> (const EnumBitSet &) const noexcept=default |
![]() | |
constexpr | BaseBitSet (Tstorage data) |
constexpr auto | operator<=> (const BaseBitSet &) const noexcept=default |
constexpr Timpl & | Set () |
Set all bits. | |
constexpr Timpl & | Set (Tvalue_type value) |
Set the value-th bit. | |
constexpr Timpl & | Set (const Timpl &other) |
Set values from another bitset. | |
constexpr Timpl & | Set (Tvalue_type value, bool set) |
Assign the value-th bit. | |
constexpr Timpl & | Reset (Tvalue_type value) |
Reset the value-th bit. | |
constexpr Timpl & | Reset (const Timpl &other) |
Reset values from another bitset. | |
constexpr Timpl & | Flip (Tvalue_type value) |
Flip the value-th bit. | |
constexpr Timpl & | Flip (const Timpl &other) |
Flip values from another bitset. | |
constexpr bool | Test (Tvalue_type value) const |
Test if the value-th bit is set. | |
constexpr bool | All (const Timpl &other) const |
Test if all of the values are set. | |
constexpr bool | All () const |
Test if all of the values are set. | |
constexpr bool | Any (const Timpl &other) const |
Test if any of the given values are set. | |
constexpr bool | Any () const |
Test if any of the values are set. | |
constexpr bool | None () const |
Test if none of the values are set. | |
constexpr Timpl | operator| (const Timpl &other) const |
constexpr Timpl | operator& (const Timpl &other) const |
constexpr Tstorage | base () const noexcept |
Retrieve the raw value behind this bit set. | |
constexpr bool | IsValid () const |
Test that the raw value of this bit set is valid. | |
auto | begin () const |
auto | end () const |
Static Public Member Functions | |
static constexpr size_t | DecayValueType (const BaseClass::ValueType &value) |
Private Types | |
using | BaseClass = BaseBitSet< EnumBitSet< Tenum, Tstorage, Tend_value >, Tenum, Tstorage, EnumBitSetMask< Tstorage, Tenum, Tend_value >::value > |
Additional Inherited Members | |
![]() | |
static constexpr Tstorage | MASK = Tmask |
Mask of valid values. | |
Enum-as-bit-set wrapper.
Allows wrapping enum values as a bit set. Methods are loosely modelled on std::bitset.
Tenum | Enum values to wrap. |
Tstorage | Storage type required to hold eenum values. |
Tend_value | Last valid value + 1. |
Definition at line 128 of file enum_type.hpp.
|
private |
Definition at line 129 of file enum_type.hpp.
using EnumBitSet< Tenum, Tstorage, Tend_value >::EnumType = BaseClass::ValueType |
Definition at line 131 of file enum_type.hpp.
|
inlineconstexpr |
Definition at line 133 of file enum_type.hpp.
|
inlineconstexpr |
Definition at line 134 of file enum_type.hpp.
|
inlineexplicitconstexpr |
Definition at line 135 of file enum_type.hpp.
|
inlineconstexpr |
Construct an EnumBitSet from a list of enum values.
values | List of enum values. |
Definition at line 141 of file enum_type.hpp.
References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set().
|
inlinestaticconstexpr |
Definition at line 150 of file enum_type.hpp.