morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::DocNode Struct Reference

A view node of the document (spec 5 §9), or a structured part of one (a table column, a tab, a switch case, a menu item, an a11y, drag, drop or action record, a form field overlay). More...

#include <document.hpp>

Public Member Functions

ExprPtr prop (std::string_view key) const
 An expression property.
Commands const * event (std::string_view key) const
 A command list.
std::span< DocNodePtr const > nodes (std::string_view key) const
 A child node list.
std::span< DocNodePtr const > partList (std::string_view key) const
 A list of parts.
std::string_view name (std::string_view key) const
 A plain string property.
bool flag (std::string_view key) const
 A literal flag.

Public Attributes

std::string kind
 The node kind (text, table, …), or for a part its part kind (column, tab, case, …).
std::string id
 The element id; empty when none is given.
std::string path
 The node's JSON Pointer.
std::map< std::string, ExprPtr, std::less<> > props
 Expression properties, by key.
std::map< std::string, Commands, std::less<> > events
 Command lists, by key (onClick, …), including a custom node's on events as on.<event>.
std::map< std::string, std::vector< DocNodePtr >, std::less<> > children
 Child node lists, by key (children, header, loading, error, default, cell, fallback).
std::map< std::string, std::vector< DocNodePtr >, std::less<> > parts
 Structured parts, by key (columns, tabs, cases, items, a11y, action, fields, …).
std::map< std::string, std::string, std::less<> > names
 Plain string properties, by key (testId, surface, name of a custom node, model and action of a form, point of customize, role of a11y, a column's id, …).
std::map< std::string, Commands, std::less<> > keys
 Key bindings: chord to commands.
std::map< std::string, bool, std::less<> > flags
 Literal flags, by key (showLabel of an input).
std::optional< ScopeDecl > scope
 The declarations of the scope the node creates (dialog, drawer, switch case, forEach or table row); empty for a node that creates none.

Detailed Description

A view node of the document (spec 5 §9), or a structured part of one (a table column, a tab, a switch case, a menu item, an a11y, drag, drop or action record, a form field overlay).

Properties are kept by their document keys, so the interpreter reads a kind's properties by name; which keys a kind has, and what shape each takes, is the kind table of docs/spec/ui/document.md.

Definition at line 394 of file document.hpp.

Member Function Documentation

◆ prop()

ExprPtr morph::ui::DocNode::prop ( std::string_view key) const
inlinenodiscard

An expression property.

Parameters
keyThe key.
Returns
The expression, or nullptr when absent.

Definition at line 423 of file document.hpp.

◆ event()

Commands const * morph::ui::DocNode::event ( std::string_view key) const
inlinenodiscard

A command list.

Parameters
keyThe key.
Returns
The commands, or nullptr when absent.

Definition at line 431 of file document.hpp.

◆ nodes()

std::span< DocNodePtr const > morph::ui::DocNode::nodes ( std::string_view key) const
inlinenodiscard

A child node list.

Parameters
keyThe key.
Returns
The nodes; empty when absent.

Definition at line 439 of file document.hpp.

◆ partList()

std::span< DocNodePtr const > morph::ui::DocNode::partList ( std::string_view key) const
inlinenodiscard

A list of parts.

Parameters
keyThe key.
Returns
The parts; empty when absent.

Definition at line 447 of file document.hpp.

◆ name()

std::string_view morph::ui::DocNode::name ( std::string_view key) const
inlinenodiscard

A plain string property.

Parameters
keyThe key.
Returns
The string; empty when absent.

Definition at line 455 of file document.hpp.

◆ flag()

bool morph::ui::DocNode::flag ( std::string_view key) const
inlinenodiscard

A literal flag.

Parameters
keyThe key.
Returns
Its value; false when absent.

Definition at line 463 of file document.hpp.

Member Data Documentation

◆ kind

std::string morph::ui::DocNode::kind

The node kind (text, table, …), or for a part its part kind (column, tab, case, …).

Definition at line 396 of file document.hpp.

◆ id

std::string morph::ui::DocNode::id

The element id; empty when none is given.

Definition at line 398 of file document.hpp.

◆ path

std::string morph::ui::DocNode::path

The node's JSON Pointer.

Definition at line 400 of file document.hpp.

◆ props

std::map<std::string, ExprPtr, std::less<> > morph::ui::DocNode::props

Expression properties, by key.

Definition at line 402 of file document.hpp.

◆ events

std::map<std::string, Commands, std::less<> > morph::ui::DocNode::events

Command lists, by key (onClick, …), including a custom node's on events as on.<event>.

Definition at line 404 of file document.hpp.

◆ children

std::map<std::string, std::vector<DocNodePtr>, std::less<> > morph::ui::DocNode::children

Child node lists, by key (children, header, loading, error, default, cell, fallback).

Definition at line 406 of file document.hpp.

◆ parts

std::map<std::string, std::vector<DocNodePtr>, std::less<> > morph::ui::DocNode::parts

Structured parts, by key (columns, tabs, cases, items, a11y, action, fields, …).

Definition at line 408 of file document.hpp.

◆ names

std::map<std::string, std::string, std::less<> > morph::ui::DocNode::names

Plain string properties, by key (testId, surface, name of a custom node, model and action of a form, point of customize, role of a11y, a column's id, …).

Definition at line 411 of file document.hpp.

◆ keys

std::map<std::string, Commands, std::less<> > morph::ui::DocNode::keys

Key bindings: chord to commands.

Definition at line 413 of file document.hpp.

◆ flags

std::map<std::string, bool, std::less<> > morph::ui::DocNode::flags

Literal flags, by key (showLabel of an input).

Definition at line 415 of file document.hpp.

◆ scope

std::optional<ScopeDecl> morph::ui::DocNode::scope

The declarations of the scope the node creates (dialog, drawer, switch case, forEach or table row); empty for a node that creates none.

Definition at line 418 of file document.hpp.


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