|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
x-rules read into RuleExpr trees, translated into the UI document's expression language (expr/1) and evaluated by its one evaluator, three-valued and exactly. More...
#include <algorithm>#include <array>#include <cstddef>#include <cstdint>#include <expected>#include <functional>#include <limits>#include <optional>#include <span>#include <string>#include <string_view>#include <utility>#include <vector>#include "../../render/locale_format.hpp"#include "../../ui/expression.hpp"#include "../../ui/value.hpp"#include "../../util/rational.hpp"#include "detail/text.hpp"Go to the source code of this file.
Classes | |
| struct | morph::forms::SchemaError |
| Why a schema does not read as a form: where, and why. More... | |
| struct | morph::forms::RuleOperand |
| What a rule reads of one field. More... | |
| class | morph::forms::RuleExpr |
| One x-rules entry, or a condition inside one, and its translation into expr/1. More... | |
Typedefs | |
| using | morph::forms::RuleLookup = std::function<RuleOperand(std::string_view field)> |
| Reads one field by wire name, for a rule. The session's lookup is tracked, so a verdict computed inside a reactive computation recomputes when a field it read changes. | |
Enumerations | |
| enum class | morph::forms::Tri : std::uint8_t { False , True , Unknown } |
| A three-valued verdict: a half-typed form has fields with no value yet, so a rule can be undecided. More... | |
Functions | |
| constexpr Tri | morph::forms::triNot (Tri value) noexcept |
| Kleene negation. | |
| Tri | morph::forms::gatingVerdict (std::span< RuleExpr const > rules, RuleLookup const &lookup) |
| Whether the gating rules let the form submit. | |
| Tri | morph::forms::visibleVerdict (std::span< RuleExpr const > rules, std::string_view field, RuleLookup const &lookup) |
Whether field is shown: hidden as soon as one visibleWhen naming it is false. | |
| Tri | morph::forms::readonlyVerdict (std::span< RuleExpr const > rules, std::string_view field, RuleLookup const &lookup) |
Whether field is frozen: as soon as one readonlyWhen naming it is true. | |
| Tri | morph::forms::requiredVerdict (std::span< RuleExpr const > rules, std::string_view field, RuleLookup const &lookup) |
Whether field is required by a rule: as soon as one requiredWhen naming it is true. | |
x-rules read into RuleExpr trees, translated into the UI document's expression language (expr/1) and evaluated by its one evaluator, three-valued and exactly.
Specified in docs/spec/forms/engine.md, "Rules".
Definition in file rules.hpp.
| using morph::forms::RuleLookup = std::function<RuleOperand(std::string_view field)> |
|
strong |
|
nodiscardconstexprnoexcept |
|
inlinenodiscard |
Whether the gating rules let the form submit.
Only a False rule blocks: an Unknown one is waiting on a field that is required or does not encode, and that field blocks readiness itself; and a rule kind this engine does not know must not lock an older client out of a newer server's forms.
| rules | The rules. |
| lookup | Reads each operand. |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |