A scope's declarations (spec 5 §3): model aliases, state, let, queries, mutations, watches and checks. A row, a dialog, a drawer and a switch case declare theirs on the scope their builder hands over.
More...
#include <author.hpp>
|
|
| DeclScope ()=default |
| | An empty scope.
|
| template<typename Model> |
| ModelHandle< Model > | model (std::string const &alias, ModelOptions const &options={}) |
| | A model alias.
|
| template<typename T> |
| Handle< T > | state (std::string const &name) |
| | State with a declared type and no initial value; it starts null.
|
| template<typename T> |
| Handle< T > | state (std::string const &name, Handle< T > const &init) |
| | State initialised from an expression; its type is T's.
|
template<typename L>
requires detail::Literal<L> |
| Handle< detail::LiteralT< L > > | state (std::string const &name, L const &init) |
| | State initialised from a constant; its type is the constant's.
|
| template<typename T> |
| Handle< T > | let (std::string const &name, Handle< T > const &value) |
| | A derived value (let).
|
template<typename Action, typename Model>
requires Runs<Model, Action> |
| QueryHandle< Action > | query (std::string const &name, ModelHandle< Model > const &model, Body< Action > const &body={}, QueryOptions const &options={}) |
| | A query (spec 5 §5).
|
template<typename Action, typename Model>
requires Runs<Model, Action> |
| QueryHandle< Action, Action > | evaluate (std::string const &name, ModelHandle< Model > const &model, Body< Action > const &body={}, QueryOptions const &options={}) |
| | A query that evaluates an action without running it: the server returns its calculated fields and field errors (spec 5 §7).
|
template<typename Action, typename Model>
requires Runs<Model, Action> |
| MutationHandle< Action > | mutation (std::string const &name, ModelHandle< Model > const &model, MutationOptions< Action > const &options={}) |
| | A mutation (spec 5 §5).
|
| void | watch (AnyHandle const &watched, Commands const &commands, Source source=Source::Any) |
| | A cascade: commands that run when a value changes (spec 5 §6).
|
| void | check (CheckOptions const &options) |
| | A validation across elements (spec 5 §6).
|
| bool | empty () const |
| | Whether the scope declares nothing.
|
| void | writeTo (Json &out) const |
| | Writes the declarations into a document or a "scope" object, in the document's order.
|
| CatalogFacts const & | facts () const noexcept |
| | The catalog facts of the models and actions the scope names.
|
A scope's declarations (spec 5 §3): model aliases, state, let, queries, mutations, watches and checks. A row, a dialog, a drawer and a switch case declare theirs on the scope their builder hands over.
Definition at line 2045 of file author.hpp.
◆ model()
template<typename Model>
| ModelHandle< Model > morph::ui::author::DeclScope::model |
( |
std::string const & | alias, |
|
|
ModelOptions const & | options = {} ) |
|
inline |
A model alias.
- Template Parameters
-
- Parameters
-
| alias | The alias. |
| options | How it binds. |
- Returns
- The alias's handle.
Definition at line 2056 of file author.hpp.
◆ state() [1/3]
template<typename T>
| Handle< T > morph::ui::author::DeclScope::state |
( |
std::string const & | name | ) |
|
|
inline |
State with a declared type and no initial value; it starts null.
- Template Parameters
-
- Parameters
-
- Returns
- The read of the state.
Definition at line 2072 of file author.hpp.
◆ state() [2/3]
template<typename T>
| Handle< T > morph::ui::author::DeclScope::state |
( |
std::string const & | name, |
|
|
Handle< T > const & | init ) |
|
inline |
State initialised from an expression; its type is T's.
- Template Parameters
-
- Parameters
-
| name | The state's name. |
| init | The initial value. |
- Returns
- The read of the state.
Definition at line 2082 of file author.hpp.
◆ state() [3/3]
template<typename L>
requires detail::Literal<L>
| Handle< detail::LiteralT< L > > morph::ui::author::DeclScope::state |
( |
std::string const & | name, |
|
|
L const & | init ) |
|
inline |
State initialised from a constant; its type is the constant's.
- Template Parameters
-
| L | The constant's C++ type. |
- Parameters
-
| name | The state's name. |
| init | The initial value. |
- Returns
- The read of the state.
Definition at line 2093 of file author.hpp.
◆ let()
template<typename T>
| Handle< T > morph::ui::author::DeclScope::let |
( |
std::string const & | name, |
|
|
Handle< T > const & | value ) |
|
inline |
A derived value (let).
- Template Parameters
-
- Parameters
-
| name | The name. |
| value | The expression. |
- Returns
- The read of the name.
Definition at line 2103 of file author.hpp.
◆ query()
template<typename
Action, typename Model>
requires Runs<Model,
Action>
A query (spec 5 §5).
- Template Parameters
-
| Action | The action it runs. |
| Model | The model type of the alias; it must run the action. |
- Parameters
-
| name | The query's name. |
| model | The alias it goes through. |
| body | The body, which is the query's key. |
| options | The gate and timing. |
- Returns
- The query's handle.
Definition at line 2118 of file author.hpp.
◆ evaluate()
template<typename
Action, typename Model>
requires Runs<Model,
Action>
A query that evaluates an action without running it: the server returns its calculated fields and field errors (spec 5 §7).
- Template Parameters
-
| Action | The action it evaluates. |
| Model | The model type of the alias; it must run the action. |
- Parameters
-
| name | The query's name. |
| model | The alias it goes through. |
| body | The body, which is the query's key. |
| options | The gate and timing. |
- Returns
- The query's handle. Its value is the action body as the server reconciled it, computed fields filled, with errors and ready beside the fields.
Definition at line 2136 of file author.hpp.
◆ mutation()
template<typename
Action, typename Model>
requires Runs<Model,
Action>
A mutation (spec 5 §5).
- Template Parameters
-
| Action | The action it runs. |
| Model | The model type of the alias; it must run the action. |
- Parameters
-
| name | The mutation's name. |
| model | The alias it goes through. |
| options | Its body, concurrency, optimistic write and command lists. |
- Returns
- The mutation's handle.
Definition at line 2151 of file author.hpp.
◆ watch()
A cascade: commands that run when a value changes (spec 5 §6).
- Parameters
-
| watched | The value watched. |
| commands | The commands. |
| source | Which changes run it. |
Definition at line 2170 of file author.hpp.
◆ check()
| void morph::ui::author::DeclScope::check |
( |
CheckOptions const & | options | ) |
|
|
inline |
A validation across elements (spec 5 §6).
- Parameters
-
Definition at line 2182 of file author.hpp.
◆ empty()
| bool morph::ui::author::DeclScope::empty |
( |
| ) |
const |
|
inlinenodiscard |
Whether the scope declares nothing.
- Returns
- True when it declares nothing.
Definition at line 2205 of file author.hpp.
◆ writeTo()
| void morph::ui::author::DeclScope::writeTo |
( |
Json & | out | ) |
const |
|
inline |
Writes the declarations into a document or a "scope" object, in the document's order.
- Parameters
-
| out | The object to write into. |
Definition at line 2214 of file author.hpp.
◆ facts()
| CatalogFacts const & morph::ui::author::DeclScope::facts |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
The catalog facts of the models and actions the scope names.
- Returns
- The facts.
Definition at line 2230 of file author.hpp.
◆ recordedFacts()
| CatalogFacts & morph::ui::author::DeclScope::recordedFacts |
( |
| ) |
|
|
inlinenodiscardprotectednoexcept |
The catalog facts, for a scope that records more.
- Returns
- The facts.
Definition at line 2235 of file author.hpp.
The documentation for this class was generated from the following file: