morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::author::ScreenRegistry Class Reference

The screens of an application, each validated once when it is registered. More...

#include <author.hpp>

Public Member Functions

std::expected< RegisteredScreen const *, Refusal > add (Screen const &screen)
 Registers a screen.
template<std::invocable Make>
void enroll (Make const &make) noexcept
 Registers a screen and keeps its refusal rather than returning it, for registration at static initialisation, where nothing could report it; a server's test asserts refusals() is empty and lost() is zero.
void enroll (Screen const &screen) noexcept
 Registers a screen and keeps its refusal rather than returning it.
std::size_t lost () const noexcept
 How many enrolments failed without a refusal to keep, because something threw outside the builder.
RegisteredScreen const * find (std::string_view screenId) const
 A registered screen by id.
std::size_t size () const noexcept
 How many screens are registered.
std::vector< Refusal > const & refusals () const noexcept
 The refusals enroll kept.
Catalog catalog () const
 The catalog of every model and action the registered screens name, for a local-mode client.

Detailed Description

The screens of an application, each validated once when it is registered.

Registration emits a screen's JSON once, loads it with loadDocumentText and the registry's catalog — the facts of every model and action the registered screens name, the screen's own first — and then runs checkAccessibility. A screen that fails is not registered.

Definition at line 4583 of file author.hpp.

Member Function Documentation

◆ add()

std::expected< RegisteredScreen const *, Refusal > morph::ui::author::ScreenRegistry::add ( Screen const & screen)
inline

Registers a screen.

Parameters
screenThe screen.
Returns
The registered screen, or the first refusal: the builder's, the load-time validation's, an accessibility rule's, or a duplicate id.

Definition at line 4589 of file author.hpp.

◆ enroll() [1/2]

template<std::invocable Make>
void morph::ui::author::ScreenRegistry::enroll ( Make const & make)
inlinenoexcept

Registers a screen and keeps its refusal rather than returning it, for registration at static initialisation, where nothing could report it; a server's test asserts refusals() is empty and lost() is zero.

Never throws, because its caller is a static initialiser, where an exception cannot be caught. A builder's own exceptions are already refusals; anything thrown while making the screen or keeping its refusal, such as an allocation failure, is counted by lost().

Template Parameters
MakeA callable that returns the Screen.
Parameters
makeMakes the screen; it is called inside the registration, so its exceptions are caught too.

Definition at line 4626 of file author.hpp.

◆ enroll() [2/2]

void morph::ui::author::ScreenRegistry::enroll ( Screen const & screen)
inlinenoexcept

Registers a screen and keeps its refusal rather than returning it.

Parameters
screenThe screen.

Definition at line 4639 of file author.hpp.

◆ lost()

std::size_t morph::ui::author::ScreenRegistry::lost ( ) const
inlinenodiscardnoexcept

How many enrolments failed without a refusal to keep, because something threw outside the builder.

Returns
The count.

Definition at line 4645 of file author.hpp.

◆ find()

RegisteredScreen const * morph::ui::author::ScreenRegistry::find ( std::string_view screenId) const
inlinenodiscard

A registered screen by id.

Parameters
screenIdThe id.
Returns
The screen, or nullptr.

Definition at line 4650 of file author.hpp.

◆ size()

std::size_t morph::ui::author::ScreenRegistry::size ( ) const
inlinenodiscardnoexcept

How many screens are registered.

Returns
The count.

Definition at line 4661 of file author.hpp.

◆ refusals()

std::vector< Refusal > const & morph::ui::author::ScreenRegistry::refusals ( ) const
inlinenodiscardnoexcept

The refusals enroll kept.

Returns
The refusals, in order.

Definition at line 4665 of file author.hpp.

◆ catalog()

Catalog morph::ui::author::ScreenRegistry::catalog ( ) const
inlinenodiscard

The catalog of every model and action the registered screens name, for a local-mode client.

Returns
The catalog.

Definition at line 4669 of file author.hpp.


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