mrdocs::dom::Value

A variant container for any kind of Dom value.

Synopsis

Declared in <mrdocs/Dom/Value.hpp>
class Value;

Member Functions

NameDescription
Value [constructor]Constructors
~Value [destructor]Destroy the contained value, releasing owned storage.
operator= Assignment operators
empty Return if an Array or Object is empty.
exists Return true if a key exists.
get get overloads
getArray Return the array.
getBool Return the underlying boolean value.
getFunction Return the function.
getInteger Return the underlying integer value.
getObject Return the object.
getString Return the underlying string value.
isArray Return true if this is an array.
isBoolean Return true if this is a boolean.
isFunction Return true if this is a function.
isInteger Return true if this is an integer.
isNull Return true if this is null.
isObject Return true if this is an object.
isSafeString Return true if this is a safe string.
isString Return true if this is a string.
isTruthy Determine if a value is truthy
isUndefined Return true if this is undefined.
kind Return the type of value contained.
lookup Lookup a sequence of keys.
operator() Invoke the function.
set Set or replace the value for a given key.
size Return if an Array or Object is empty.
swap Swap two values.
type_key Return the type key of the value.
operator std::string Return the string.
operator bool Determine if a value is truthy

Data Members

NameDescription
arr_ [variant member]Array payload; shared with lazy arrays.
b_ [variant member]Boolean payload when the value kind is Boolean.
fn_ [variant member]Callable payload used by template helpers.
i_ [variant member]Integer payload when the value kind is Integer.
obj_ [variant member]Object payload; shared with lazy objects.
str_ [variant member]UTF-8 string or safe-string payload.

Friends

|===
Name Description
toString Return value as a string.
operator&&
operator&&
operator&& Return the first dom::Value that is not truthy, or the last one.
operator||
operator||
operator|| Return the first dom::Value that is truthy, or the last one.
operator+
operator+
operator+ Add or concatenate two values.
operator<=> Three-way comparison operator
operator<=> Three-way comparison operator
operator<=> Compare two values for inequality.
operator== Compare two values for equality.
swap Swap two values.
safeString Create a wrapper for a safe string.
Object A container of key and value pairs.
Array An array of values

Non-Member Functions

Name Description
ValueFromConvert an object of type T to dom::Value with a context
ValueFromConvert an object of type T to dom::Value.
stringOrNullReturn a non-empty string, or a null.
stringOrNullReturn a non-empty string, or a null.
stringOrNullReturn a non-empty string, or a null.
JSON::stringifyStringify a value as JSON
::mrdocs::isEmptyDetermine if a value is empty
::mrdocs::safeStringReturn a DOM string ensuring special characters are escaped.
::mrdocs::safeStringMark an existing string-like value as safe to emit without escaping.
::mrdocs::helpers::detag_fn"detag" helper function
::mrdocs::helpers::increment_fn"increment" helper function
::mrdocs::helpers::or_fn"or" helper function
::mrdocs::helpers::relativize_fn"relativize" helper function
::mrdocs::helpers::select_fn"select" helper function