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

Unordered sections: N independently editable action drafts on one screen, each with its own readiness gate and no sequencing. More...

#include <cstddef>
#include <exception>
#include <functional>
#include <glaze/glaze.hpp>
#include <optional>
#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"

Go to the source code of this file.

Classes

struct  morph::forms::Section< Action, Title, Binds >
 One section of a SectionGroup: a registered action, a display title, and zero or more Bind prefill declarations. More...
struct  morph::forms::SectionGroup< Title, Sections >
 An unordered set of Sections sharing one screen. More...
class  morph::forms::SectionSet< Model, Sections >
 Drives N independently editable action drafts on one screen. More...

Macros

#define BRIDGE_REGISTER_SECTION_GROUP(G, NAME)
 Specialises morph::forms::SectionGroupTraits<G> with the string type-id NAME.

Functions

template<typename G>
std::string morph::forms::sectionGroupSchemaJson ()
 Generates the s-* JSON document for section group G.

Detailed Description

Unordered sections: N independently editable action drafts on one screen, each with its own readiness gate and no sequencing.

The sibling to morph::flows::FlowSession. A wizard has one active step and throws on a field belonging to any other; a section set has no active section at all – every declared section is editable at every moment, and each dispatches on its own as soon as its draft validates.

Choose this when order carries no meaning (tabs, cards, a settings page) and FlowSession when it does. Like flows, this is additive metadata and dispatch bookkeeping over the ordinary BridgeHandler<Model>::execute<A>() path: no new wire format, no new execution mode. See docs/spec/forms/sections.md.

Definition in file sections.hpp.

Macro Definition Documentation

◆ BRIDGE_REGISTER_SECTION_GROUP

#define BRIDGE_REGISTER_SECTION_GROUP ( G,
NAME )
Value:
template <> \
static constexpr std::string_view typeId() noexcept { return NAME; } \
};
Traits specialisation mapping a SectionGroup type to its string type-id.
Definition sections.hpp:79

Specialises morph::forms::SectionGroupTraits<G> with the string type-id NAME.

Definition at line 338 of file sections.hpp.

Function Documentation

◆ sectionGroupSchemaJson()

template<typename G>
std::string morph::forms::sectionGroupSchemaJson ( )
nodiscard

Generates the s-* JSON document for section group G.

Emits s-id, s-title, and an s-sections array; each entry carries action (the section's registered action type-id), title, and — only when the section declares at least one Bind — a prefill object mapping field name to "<ActionTypeId>.<field>" path.

Deliberately emits no index or order field. A renderer arranges the sections itself, and a position in the document would suggest a sequence this type does not have.

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

Definition at line 96 of file sections.hpp.