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

What an evaluated expression reads: the interpreter implements it over its reactive values. More...

#include <expression.hpp>

Inheritance diagram for morph::ui::Environment:
morph::ui::StaticEnvironment morph::ui::detail::ScopeEnv morph::ui::detail::host::ParamsEnv

Public Member Functions

 Environment (Environment const &)=delete
Environment & operator= (Environment const &)=delete
 Environment (Environment &&)=delete
Environment & operator= (Environment &&)=delete
virtual Value ref (std::string_view head, std::span< std::string const > path) const =0
 Reads {"ref": "head.path"}.
virtual Value row (std::span< std::string const > path) const =0
 Reads {"row": "path"}.
virtual Value control (ExprKind form, std::string_view name) const =0
 Reads query, pending, error, result, errorKind or can.
virtual Value pref (std::string_view point, std::span< std::string const > path) const =0
 Reads {"pref": "point.path"}.
virtual Value client (ExprKind form, std::string_view name) const =0
 Reads env, session or host.
virtual FormatContext const & formatting () const =0
 The formatting facts.
virtual void report (std::string_view path, std::string_view reason) const =0
 Reports a runtime error of an expression.

Detailed Description

What an evaluated expression reads: the interpreter implements it over its reactive values.

Every read returns a value; a name the environment does not hold reads as null. report is the client's diagnostic channel: the evaluator reports each runtime error there, with the expression's path.

Definition at line 1066 of file expression.hpp.

Member Function Documentation

◆ ref()

virtual Value morph::ui::Environment::ref ( std::string_view head,
std::span< std::string const > path ) const
nodiscardpure virtual

Reads {"ref": "head.path"}.

Parameters
headThe first segment.
pathThe segments after it.
Returns
The value.

Implemented in morph::ui::detail::host::ParamsEnv, morph::ui::detail::ScopeEnv, and morph::ui::StaticEnvironment.

◆ row()

virtual Value morph::ui::Environment::row ( std::span< std::string const > path) const
nodiscardpure virtual

Reads {"row": "path"}.

Parameters
pathThe field path inside the innermost row.
Returns
The value.

Implemented in morph::ui::detail::host::ParamsEnv, morph::ui::detail::ScopeEnv, and morph::ui::StaticEnvironment.

◆ control()

virtual Value morph::ui::Environment::control ( ExprKind form,
std::string_view name ) const
nodiscardpure virtual

Reads query, pending, error, result, errorKind or can.

Parameters
formThe form.
nameThe query or mutation.
Returns
The value: a bool for pending and can.

Implemented in morph::ui::detail::host::ParamsEnv, morph::ui::detail::ScopeEnv, and morph::ui::StaticEnvironment.

◆ pref()

virtual Value morph::ui::Environment::pref ( std::string_view point,
std::span< std::string const > path ) const
nodiscardpure virtual

Reads {"pref": "point.path"}.

Parameters
pointThe customization point.
pathThe segments after it.
Returns
The value.

Implemented in morph::ui::detail::host::ParamsEnv, morph::ui::detail::ScopeEnv, and morph::ui::StaticEnvironment.

◆ client()

virtual Value morph::ui::Environment::client ( ExprKind form,
std::string_view name ) const
nodiscardpure virtual

Reads env, session or host.

Parameters
formThe form.
nameThe name read.
Returns
The value.

Implemented in morph::ui::detail::host::ParamsEnv, morph::ui::detail::ScopeEnv, and morph::ui::StaticEnvironment.

◆ formatting()

virtual FormatContext const & morph::ui::Environment::formatting ( ) const
nodiscardpure virtual

The formatting facts.

Returns
The context the display functions and t use.

Implemented in morph::ui::detail::host::ParamsEnv, morph::ui::detail::ScopeEnv, and morph::ui::StaticEnvironment.

◆ report()

virtual void morph::ui::Environment::report ( std::string_view path,
std::string_view reason ) const
pure virtual

Reports a runtime error of an expression.

Parameters
pathThe JSON Pointer of the expression node that failed.
reasonWhat went wrong.

Implemented in morph::ui::detail::host::ParamsEnv, morph::ui::detail::ScopeEnv, and morph::ui::StaticEnvironment.


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