morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::forms::And< A, Conds > Struct Template Reference

Compound condition: all of Conds... hold. Nests to any depth — each Cond may itself be a leaf (Engaged, Equals, a comparison, …) or another And/Or/Not. Usable both as a nested when clause and directly as a top-level formRules entry (it declares isPresentation and test() exactly like every other validation rule), which is what lets a single rule carry a compound condition tree instead of factoring the composition into multiple single-condition rules. More...

#include <forms.hpp>

Public Member Functions

constexpr bool test (const A &action) const noexcept
 Evaluates the condition against action.
glz::generic_u64 emitNode () const
 Emits this condition's x-rules JSON node.

Public Attributes

std::tuple< Conds... > conditions
 The nested conditions, in declaration order.

Static Public Attributes

static constexpr detail::RuleKind kind = detail::RuleKind::And
 The wire "kind" this node emits: "and".
static constexpr bool isCondition = true
 Usable as a nested condition: this node's test() is a function of the action, so composing it into an and/or/not tree changes what that tree evaluates to.
static constexpr bool isPresentation = false
 Validation rule (not presentation): participates in the gate when used as a top-level formRules entry.

Detailed Description

template<typename A, typename... Conds>
struct morph::forms::And< A, Conds >

Compound condition: all of Conds... hold. Nests to any depth — each Cond may itself be a leaf (Engaged, Equals, a comparison, …) or another And/Or/Not. Usable both as a nested when clause and directly as a top-level formRules entry (it declares isPresentation and test() exactly like every other validation rule), which is what lets a single rule carry a compound condition tree instead of factoring the composition into multiple single-condition rules.

Template Parameters
AAction type every nested condition ranges over.
CondsNested condition node types, at least two.

Definition at line 1749 of file forms.hpp.

Member Function Documentation

◆ test()

template<typename A, typename... Conds>
bool morph::forms::And< A, Conds >::test ( const A & action) const
inlinenodiscardconstexprnoexcept

Evaluates the condition against action.

Parameters
actionThe action snapshot to inspect.
Returns
true when every nested condition holds.

Definition at line 1765 of file forms.hpp.

◆ emitNode()

template<typename A, typename... Conds>
glz::generic_u64 morph::forms::And< A, Conds >::emitNode ( ) const
inlinenodiscard

Emits this condition's x-rules JSON node.

Returns
{"kind":"and","conditions":[{...}, ...]}.

Definition at line 1771 of file forms.hpp.

Member Data Documentation

◆ conditions

template<typename A, typename... Conds>
std::tuple<Conds...> morph::forms::And< A, Conds >::conditions

The nested conditions, in declaration order.

Definition at line 1751 of file forms.hpp.

◆ kind

template<typename A, typename... Conds>
detail::RuleKind morph::forms::And< A, Conds >::kind = detail::RuleKind::And
staticconstexpr

The wire "kind" this node emits: "and".

Definition at line 1753 of file forms.hpp.

◆ isCondition

template<typename A, typename... Conds>
bool morph::forms::And< A, Conds >::isCondition = true
staticconstexpr

Usable as a nested condition: this node's test() is a function of the action, so composing it into an and/or/not tree changes what that tree evaluates to.

Definition at line 1757 of file forms.hpp.

◆ isPresentation

template<typename A, typename... Conds>
bool morph::forms::And< A, Conds >::isPresentation = false
staticconstexpr

Validation rule (not presentation): participates in the gate when used as a top-level formRules entry.

Definition at line 1760 of file forms.hpp.


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