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

Multi-step wizards: an ordered sequence of registered actions that share a "flow draft" spanning the whole sequence. More...

#include <cstddef>
#include <exception>
#include <functional>
#include <glaze/glaze.hpp>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include "../attributes.hpp"
#include "../core/bridge.hpp"
#include "../core/callback_scope.hpp"
#include "../core/logger.hpp"
#include "detail/session_common.hpp"
#include "forms.hpp"

Go to the source code of this file.

Classes

struct  morph::flows::WizardStep< Action, Title, Binds >
 One step of a Wizard: a registered action, a display title, and zero or more Bind prefill declarations. More...
struct  morph::flows::Wizard< Title, Steps >
 An ordered sequence of WizardSteps sharing one flow. More...
class  morph::flows::FlowSession< Model, Steps >
 Sequences an ordered list of registered actions (Steps...) as one multi-step flow sharing captured values across steps. More...

Macros

#define BRIDGE_REGISTER_WIZARD(W, NAME)
 Specialises morph::flows::WizardTraits<W> with the string type-id NAME.

Typedefs

template<morph::forms::FixedString Field, morph::forms::FixedString Path>
using morph::flows::Bind = morph::forms::Bind<Field, Path>
 Prefill binding for a wizard step.

Functions

template<typename W>
std::string morph::flows::wizardSchemaJson ()
 Generates the w-* JSON document for wizard type W.

Detailed Description

Multi-step wizards: an ordered sequence of registered actions that share a "flow draft" spanning the whole sequence.

A morph::flows::Wizard names an ordered list of already-registered action types (see BRIDGE_REGISTER_ACTION, registry.hpp) plus, per step, a human title and an optional Bind prefill declaration mapping that step's field name to a "<PriorAction>.<field>" path into an earlier step's submitted draft or result. wizardSchemaJson<W>() emits the w-* document a renderer consumes to build a stepper; morph::flows::FlowSession<Model, Steps...> (see the set<>/advance/ back API added alongside it) is the typed C++ sequencer that fires each step through the ordinary BridgeHandler<Model>::execute<A>() dispatch path (bridge.hpp) and tracks the resolved values a caller (or a renderer) reads to prefill a later step.

This is purely additive metadata and sequencing over the existing dispatch path: no new wire format, no new execution mode. See docs/spec/forms/workflows_navigation.md.

Definition in file flows.hpp.

Macro Definition Documentation

◆ BRIDGE_REGISTER_WIZARD

#define BRIDGE_REGISTER_WIZARD ( W,
NAME )
Value:
template <> \
static constexpr std::string_view typeId() noexcept { return NAME; } \
};
Traits specialisation mapping a Wizard type to its string type-id.
Definition flows.hpp:96

Specialises morph::flows::WizardTraits<W> with the string type-id NAME.

Metadata only: unlike BRIDGE_REGISTER_ACTION, this performs no static-init registration into any dispatch registry — a wizard is never itself executed, only its steps' already-registered actions are (see docs/spec/forms/workflows_navigation.md).

Parameters
WConcrete morph::flows::Wizard<...> type.
NAMEString literal used as the wizard's type-id.

Definition at line 464 of file flows.hpp.

Typedef Documentation

◆ Bind

Prefill binding for a wizard step.

Alias for morph::forms::Bind, which both session types share. Kept in this namespace because it is the name shipped consumers already write.

Template Parameters
FieldThe step action's field name to prefill.
PathSource path, "<PriorAction>.<field>", into an earlier step's captured values (see FlowSession::resolved).

Definition at line 56 of file flows.hpp.

Function Documentation

◆ wizardSchemaJson()

template<typename W>
std::string morph::flows::wizardSchemaJson ( )
nodiscard

Generates the w-* JSON document for wizard type W.

Emits w-title and an ordered w-steps array; each step carries action (the step's registered action type-id), title, and — only when the step declares at least one Bind — a prefill object mapping field name to "<PriorAction>.<field>" path. See docs/spec/forms/workflows_navigation.md for the full key vocabulary.

Template Parameters
WConcrete Wizard<Title, Steps...> type.
Returns
The wizard's JSON document. Empty string only if glaze's own JSON writer fails on the assembled DOM (schema generation never throws).

Definition at line 109 of file flows.hpp.