|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
The client's host vocabulary: what it registered, and whether its documents came over a verified connection. More...
#include <host_vocabulary.hpp>
Public Member Functions | |
| void | add (HostCommand command) |
| Registers a command. | |
| void | add (HostValue value) |
| Registers a value. | |
| bool | set (std::string const &name, Value value) |
| Changes a value; every binding on it updates. | |
| void | setConnectionVerified (bool verified) |
| Says whether the documents came over a verified connection. A command not marked safeForUntrusted runs, and can is true for it, only while this is true. It starts false. | |
| void | connect (Session &session) |
Gives session the values, the names {"can": "host:name"} answers for, and the runner for {"host": name} commands. Later registrations and changes reach it too. | |
| void | describe (HelloRequest &hello) const |
| Fills the host command and value names and versions of a ui-hello request, so the server knows what this client can do before it serves a document that needs it. | |
| HostCommandResult | run (std::string const &name, Value const &args) const |
| Runs a command as a document's {"host": name, "args": args} does. | |
The client's host vocabulary: what it registered, and whether its documents came over a verified connection.
An application builds one at start-up, registers its commands and values, connects it to the interpreter's Session, and tells it when the connection is verified (spec 5 §13: a verified TLS connection, or loopback with the development flag). Until then a command not marked safeForUntrusted is refused. It lives on the runtime's owner, like the session, and outlives the session it is connected to.
Definition at line 69 of file host_vocabulary.hpp.
|
inline |
Registers a command.
| command | The command. Refused (std::invalid_argument): an invalid name, a duplicate, an argument whose name is empty or repeated or whose type does not parse, or no run. |
Definition at line 74 of file host_vocabulary.hpp.
|
inline |
Registers a value.
| value | The value. Refused (std::invalid_argument): an invalid name, a duplicate, a type that does not parse, or an initial value not of the type. |
Definition at line 98 of file host_vocabulary.hpp.
|
inline |
Changes a value; every binding on it updates.
| name | The value. |
| value | Its new value. |
value has its type; otherwise nothing changes. Definition at line 117 of file host_vocabulary.hpp.
|
inline |
Says whether the documents came over a verified connection. A command not marked safeForUntrusted runs, and can is true for it, only while this is true. It starts false.
| verified | Whether the connection is verified. |
Definition at line 132 of file host_vocabulary.hpp.
|
inline |
Gives session the values, the names {"can": "host:name"} answers for, and the runner for {"host": name} commands. Later registrations and changes reach it too.
| session | The session. Borrowed: this vocabulary outlives its use of it. |
Definition at line 140 of file host_vocabulary.hpp.
|
inline |
Fills the host command and value names and versions of a ui-hello request, so the server knows what this client can do before it serves a document that needs it.
| hello | The request. |
Definition at line 148 of file host_vocabulary.hpp.
|
inlinenodiscard |
Runs a command as a document's {"host": name, "args": args} does.
| name | The command. |
| args | Its arguments: a record, or null for none. |
Definition at line 162 of file host_vocabulary.hpp.