mrdocs::dom
Objects representing JSON‐like values.
Description
This class is a variant‐like container for holding any kind of value that can be represented in JSON, with extensions for functions and "safe strings".
The class supports the following types:
-
Undefined
-
Null
-
Boolean
-
Integer
-
String
-
SafeString
-
Array
-
Object
-
Function
The class provides type‐safe accessors for each type, as well as methods to check the type of the contained value.
Example:
{.cpp}
dom::Value v1 = 42; // Integer
dom::Value v2 = "Hello, World!"; // String
dom::Value v3 = dom::Array{v1, v2}; // Array
if (v1.isInteger())
{
std::cout << "v1 is an integer: " << v1.getInteger() << "\n";
}
if (v2.isString())
{
std::cout << "v2 is a string: " << v2.getString() << "\n";
}
if (v3.isArray())
{
std::cout << "v3 is an array with " << v3.getArray().size() << " elements.\n";
}
Types
Name |
Description |
An array of values |
|
Abstract array interface. |
|
The default array implementation. |
|
The default Object implementation. |
|
Lazy array implementation |
|
Lazy array implementation |
|
Lazy object implementation. |
|
Lazy object implementation. |
|
Customization point tag. |
|
A container of key and value pairs. |
|
Abstract object interface. |
|
A variant container for any kind of Dom value. |
|
Customization point tag. |
|
|
Functions
Name |
Description |
|
|
|
|
Return a new dom::Array based on a transformed lazy array implementation. |
|
|
|
Return a new array using a custom implementation. |
|
Return a diagnostic string. |
|
Return a new object using a custom implementation. |
|
Return the first dom::Value that is not truthy, or the last one. |
|
Addition operators |
|
Return the first dom::Value that is truthy, or the last one. |
|
Return a non‐empty string, or a null. |
|
|
|
|
|
Equality operators |
|
Return the result of comparing two strings. |
|
Three‐way comparison operators |
Concepts
Created with MrDocs