morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
preferences.hpp File Reference

Per-person storage of customization choices (spec 5 §12b, spec 6 §8): the IPreferencesStore seam, the framework's in-memory store, and the server's preferences model, which keys every entry by the person the verified session names. More...

#include <cstddef>
#include <map>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>
#include "../core/completion.hpp"
#include "../core/coroutine.hpp"
#include "../core/executor.hpp"
#include "../core/model.hpp"
#include "../core/owner_strand.hpp"
#include "../core/registry.hpp"
#include "../session/session.hpp"
#include "value.hpp"

Go to the source code of this file.

Classes

struct  morph::ui::PrefKey
 Where one choice is stored. More...
class  morph::ui::IPreferencesStore
 Stores customization choices as JSON text, by PrefKey. More...
class  morph::ui::MemoryPreferencesStore
 The framework's store: a map held in memory, on its own strand. More...
struct  morph::ui::PreferencesOptions
 The preferences model's bounds. More...
struct  morph::ui::PrefLoad
 load: the stored choices of a screen's points. A request carries no person. More...
struct  morph::ui::PrefValues
 What load answers. More...
struct  morph::ui::PrefSet
 set: stores one choice. A request carries no person. More...
struct  morph::ui::PrefStored
 What set answers. More...
struct  morph::ui::PrefRemove
 remove: forgets one choice. A request carries no person. More...
struct  morph::ui::PrefRemoved
 What remove answers. More...
class  morph::ui::PreferencesModel
 The server's preferences model: reads and writes the calling person's choices through a store. More...

Functions

void morph::ui::registerPreferences (std::shared_ptr< IPreferencesStore > store, model::detail::ActionDispatcher &dispatcher, model::detail::ModelRegistryFactory &registry, PreferencesOptions options={})
 Registers the preferences model and its three actions, with a factory that gives every instance store.

Variables

constexpr std::string_view morph::ui::kPreferencesModel = "morph.preferences"
 The type id the preferences model is registered under.
constexpr std::size_t morph::ui::kMaxPrefNameBytes = 256
 The longest application, scope or point name a preferences request may carry, in bytes.
constexpr std::size_t morph::ui::kMaxPrefPoints = 256
 The most points one load may ask for.

Detailed Description

Per-person storage of customization choices (spec 5 §12b, spec 6 §8): the IPreferencesStore seam, the framework's in-memory store, and the server's preferences model, which keys every entry by the person the verified session names.

Specified in docs/spec/ui/preferences.md.

Definition in file preferences.hpp.

Function Documentation

◆ registerPreferences()

void morph::ui::registerPreferences ( std::shared_ptr< IPreferencesStore > store,
model::detail::ActionDispatcher & dispatcher,
model::detail::ModelRegistryFactory & registry,
PreferencesOptions options = {} )
inline

Registers the preferences model and its three actions, with a factory that gives every instance store.

Nothing registers it at static initialisation: a server that offers preferences calls this once, before it serves, with the dispatcher and registry its RemoteServer uses. A deployment's authoriser then admits morph.preferences and its actions load, set and remove for every signed-in principal; the model itself keeps each person to their own entries.

Parameters
storeWhere choices are kept.
dispatcherThe server's action dispatcher.
registryThe server's model registry.
optionsThe bounds.

Definition at line 336 of file preferences.hpp.

Variable Documentation

◆ kPreferencesModel

std::string_view morph::ui::kPreferencesModel = "morph.preferences"
inlineconstexpr

The type id the preferences model is registered under.

Definition at line 138 of file preferences.hpp.

◆ kMaxPrefNameBytes

std::size_t morph::ui::kMaxPrefNameBytes = 256
inlineconstexpr

The longest application, scope or point name a preferences request may carry, in bytes.

Definition at line 141 of file preferences.hpp.

◆ kMaxPrefPoints

std::size_t morph::ui::kMaxPrefPoints = 256
inlineconstexpr

The most points one load may ask for.

Definition at line 144 of file preferences.hpp.