|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
What the application answers for the commands a document cannot carry out alone (spec 6). Every default answers "not supported", which the interpreter reports as a diagnostic. More...
#include <interpreter.hpp>
Public Member Functions | |
| InterpreterHost (InterpreterHost const &)=delete | |
| InterpreterHost & | operator= (InterpreterHost const &)=delete |
| InterpreterHost (InterpreterHost &&)=delete | |
| InterpreterHost & | operator= (InterpreterHost &&)=delete |
| virtual bool | navigate (NavigateRequest const &request, std::function< void(Value)> onResult, std::function< void()> onCancel) |
| Opens another screen. | |
| virtual bool | closeSelf (std::string const &screen, std::optional< Value > result) |
| Ends the screen that ran return or close: self. | |
| virtual bool | hostCommand (std::string const &name, Value const &args) |
| Runs a command the application registered (host/1). | |
| virtual bool | switchBackend (std::string const &name, std::function< void(std::expected< void, std::string >)> done) |
| Switches to a backend the application's source lists (AppSource::switchBackend, spec 6 §9). | |
| virtual void | resetPrefs (std::string const &screen, std::string const &point) |
| The document reset a customization point, or all of them; the host forgets the stored choice. | |
| virtual void | setLocale (std::string const &locale) |
| Stores the active locale as a preference. The interpreter has already re-resolved every t. | |
| virtual bool | notify (std::string const &text, std::string const &role) |
| Shows a transient message. | |
| virtual bool | signIn (Value const &reply) |
| Installs the session the reply of a sign-in mutation carries, and reloads the catalog. | |
| virtual void | signOut () |
| Ends the session. The interpreter has already cleared the session's query cache. | |
| virtual bool | setAppValue (std::string const &name, Value const &value) |
| Writes app.name with set (spec 6 §5). | |
| virtual bool | upload (Value const &file, std::function< void(Value)> progress, std::function< void(std::expected< Value, std::string >)> done) |
| Sends a file through the server's file side channel (files/1). | |
| virtual bool | uploadFor (UploadRequest const &request, std::function< void(Value)> progress, std::function< void(std::expected< Value, std::string >)> done) |
| Sends a file through the server's file side channel, knowing the mutation that will reference it. The interpreter calls this one; the default calls upload(file, …), so a host that overrides only that keeps working. | |
| virtual bool | download (Value const &file, std::string const &option, Value const &name, std::function< void(std::expected< Value, std::string >)> done) |
| Fetches a file by reference to save it, or to a local temporary reference for a viewer. | |
| virtual bool | readFile (Value const &file, std::size_t maxBytes, std::function< void(std::expected< InlineFile, std::string >)> done) |
Reads a file's bytes for upload into bytes. A host reads the file's size first and refuses one over maxBytes without reading it; the interpreter refuses a reply over the cap as well. | |
| virtual bool | saveFile (InlineFile const &file, std::string const &option, std::function< void(std::expected< Value, std::string >)> done) |
| Saves a file a document holds the bytes of, for download from bytes. | |
| virtual void | preferenceChanged (std::string const &screen, std::string const &point, Value const &value) |
| The user chose at a customization point through a customize editor; the host stores the choice. | |
| virtual void | permissionsStale () |
| A call was refused with error kind denied: the permitted set is a snapshot, so the host asks the server again and calls Session::setPermitted. | |
What the application answers for the commands a document cannot carry out alone (spec 6). Every default answers "not supported", which the interpreter reports as a diagnostic.
Definition at line 227 of file interpreter.hpp.
|
inlinevirtual |
Opens another screen.
| request | What to open. |
| onResult | Called with the value a screen opened as a dialog, drawer or window returns. |
| onCancel | Called when such a screen closes without a value. |
Definition at line 244 of file interpreter.hpp.
|
inlinevirtual |
Ends the screen that ran return or close: self.
| screen | The screen's id. |
| result | The value of return; std::nullopt for close: self. |
Definition at line 256 of file interpreter.hpp.
|
inlinevirtual |
Runs a command the application registered (host/1).
| name | The command. |
| args | Its arguments; null when none. |
Definition at line 266 of file interpreter.hpp.
|
inlinevirtual |
Switches to a backend the application's source lists (AppSource::switchBackend, spec 6 §9).
The switch is asynchronous: the host calls done once, on the runtime's owner, when it committed or failed. A failed switch leaves the old backend in place.
| name | The backend. |
| done | Called once with nothing when the switch committed, or with why it failed. Not called when the backend is not listed. |
Definition at line 280 of file interpreter.hpp.
|
inlinevirtual |
The document reset a customization point, or all of them; the host forgets the stored choice.
| screen | The screen's id. |
| point | The point, or all. |
Definition at line 289 of file interpreter.hpp.
|
inlinevirtual |
Stores the active locale as a preference. The interpreter has already re-resolved every t.
| locale | The BCP 47 locale. |
Definition at line 296 of file interpreter.hpp.
|
inlinevirtual |
Shows a transient message.
| text | The message. |
| role | info, success, warning or error; empty for the default. |
Reimplemented in morph::client::ApplicationHost.
Definition at line 302 of file interpreter.hpp.
|
inlinevirtual |
Installs the session the reply of a sign-in mutation carries, and reloads the catalog.
| reply | The mutation's reply, secret fields included. |
Reimplemented in morph::client::ApplicationHost.
Definition at line 311 of file interpreter.hpp.
|
inlinevirtual |
Ends the session. The interpreter has already cleared the session's query cache.
Reimplemented in morph::client::ApplicationHost.
Definition at line 317 of file interpreter.hpp.
|
inlinevirtual |
Writes app.name with set (spec 6 §5).
| name | The app state's name. |
| value | The value. |
Definition at line 323 of file interpreter.hpp.
|
inlinevirtual |
Sends a file through the server's file side channel (files/1).
| file | What the user picked or dropped. |
| progress | Called with the progress, 0 to 1. |
| done | Called once with the file's reference, or the failure's text. |
Definition at line 334 of file interpreter.hpp.
|
inlinevirtual |
Sends a file through the server's file side channel, knowing the mutation that will reference it. The interpreter calls this one; the default calls upload(file, …), so a host that overrides only that keeps working.
| request | The file and the mutation. |
| progress | Called with the progress, 0 to 1. |
| done | Called once with the file's reference, or the failure's text. |
Definition at line 349 of file interpreter.hpp.
|
inlinevirtual |
Fetches a file by reference to save it, or to a local temporary reference for a viewer.
| file | The file's reference. |
| option | dialog to save, preview for a local reference. |
| name | The suggested file name; null when none. |
| done | Called once with the local reference (preview) or null (dialog), or the failure. |
Definition at line 360 of file interpreter.hpp.
|
inlinevirtual |
Reads a file's bytes for upload into bytes. A host reads the file's size first and refuses one over maxBytes without reading it; the interpreter refuses a reply over the cap as well.
| file | What the user picked or dropped. |
| maxBytes | The session's inline cap. |
| done | Called once with the file, or the failure's text. |
Definition at line 375 of file interpreter.hpp.
|
inlinevirtual |
Saves a file a document holds the bytes of, for download from bytes.
| file | The file. |
| option | dialog to save, preview for a local reference. |
| done | Called once with the local reference (preview) or null (dialog), or the failure. |
Definition at line 388 of file interpreter.hpp.
|
inlinevirtual |
The user chose at a customization point through a customize editor; the host stores the choice.
| screen | The screen's id. |
| point | The point. |
| value | The choice. |
Definition at line 400 of file interpreter.hpp.
|
inlinevirtual |
A call was refused with error kind denied: the permitted set is a snapshot, so the host asks the server again and calls Session::setPermitted.
Definition at line 408 of file interpreter.hpp.