|
| std::string | morph::ui::pointerAppend (std::string_view base, std::string_view token) |
| | Appends one reference token to a JSON Pointer, escaping ~ and / as RFC 6901 requires.
|
| std::string | morph::ui::pointerAppend (std::string_view base, std::size_t index) |
| | Appends an array index to a JSON Pointer.
|
| constexpr std::string_view | morph::ui::kindName (ValueKind kind) |
| | The name of a value kind, as a document spells its type.
|
| std::expected< Type, std::string > | morph::ui::detail::parseTypePrefix (std::string_view &text, int depth) |
| | Parses one type at the front of text, advancing it.
|
| std::expected< Type, std::string > | morph::ui::parseType (std::string_view text) |
| | Parses a document type: bool, int, string, decimal, quantity, timestamp, key, record, any, list<T>, each optionally followed by ?.
|
| std::optional< std::int64_t > | morph::ui::detail::jsonInt (Json const &json) noexcept |
| | Reads a JSON integer as an int64.
|
| std::optional< std::expected< Value, std::string > > | morph::ui::detail::exactFromJson (Json::object_t const &object) |
| | Reads the wire form of a decimal or quantity: an object of exactly num, den, dp (and unit).
|
| std::expected< Value, std::string > | morph::ui::valueFromJson (Json const &json) |
| | Reads a value from its JSON form, structurally.
|
| std::expected< Value, std::string > | morph::ui::valueFromJson (Json const &json, Type const &type) |
| | Reads a value from its JSON form as a value of type.
|
| Json | morph::ui::valueToJson (Value const &value) |
| | Writes a value in its JSON form: the inverse of valueFromJson, with a timestamp as ISO-8601 text.
|
| bool | morph::ui::detail::nestsTooDeep (std::string_view text) |
| | Whether JSON text nests objects and arrays deeper than kMaxJsonDepth.
|
| std::expected< Json, std::string > | morph::ui::parseJson (std::string_view text) |
| | Parses JSON text into the document layer's JSON tree.
|
The UI document's typed values (ui::Value), its types (ui::Type), their JSON form, and ui::Refusal, the error every load-time check of the document layer returns.
Specified in docs/spec/ui/document.md, "Values and types".
Definition in file value.hpp.
| std::expected< Type, std::string > morph::ui::parseType |
( |
std::string_view | text | ) |
|
|
inlinenodiscard |
Parses a document type: bool, int, string, decimal, quantity, timestamp, key, record, any, list<T>, each optionally followed by ?.
- Parameters
-
- Returns
- The type, or the reason it does not parse.
Definition at line 479 of file value.hpp.
| std::expected< Value, std::string > morph::ui::valueFromJson |
( |
Json const & | json | ) |
|
|
inlinenodiscard |
Reads a value from its JSON form, structurally.
null, booleans, integers, strings, arrays and objects map to their kinds. An object of exactly num, den and dp is a decimal, and with unit a quantity: the wire form of math::Rational. A number with a fraction or an exponent is refused, because an exact value is never written as a double; an integer beyond int64 is refused. A timestamp has no structural form — it is a string — so it is read through the typed overload.
- Parameters
-
- Returns
- The value, or the reason it is refused.
Definition at line 570 of file value.hpp.
| std::size_t morph::ui::kMaxJsonDepth = 64 |
|
inlineconstexpr |
The deepest a document's JSON may nest, counting each object and array as one level.
Documents written by hand or by the builders nest a dozen levels or so. The bound is checked before the JSON parser runs, because the parser and every later pass over the tree descend recursively, and a hostile document nested a few hundred levels deep overflows a 1 MB thread stack before anything else can refuse it.
Definition at line 714 of file value.hpp.