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

Rule: field must be engaged whenever Cond holds; vacuously satisfied (not required) while the condition does not hold. More...

#include <forms.hpp>

Public Member Functions

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

Public Attributes

V A::* field
 Pointer to the member this rule may require.
Cond when
 The condition that, when true, makes field required.

Static Public Attributes

static constexpr detail::RuleKind kind = detail::RuleKind::RequiredWhen
 The wire "kind" this rule emits: "requiredWhen".
static constexpr bool isPresentation = false
 Validation rule (not presentation): participates in the gate.

Detailed Description

template<typename V, typename A, typename Cond>
struct morph::forms::RequiredWhen< V, A, Cond >

Rule: field must be engaged whenever Cond holds; vacuously satisfied (not required) while the condition does not hold.

Template Parameters
VField member type (must satisfy EngageableField).
AAction type the field belongs to.
CondCondition node type (e.g. Engaged<V2, A>).

Definition at line 1427 of file forms.hpp.

Member Function Documentation

◆ test()

template<typename V, typename A, typename Cond>
bool morph::forms::RequiredWhen< V, A, Cond >::test ( const A & action) const
inlinenodiscardconstexprnoexcept

Evaluates the rule against action.

Parameters
actionThe action snapshot to inspect.
Returns
true when when does not hold, or field is engaged.

Definition at line 1440 of file forms.hpp.

◆ emitNode()

template<typename V, typename A, typename Cond>
glz::generic_u64 morph::forms::RequiredWhen< V, A, Cond >::emitNode ( ) const
inlinenodiscard

Emits this rule's x-rules JSON node.

Returns
{"kind":"requiredWhen","fields":["<wire name>"],"when":{...}}.

Definition at line 1449 of file forms.hpp.

Member Data Documentation

◆ field

template<typename V, typename A, typename Cond>
V A::* morph::forms::RequiredWhen< V, A, Cond >::field

Pointer to the member this rule may require.

Definition at line 1429 of file forms.hpp.

◆ when

template<typename V, typename A, typename Cond>
Cond morph::forms::RequiredWhen< V, A, Cond >::when

The condition that, when true, makes field required.

Definition at line 1431 of file forms.hpp.

◆ kind

template<typename V, typename A, typename Cond>
detail::RuleKind morph::forms::RequiredWhen< V, A, Cond >::kind = detail::RuleKind::RequiredWhen
staticconstexpr

The wire "kind" this rule emits: "requiredWhen".

Definition at line 1433 of file forms.hpp.

◆ isPresentation

template<typename V, typename A, typename Cond>
bool morph::forms::RequiredWhen< V, A, Cond >::isPresentation = false
staticconstexpr

Validation rule (not presentation): participates in the gate.

Definition at line 1435 of file forms.hpp.


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