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

Mounts UI documents (spec 5): one per client process or window, over a session and a dispatcher. More...

#include <interpreter.hpp>

Public Member Functions

 Interpreter (Session &session, Dispatcher &dispatcher, InterpreterOptions options={})
 An interpreter.
std::expected< std::unique_ptr< Screen >, Refusal > mount (std::shared_ptr< Document const > doc, ValueRecord const &params, IViewBackend &backend, MountOptions const &options={})
 Mounts a screen.
std::expected< std::unique_ptr< AppRoot >, Refusal > mountApp (std::shared_ptr< Document const > doc)
 Mounts the app document as the session's root scope (spec 6 §5).

Detailed Description

Mounts UI documents (spec 5): one per client process or window, over a session and a dispatcher.

Definition at line 3004 of file interpreter.hpp.

Constructor & Destructor Documentation

◆ Interpreter()

morph::ui::Interpreter::Interpreter ( Session & session,
Dispatcher & dispatcher,
InterpreterOptions options = {} )
inline

An interpreter.

Parameters
sessionThe session the screens share. Borrowed.
dispatcherWhere model calls go. Borrowed.
optionsThe host and the diagnostic callback.

Definition at line 3010 of file interpreter.hpp.

Member Function Documentation

◆ mount()

std::expected< std::unique_ptr< Screen >, Refusal > morph::ui::Interpreter::mount ( std::shared_ptr< Document const > doc,
ValueRecord const & params,
IViewBackend & backend,
MountOptions const & options = {} )
inlinenodiscard

Mounts a screen.

The document has loaded (loadDocument); what mounting adds is what only the opener knows: the params, and the models a {"from": alias} instance borrows. A param that is missing and not optional, a param of the wrong type, a borrowed model the opener did not lend and a document without a view are refused.

Parameters
docThe document.
paramsThe params, by name; names the document does not declare are ignored.
backendThe backend to mount on. Borrowed: it outlives the screen.
optionsWhere to mount, and the models lent.
Returns
The screen, or the refusal.

Definition at line 7678 of file interpreter.hpp.

◆ mountApp()

std::expected< std::unique_ptr< AppRoot >, Refusal > morph::ui::Interpreter::mountApp ( std::shared_ptr< Document const > doc)
inlinenodiscard

Mounts the app document as the session's root scope (spec 6 §5).

Refused: a document whose id is not app, and a second app document while one is mounted on the session.

Parameters
docThe app document, loaded.
Returns
The root, or the refusal. Keep it as long as the session's screens may read app.*.

Definition at line 7763 of file interpreter.hpp.


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