|
| Flags () noexcept |
| Default constructor.
|
|
| Flags (EnumType const flag) noexcept |
| User defined constructor.
|
|
| Flags (BaseType const flags) noexcept |
| User defined constructor.
|
|
void | set (EnumType const flag) |
| Sets the given flag.
|
|
void | clear (EnumType const flag) |
| Clears the given flag.
|
|
bool | isSet (EnumType const flag) const |
| Checks whether the given flag is set.
|
|
BaseType const & | toInteger () const |
| Returns the base type.
|
|
Flags | combine (Flags const &other) const |
| Combines the flags with another instance.
|
|
Flags | intersect (Flags const &other) const |
| Intersects the flags with another instance.
|
|
template<typename EnumType, typename LimitsType, typename BaseType>
class imt::base::core::util::Flags< EnumType, LimitsType, BaseType >
A template to create a type safe flags type from an enum.
- Parameters
-
EnumType | An enum class that contains the flags. |
LimitsType | A struct that provides the following features: MIN The lowest possible flag (equals to 0). MAX The highest possible flag (equals to COUNT - 1). COUNT A constant that contains the number of flags in the struct. |
- Note
- The enum must not skip enumerators, if there are unused flags, add those but name them as unused.
Example for a well formed enum to pass as EnumType:
enum class MyFlagEnum : uint32_t { Bit1, _unused_Bit2, Bit3 };
enum class MyFlagEnumLimits { static constexpr uint32_t MIN {0U}; static constexpr uint32_t MAX {static_cast<uint32_t>(MyFlagEnum::Bit3)}; static constexpr uint32_t COUNT {MAX + 1U}; };
Definition at line 74 of file Flags.h.