morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::detail::DocumentValidator Class Reference

Checks a parsed document against its own names and the catalog: every load-time rule that needs more than one place in the document. More...

#include <document.hpp>

Public Member Functions

 DocumentValidator (Document const &doc, LoadOptions const &options)
 Validates doc.
void run ()
 Runs every rule; throws DocumentRefused on the first refusal.
std::vector< LoadWarning > takeWarnings () noexcept
 What validation found that does not refuse the document.
std::map< DocNode const *, TypeKind > takeDateValueKinds () noexcept
 The static type of each date input's value that the checker could decide.
std::expected< Type, std::string > derivedType (NameEntry &entry, std::string_view name)
 The type of a name whose type is derived from an expression, derived on first use.
Document const & document () const noexcept
 The document.

Static Public Member Functions

static NameEntry * lookup (ScopeInfo *scope, std::string_view name)
 Finds a name in a scope chain.

Detailed Description

Checks a parsed document against its own names and the catalog: every load-time rule that needs more than one place in the document.

Definition at line 2249 of file document.hpp.

Constructor & Destructor Documentation

◆ DocumentValidator()

morph::ui::detail::DocumentValidator::DocumentValidator ( Document const & doc,
LoadOptions const & options )
inline

Validates doc.

Parameters
docThe parsed document.
optionsThe catalog facts.

Definition at line 2254 of file document.hpp.

Member Function Documentation

◆ run()

void morph::ui::detail::DocumentValidator::run ( )
inline

Runs every rule; throws DocumentRefused on the first refusal.

Definition at line 2257 of file document.hpp.

◆ takeWarnings()

std::vector< LoadWarning > morph::ui::detail::DocumentValidator::takeWarnings ( )
inlinenodiscardnoexcept

What validation found that does not refuse the document.

Returns
The warnings, in the order found; the validator keeps none.

Definition at line 2340 of file document.hpp.

◆ takeDateValueKinds()

std::map< DocNode const *, TypeKind > morph::ui::detail::DocumentValidator::takeDateValueKinds ( )
inlinenodiscardnoexcept

The static type of each date input's value that the checker could decide.

Returns
The table, keyed by node; the validator keeps none.

Definition at line 2344 of file document.hpp.

◆ lookup()

NameEntry * morph::ui::detail::DocumentValidator::lookup ( ScopeInfo * scope,
std::string_view name )
inlinestaticnodiscard

Finds a name in a scope chain.

Parameters
scopeThe innermost scope.
nameThe name.
Returns
The entry, or nullptr.

Definition at line 2352 of file document.hpp.

◆ derivedType()

std::expected< Type, std::string > morph::ui::detail::DocumentValidator::derivedType ( NameEntry & entry,
std::string_view name )
inlinenodiscard

The type of a name whose type is derived from an expression, derived on first use.

Parameters
entryThe state or let entry.
nameIts name, for the cycle's description.
Returns
The type, or the cycle it closes.

Definition at line 2366 of file document.hpp.

◆ document()

Document const & morph::ui::detail::DocumentValidator::document ( ) const
inlinenodiscardnoexcept

The document.

Returns
It.

Definition at line 2393 of file document.hpp.


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