Provides enum-keyed boolean flag storage for a single flag set. More...
#include <CustomFlaggable.h>
Public Member Functions | |
| template<typename T = CustomFlagEnum> | |
| std::enable_if_t<!std::is_void_v< T >, bool > | checkFlag (T state) const |
| Return the current value of a flag. | |
| template<typename T = CustomFlagEnum> | |
| std::enable_if_t<!std::is_void_v< T > > | disableFlag (T state) |
Set a flag to false. | |
| template<typename T = CustomFlagEnum> | |
| std::enable_if_t<!std::is_void_v< T > > | enableFlag (T state) |
Set a flag to true. | |
| template<typename T = CustomFlagEnum> | |
| std::enable_if_t<!std::is_void_v< T > > | setFlag (T state, bool status) |
| Set a flag to an explicit value. | |
| template<typename T = CustomFlagEnum> | |
| std::enable_if_t<!std::is_void_v< T > > | toggleFlag (T state) |
Flip a flag between true and false. | |
Provides enum-keyed boolean flag storage for a single flag set.
CustomFlaggale<CustomFlagEnum> maintains an unordered_map from enum values to bool, exposing a consistent API for querying and mutating those flags. It is the low-level storage layer used by MultiCustomFlaggable to hold each individual flag set gathered from a component's manifest and traits.
All methods are guarded by std::enable_if so they exist in the overload set only when CustomFlagEnum is not void. This allows CustomFlaggale to be safely used as a base class even when the manifest declares no flags — see the void specialization below.
ComponentWith)You will rarely instantiate CustomFlaggale directly. Instead, declare a Flags enum in your manifest and call the flag methods on your component:
| CustomFlagEnum | An enum class type used as flag keys. Use void when no custom flags are needed (selects the no-op specialization). |
Definition at line 53 of file CustomFlaggable.h.
| std::enable_if_t<!std::is_void_v< T >, bool > ml::CustomFlaggable< CustomFlagEnum >::checkFlag | ( | T | state | ) | const |
Return the current value of a flag.
Returns false for any flag that has never been explicitly set.
| state | The flag to query. |
true if the flag is set; false otherwise. | std::enable_if_t<!std::is_void_v< T > > ml::CustomFlaggable< CustomFlagEnum >::disableFlag | ( | T | state | ) |
Set a flag to false.
| state | The flag to disable. |
| std::enable_if_t<!std::is_void_v< T > > ml::CustomFlaggable< CustomFlagEnum >::enableFlag | ( | T | state | ) |
Set a flag to true.
| state | The flag to enable. |
| std::enable_if_t<!std::is_void_v< T > > ml::CustomFlaggable< CustomFlagEnum >::setFlag | ( | T | state, |
| bool | status ) |
Set a flag to an explicit value.
| state | The flag to modify. |
| status | true to enable the flag, false to disable it. |
| std::enable_if_t<!std::is_void_v< T > > ml::CustomFlaggable< CustomFlagEnum >::toggleFlag | ( | T | state | ) |
Flip a flag between true and false.
| state | The flag to toggle. |