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

The server's preferences model: reads and writes the calling person's choices through a store. More...

#include <preferences.hpp>

Public Member Functions

 PreferencesModel (std::shared_ptr< IPreferencesStore > store, PreferencesOptions options)
 A model over store.
::core::async::Task< PrefValues > execute (PrefLoad request)
 Reads the caller's stored choices of request's points.
::core::async::Task< PrefStored > execute (PrefSet request)
 Stores the caller's choice.
::core::async::Task< PrefRemoved > execute (PrefRemove request)
 Forgets the caller's choice.

Detailed Description

The server's preferences model: reads and writes the calling person's choices through a store.

The person is the principal of the verified session (session::current()), which RemoteServer stamps from the authoriser before dispatch. The authoriser sees the model and the action, never the body, so the model is where the key is decided: no request names a person, and one that tries reaches only its own caller's entries. With no verified principal there is no key that belongs to the caller alone, so load answers nothing and set and remove are refused.

Definition at line 203 of file preferences.hpp.

Constructor & Destructor Documentation

◆ PreferencesModel()

morph::ui::PreferencesModel::PreferencesModel ( std::shared_ptr< IPreferencesStore > store,
PreferencesOptions options )
inline

A model over store.

Parameters
storeWhere choices are kept. Shared by every instance.
optionsThe bounds.

Definition at line 208 of file preferences.hpp.

Member Function Documentation

◆ execute() [1/3]

::core::async::Task< PrefValues > morph::ui::PreferencesModel::execute ( PrefLoad request)
inline

Reads the caller's stored choices of request's points.

Parameters
requestThe application, the scope and the points.
Returns
The stored JSON text of each point that has an entry.

Definition at line 219 of file preferences.hpp.

◆ execute() [2/3]

::core::async::Task< PrefStored > morph::ui::PreferencesModel::execute ( PrefSet request)
inline

Stores the caller's choice.

Parameters
requestThe key's application, scope and point, and the choice's JSON text.
Returns
Whether the store took it.

Definition at line 247 of file preferences.hpp.

◆ execute() [3/3]

::core::async::Task< PrefRemoved > morph::ui::PreferencesModel::execute ( PrefRemove request)
inline

Forgets the caller's choice.

Parameters
requestThe key's application, scope and point.
Returns
Whether an entry was there.

Definition at line 264 of file preferences.hpp.


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