Cheap owning immutable snapshot of named definitions and defaults. Const snapshot reads are concurrent-safe. Mutating the same handle requires external synchronization. Copies preserve the snapshot and sticky error; later fluent mutations publish a new version only. Construction/copy of caller arguments may throw; fluent operations catch internal allocation failures. No callback, resolver, factory, locale, runtime or mutable cache is retained or invoked.
More...
#include <ui_control_context.hpp>
|
| | ControlContext (ControlContextLimits limits={}) noexcept |
| ControlContext & | registerType (std::string_view name, std::span< const std::string_view > properties) &noexcept |
| | Register a callback-free custom factory schema from canonical scalar property paths.
|
| ControlContext && | registerType (std::string_view name, std::span< const std::string_view > properties) &&noexcept |
| ControlContext & | define (std::string_view name, std::string_view base, const ControlSettings &settings={}) &noexcept |
| | Add one unique named definition; base may be declared later.
|
| ControlContext && | define (std::string_view name, std::string_view base, const ControlSettings &settings={}) &&noexcept |
| ControlContext & | defaults (std::string_view type, const ControlSettings &settings) &noexcept |
| | Register the sole defaults block for one builtin/named type.
|
| ControlContext && | defaults (std::string_view type, const ControlSettings &settings) &&noexcept |
| ControlContext & | overlayDefaults (std::string_view type, const ControlSettings &settings) &noexcept |
| | Apply sparse defaults in a nested configuration scope without changing earlier snapshots.
|
| ControlContext && | overlayDefaults (std::string_view type, const ControlSettings &settings) &&noexcept |
| std::expected< void, ControlContextError > | validate () const noexcept |
| | Validate every definition/default before any application effect.
|
| std::expected< ControlContext, ControlContextError > | prepared () const noexcept |
| | Validate once and return an immutable version with reusable graph qualification.
|
| bool | empty () const noexcept |
| bool | hasRegisteredType (std::string_view name) const noexcept |
| bool | matchesRegisteredType (std::string_view name, std::span< const std::string_view > properties) const noexcept |
| std::expected< ResolvedControl, ControlContextError > | resolve (std::string_view name, const ControlSettings &instancePatch={}) const noexcept |
| | Validate the whole snapshot, then resolve builtin/defaults/definition/defaults/instance precedence.
|
| ControlContextLimits | limits () const noexcept |
|
|
struct | detail::ControlContextAccess |
Cheap owning immutable snapshot of named definitions and defaults. Const snapshot reads are concurrent-safe. Mutating the same handle requires external synchronization. Copies preserve the snapshot and sticky error; later fluent mutations publish a new version only. Construction/copy of caller arguments may throw; fluent operations catch internal allocation failures. No callback, resolver, factory, locale, runtime or mutable cache is retained or invoked.
◆ ControlContext()
- Parameters
-
| limits | Positive finite limits; invalid limits become a sticky configuration error. |
◆ defaults() [1/2]
- Parameters
-
| type | Defaults target. |
| settings | Sparse patch. |
- Returns
- This temporary handle.
◆ defaults() [2/2]
Register the sole defaults block for one builtin/named type.
- Parameters
-
| type | Case-sensitive type identity; forward definitions are permitted. |
| settings | Sparse patch; a second defaults block for this type is a typed duplicate. |
- Returns
- This same handle; internal exceptions become a sticky typed error.
◆ define() [1/2]
- Parameters
-
| name | Variant name. |
| base | Ancestor identity. |
| settings | Sparse patch. |
- Returns
- This temporary.
◆ define() [2/2]
Add one unique named definition; base may be declared later.
- Parameters
-
| name | Case-sensitive ASCII identifier, excluding builtin names. |
| base | One builtin or named definition; checked by validate/resolve. |
| settings | Owning sparse initial settings copied during this call. |
- Returns
- This same handle. The first typed failure stops later fluent mutations.
◆ empty()
| bool portals::ui::ControlContext::empty |
( |
| ) |
const |
|
noexcept |
- Returns
- Whether this is the unconfigured context with ordinary default budgets.
◆ hasRegisteredType()
| bool portals::ui::ControlContext::hasRegisteredType |
( |
std::string_view | name | ) |
const |
|
noexcept |
- Parameters
-
| name | Exact custom schema name, excluding builtins and named definitions. |
- Returns
- Whether this snapshot contains the explicit callback-free schema.
◆ limits()
- Returns
- Immutable bounds captured by this snapshot.
◆ matchesRegisteredType()
| bool portals::ui::ControlContext::matchesRegisteredType |
( |
std::string_view | name, |
|
|
std::span< const std::string_view > | properties ) const |
|
noexcept |
- Parameters
-
| name | Exact custom schema name. |
| properties | Canonical allowed paths, compared as an unordered set without allocation. |
- Returns
- Exact schema equality; false for missing types, unknown paths or duplicate paths.
◆ overlayDefaults() [1/2]
- Parameters
-
| type | Local defaults target. |
| settings | Sparse patch. |
- Returns
- This temporary handle.
◆ overlayDefaults() [2/2]
Apply sparse defaults in a nested configuration scope without changing earlier snapshots.
- Parameters
-
| type | Existing or forward-declared type receiving local defaults. |
| settings | Present leaves override inherited defaults, including false, zero and their provenance. |
- Returns
- This handle with a new immutable version; a resource loader separately rejects duplicate local blocks.
◆ prepared()
Validate once and return an immutable version with reusable graph qualification.
- Returns
- Checked snapshot; resolve still validates each instance patch. Later fluent mutation invalidates qualification only on the mutated handle, leaving earlier copies unchanged.
◆ registerType() [1/2]
| ControlContext && portals::ui::ControlContext::registerType |
( |
std::string_view | name, |
|
|
std::span< const std::string_view > | properties ) && |
|
inlinenoexcept |
- Parameters
-
| name | Custom schema name. |
| properties | Copied canonical paths. |
- Returns
- This temporary handle.
◆ registerType() [2/2]
| ControlContext & portals::ui::ControlContext::registerType |
( |
std::string_view | name, |
|
|
std::span< const std::string_view > | properties ) & |
|
noexcept |
Register a callback-free custom factory schema from canonical scalar property paths.
- Parameters
-
| name | Unique non-builtin type identity, shared with the caller's explicit factory allowlist. |
| properties | Allowed paths from the builtin descriptor vocabulary; copied now, no borrowed span survives. |
- Returns
- This same handle; custom types and named definitions share maxDefinitions. Unknown paths fail.
◆ resolve()
Validate the whole snapshot, then resolve builtin/defaults/definition/defaults/instance precedence.
- Parameters
-
| name | Requested builtin or named type. |
| instancePatch | Final sparse overrides, copied without resolving TextValue expressions. |
- Returns
- Owning effective sparse settings or a typed failure with original declaration provenance.
◆ validate()
Validate every definition/default before any application effect.
- Returns
- First sticky, graph, schema or bounded-materialization failure, otherwise success.
The documentation for this class was generated from the following file: