|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Collects an application's screens and files and builds the bundle the UI service serves. More...
#include <service.hpp>
Public Member Functions | |
| UiRegistry (ApplicationInfo application, Catalog catalog={}) | |
| An empty registry. | |
| std::expected< void, Refusal > | addScreen (CatalogEntry entry, std::string text) |
| Registers a screen: its catalog entry and its document. | |
| std::expected< void, Refusal > | addEntry (CatalogEntry entry) |
| Lists an entry that has no document: a host screen (host), or one the application has not built (available: false). | |
| std::expected< void, Refusal > | addFile (BundleFile file) |
| Adds a file that is not a screen: the app document (app, whose id is app), a theme (theme), a message catalogue (messages), a delivered component (component) or an icon (icon). | |
| void | requireVocabulary (std::string vocabulary) |
| Adds a vocabulary the bundle needs beyond ui/1 and expr/1, such as forms/1 or files/1. A client that does not speak it is refused at ui-hello. | |
| std::expected< std::shared_ptr< ServedBundle const >, Refusal > | build () const |
| Builds the bundle. | |
Collects an application's screens and files and builds the bundle the UI service serves.
Built once, before the service answers anything; build copies everything into an immutable ServedBundle. A screen authored with the C++ builders is added by its emitted text, so an authoring registry feeds this one through addScreen without either depending on the other.
Definition at line 285 of file service.hpp.
|
inlineexplicit |
An empty registry.
| application | The application ui-hello names. |
| catalog | The catalog facts: load-time validation reads them at registration, and the ui-catalog reply carries them to the client. A lookup left empty is neither checked nor served. |
Definition at line 292 of file service.hpp.
|
inline |
Registers a screen: its catalog entry and its document.
Refused when the entry's id is empty, longer than kMaxNameBytes, already registered, or not the document's id; when whenDenied is neither hide nor disable; when the entry names a host (a host screen has no document: addEntry); when the document is app (addFile); when the text is too large to serve; and when load-time validation refuses the document.
| entry | The catalog entry. |
| text | The document's JSON text, served byte for byte. |
Definition at line 304 of file service.hpp.
|
inline |
Lists an entry that has no document: a host screen (host), or one the application has not built (available: false).
Refused on the same entry rules as addScreen, and when the entry is neither a host screen nor unavailable.
| entry | The catalog entry. |
Definition at line 322 of file service.hpp.
|
inline |
Adds a file that is not a screen: the app document (app, whose id is app), a theme (theme), a message catalogue (messages), a delivered component (component) or an icon (icon).
Refused for another kind, an empty or over-long id, a kind and id already added, a file too large to serve, an app document that load-time validation refuses or whose id is not app, a message catalogue whose id is not i18n/LOCALE.json, that parseCatalogue refuses, or that has a pattern outside the ui/1 subset, and a theme file that is neither a theme index parseThemeIndex takes nor a token file parseTokens takes, and an icon that is not SVG text or is larger than kMaxIconBytes.
| file | The file. |
Definition at line 343 of file service.hpp.
|
inline |
Adds a vocabulary the bundle needs beyond ui/1 and expr/1, such as forms/1 or files/1. A client that does not speak it is refused at ui-hello.
| vocabulary | The vocabulary. |
Definition at line 359 of file service.hpp.
|
inlinenodiscard |
Builds the bundle.
Refused when a screen names a delivered component (qml) whose hash no component file has, when the bundle holds more than kMaxBundleFiles files or entries, and when it needs more than kMaxListItems vocabularies or a vocabulary name longer than kMaxNameBytes.
Definition at line 367 of file service.hpp.