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

Condition: field's engaged value equals literal. An unengaged field is not vacuously satisfied here (unlike the comparison kinds) — a field with no value cannot equal anything, so equals returns false while the field is unengaged. 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

V A::* field
 Pointer to the member this condition inspects.
L literal
 The literal to compare the field's engaged value against.

Static Public Attributes

static constexpr detail::RuleKind kind = detail::RuleKind::Equals
 The wire "kind" this condition emits: "equals".
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.

Detailed Description

template<typename V, typename A, typename L>
struct morph::forms::Equals< V, A, L >

Condition: field's engaged value equals literal. An unengaged field is not vacuously satisfied here (unlike the comparison kinds) — a field with no value cannot equal anything, so equals returns false while the field is unengaged.

Template Parameters
VField member type.
AAction type the field belongs to.
LLiteral type (must satisfy RuleLiteral).

Definition at line 1315 of file forms.hpp.

Member Function Documentation

◆ test()

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

Evaluates the condition against action.

Parameters
actionThe action snapshot to inspect.
Returns
true when the field is engaged (or has no empty state) and its value equals literal.

Definition at line 1331 of file forms.hpp.

◆ emitNode()

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

Emits this condition's x-rules JSON node.

Returns
{"kind":"equals","fields":["<wire name>"],"value":...}, where value is {"num":...,"den":...} for a Rational literal and the bare scalar otherwise.

Definition at line 1347 of file forms.hpp.

Member Data Documentation

◆ field

template<typename V, typename A, typename L>
V A::* morph::forms::Equals< V, A, L >::field

Pointer to the member this condition inspects.

Definition at line 1317 of file forms.hpp.

◆ literal

template<typename V, typename A, typename L>
L morph::forms::Equals< V, A, L >::literal

The literal to compare the field's engaged value against.

Definition at line 1319 of file forms.hpp.

◆ kind

template<typename V, typename A, typename L>
detail::RuleKind morph::forms::Equals< V, A, L >::kind = detail::RuleKind::Equals
staticconstexpr

The wire "kind" this condition emits: "equals".

Definition at line 1321 of file forms.hpp.

◆ isCondition

template<typename V, typename A, typename L>
bool morph::forms::Equals< V, A, L >::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 1325 of file forms.hpp.


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