Permission to pass a component's bytes on. More...
#include <component.hpp>
Public Types | |
| enum class | State : std::uint8_t { unknown = 0 , restricted = 1 , allowed = 2 } |
| unknown is first so that every zero-initialization lands on it. More... | |
Public Member Functions | |
| constexpr | Redistribution ()=default |
| The only implicit state. Silence is not a grant. | |
| constexpr State | state () const |
| constexpr bool | is_granted () const |
| constexpr bool | is_restricted () const |
| constexpr bool | is_unknown () const |
Static Public Member Functions | |
| static constexpr Redistribution | granted () |
| An explicit grant. Spelling this is the act; there is no other way in. | |
| static constexpr Redistribution | restricted () |
| static constexpr Redistribution | unknown () |
Friends | |
| constexpr bool | operator== (const Redistribution &, const Redistribution &)=default |
Permission to pass a component's bytes on.
This is a class rather than a plain enum because the permissive state must be unreachable by accident. A default-constructed, value-initialized, or zero-filled Redistribution is unknown; allowed can only be reached by naming Redistribution::granted(), which reads as the act it is. That matters because a grant is a statement about someone else's work: a row whose author never spelled the grant must not acquire one from an aggregate initializer, a memset, a forgotten field, or an enumerator that happened to sit at zero. unknown is a real state and never decays to allowed; an export policy that claims redistribution must refuse rather than assume.
|
strong |
unknown is first so that every zero-initialization lands on it.
| Enumerator | |
|---|---|
| unknown | |
| restricted | |
| allowed | |
|
constexprdefault |
The only implicit state. Silence is not a grant.
|
inlinestaticnodiscardconstexpr |
An explicit grant. Spelling this is the act; there is no other way in.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinestaticnodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinestaticnodiscardconstexpr |
|
friend |