|
commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
|
CRTP helper for builders. More...
#include <flag.hpp>

Public Member Functions | |
| template<AnyFlag F> requires AllowedFlag<F, Categories...> | |
| Derived & | insert_flag () |
Insert flag F (no-op if already present). | |
|
template<AnyFlag F> requires AllowedFlag<F, Categories...> | |
| Derived & | flag () |
Alias for insert_flag that reads naturally in a fluent chain (builder.flag<F>()). | |
|
template<AnyFlag F> requires AllowedFlag<F, Categories...> | |
| Derived & | set_flag (const bool on) |
Set flag F's presence: insert when on, erase otherwise. | |
| Derived & | set_flags (FlagSet flags) |
| Replace the whole set. | |
Static Public Attributes | |
| template<AnyFlag F> | |
| static constexpr bool | flag_allowed = AllowedFlag<F, Categories...> |
True when a flag in F's category is permitted by this builder's constraint. | |
Protected Member Functions | |
| const FlagSet & | flags () const noexcept |
Read access kept protected and used internally; FlagBuilderGetters publishes it through IHasFlags. | |
CRTP helper for builders.
Owns its own FlagSet and adds fluent mutators that return Derived& for chaining.
It does not expose the set publicly or implement IHasFlags: flags() is protected, used internally. A builder that should keep its flags to itself inherits this directly; one that should be observable inherits FlagBuilderGetters instead.
The typed overloads are constrained to allowed categories; the runtime FlagRef/name overloads are unconstrained (the category is only known at compile time), so prefer the typed ones to keep the constraint.
|
inline |
Insert flag F (no-op if already present).
Constrained to allowed categories.