Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::ui::SceneResourceOptions Struct Reference

Explicit resource-loader configuration; no process-global registry or locale. Configure without concurrent access, then transfer/copy into a scene on its UI thread. Factories own their captures; referenced services must outlive synchronous prepare. Copies retain the first fluent registration failure; checked registry.add failures are independent. More...

#include <ui_scene_resource.hpp>

Public Member Functions

SceneResourceOptions & popupMenu (std::string_view name, Ref< PopupMenu > reference, std::initializer_list< PopupEntry > entries, const PopupMenuOptions &options={}) &noexcept
 Bind a loaded popup and retain the first registration failure for checked prepare/runApp.
SceneResourceOptions && popupMenu (std::string_view name, Ref< PopupMenu > reference, std::initializer_list< PopupEntry > entries, const PopupMenuOptions &options={}) &&noexcept
 Bind a loaded popup on a temporary without copying existing adapters.
template<class T, class Factory>
requires detail::ResourceFactory<T, std::decay_t<Factory>>
SceneResourceOptions & control (std::string_view name, Factory &&factory, bool children=false) &noexcept
 Register a typed resource control and retain the first failure for checked prepare/runApp.
template<class T, class Factory, class Schema>
requires detail::ResourceFactory<T, std::decay_t<Factory>> && std::same_as<std::remove_cvref_t<Schema>, std::span<const
ControlPropertyDescriptor>>
SceneResourceOptions & control (std::string_view name, Factory &&factory, Schema &&schema) &noexcept
 Select a finite native composite schema and collect registration failure for prepare/runApp.
template<class T, class Factory, class Schema>
requires detail::ResourceFactory<T, std::decay_t<Factory>> && std::same_as<std::remove_cvref_t<Schema>, std::span<const
ControlPropertyDescriptor>>
SceneResourceOptions && control (std::string_view name, Factory &&factory, Schema &&schema) &&noexcept
 Select the finite native composite schema on a temporary without adapter copies.
template<class T, class Factory>
requires detail::ResourceFactory<T, std::decay_t<Factory>>
SceneResourceOptions && control (std::string_view name, Factory &&factory, bool children=false) &&noexcept
 Register on a temporary without copying its existing adapters.

Public Attributes

SceneResourceRegistry registry {}
 Owning copied/moved typed allowlist and factory captures.
TextResolver resolver {}
 Existing owning synchronous i18n adapter, used only at prepare.
SceneResourceLimits limits {}
 Finite parser bounds, independent of managed/tree limits.
detail::ResourceRegistrationState registration {}
 Internal sticky failure; not a configuration/reset API.
SceneResourceFormat format
 Explicit grammar; ordinary resources retain their syntax.
std::optional< ControlContext > controls {}
 Local immutable snapshot; absent inherits the containing scene context.

Detailed Description

Explicit resource-loader configuration; no process-global registry or locale. Configure without concurrent access, then transfer/copy into a scene on its UI thread. Factories own their captures; referenced services must outlive synchronous prepare. Copies retain the first fluent registration failure; checked registry.add failures are independent.

Member Function Documentation

◆ control() [1/4]

template<class T, class Factory>
requires detail::ResourceFactory<T, std::decay_t<Factory>>
SceneResourceOptions && portals::ui::SceneResourceOptions::control ( std::string_view name,
Factory && factory,
bool children = false ) &&
inlinenoexcept

Register on a temporary without copying its existing adapters.

Template Parameters
TPublic Widget subtype returned by the factory.
FactoryCopyable typed recipe factory, as in the lvalue overload.
Parameters
nameUnique case-sensitive ASCII identifier copied now.
factoryOwning callable transferred into the registry; borrows outlive prepare.
childrenWhether resource child nodes are allowed.
Returns
This configuration as an rvalue, with the same sticky checked-error contract.

◆ control() [2/4]

template<class T, class Factory>
requires detail::ResourceFactory<T, std::decay_t<Factory>>
SceneResourceOptions & portals::ui::SceneResourceOptions::control ( std::string_view name,
Factory && factory,
bool children = false ) &
inlinenoexcept

Register a typed resource control and retain the first failure for checked prepare/runApp.

Template Parameters
TPublic Widget subtype returned by the factory, including final types.
FactoryCopyable callable accepting owning SceneResourceArguments and returning Description<T> or exactly expected<Description<T>, ManagedError>.
Parameters
nameCase-sensitive ASCII identifier copied now, unique including builtin names.
factoryOwning adapter copied/moved now and invoked at prepare after validation. Borrowed captures must outlive prepare; no factory is invoked during registration.
childrenWhether this type accepts resource child nodes; defaults to a leaf.
Returns
This same configuration for chaining. The first failure stops later fluent registrations and rejects prepare before file reads, parsing, resolvers, factories or terminal entry. Internal allocation/capture exceptions become NO_MEMORY/CALLBACK_FAILED; caller argument evaluation and construction/copying of the options or scene may still throw.

◆ control() [3/4]

template<class T, class Factory, class Schema>
requires detail::ResourceFactory<T, std::decay_t<Factory>> && std::same_as<std::remove_cvref_t<Schema>, std::span<const
ControlPropertyDescriptor>>
SceneResourceOptions && portals::ui::SceneResourceOptions::control ( std::string_view name,
Factory && factory,
Schema && schema ) &&
inlinenoexcept

Select the finite native composite schema on a temporary without adapter copies.

Template Parameters
TFactory widget result.
FactoryExisting resource callable.
SchemaCanonical span.
Parameters
nameUnique owning name.
factoryOwning actual native composite recipe producer.
schemaComplete metadata read only now.
Returns
This rvalue, with the same sticky error boundary.

◆ control() [4/4]

template<class T, class Factory, class Schema>
requires detail::ResourceFactory<T, std::decay_t<Factory>> && std::same_as<std::remove_cvref_t<Schema>, std::span<const
ControlPropertyDescriptor>>
SceneResourceOptions & portals::ui::SceneResourceOptions::control ( std::string_view name,
Factory && factory,
Schema && schema ) &
inlinenoexcept

Select a finite native composite schema and collect registration failure for prepare/runApp.

Template Parameters
TFactory widget result.
FactoryExisting owning resource callable.
SchemaExactly the canonical metadata span; no span is retained.
Parameters
nameUnique owning registry name.
factoryReal native MessageBox or Notifications recipe factory.
schemaComplete canonical native composite vocabulary, checked immediately by content.
Returns
This configuration; the existing first-error and exception boundary is preserved.

◆ popupMenu() [1/2]

SceneResourceOptions && portals::ui::SceneResourceOptions::popupMenu ( std::string_view name,
Ref< PopupMenu > reference,
std::initializer_list< PopupEntry > entries,
const PopupMenuOptions & options = {} ) &&
inlinenoexcept

Bind a loaded popup on a temporary without copying existing adapters.

Parameters
nameUnique owning resource type name.
referenceObserving popup slot.
entriesCode-owned action tree copied now.
optionsPopup settings borrowed only now; copied inside the checked boundary.
Returns
This rvalue, with the same sticky checked-error contract as the lvalue overload.

◆ popupMenu() [2/2]

SceneResourceOptions & portals::ui::SceneResourceOptions::popupMenu ( std::string_view name,
Ref< PopupMenu > reference,
std::initializer_list< PopupEntry > entries,
const PopupMenuOptions & options = {} ) &
inlinenoexcept

Bind a loaded popup and retain the first registration failure for checked prepare/runApp.

Parameters
nameUnique case-sensitive resource type name copied now.
referenceObserving popup slot, bound when the resource mounts.
entriesOwning code-defined action tree copied now; no ActionRefs are deserialized.
optionsFinite popup budgets and caps, borrowed only during this call; the registry copies them inside the checked exception boundary.
Returns
This configuration for chaining. The first failure stops later fluent registrations and rejects prepare before file reads, parsing, resolvers, factories or terminal entry. Internal allocation/capture exceptions become NO_MEMORY/CALLBACK_FAILED; caller argument evaluation and construction/copying of the options or scene may still throw.

Member Data Documentation

◆ format

SceneResourceFormat portals::ui::SceneResourceOptions::format
Initial value:
{
SceneResourceFormat::LEGACY}

Explicit grammar; ordinary resources retain their syntax.


The documentation for this struct was generated from the following file: