Orcus
|
#include <json_document_tree.hpp>
Public Member Functions | |
const_node (const const_node &other) | |
const_node (const_node &&rhs) | |
node_t | type () const |
size_t | child_count () const |
std::vector< std::string_view > | keys () const |
std::string_view | key (size_t index) const |
bool | has_key (std::string_view key) const |
const_node | child (size_t index) const |
const_node | child (std::string_view key) const |
const_node | parent () const |
const_node | back () const |
std::string_view | string_value () const |
double | numeric_value () const |
const_node & | operator= (const const_node &other) |
const_node & | operator= (const_node &&other) |
uintptr_t | identity () const |
const_node_iterator | begin () const |
const_node_iterator | end () const |
std::string | dump (std::size_t indent) const |
Protected Member Functions | |
const_node (const document_tree *doc, json_value *jv) | |
const_node (std::unique_ptr< impl > &&p) |
Protected Attributes | |
std::unique_ptr< impl > | mp_impl |
Friends | |
class | document_tree |
class | const_node_iterator |
class | subtree |
Each node instance represents a JSON value stored in the document tree. It's immutable.
const_node orcus::json::const_node::back | ( | ) | const |
Get the last child node.
orcus::json::document_error | if the node is not of array type or node has no children. |
const_node_iterator orcus::json::const_node::begin | ( | ) | const |
Get an iterator pointing to the first value of an array if the array is not empty. If the array is empty the iterator equals the end iterator as returned by the end() method.
document_error | If this method is called on a non-array node. |
const_node orcus::json::const_node::child | ( | size_t | index | ) | const |
Get a child node by index.
index | 0-based index of a child node. |
orcus::json::document_error | if the node is not one of the object or array types. |
std::out_of_range | if the index is equal to or greater than the number of child nodes that the node has. |
const_node orcus::json::const_node::child | ( | std::string_view | key | ) | const |
Get a child node by textural key value.
key | textural key value to get a child node by. |
orcus::json::document_error | if the node is not of the object type, or the node doesn't have the specified key. |
size_t orcus::json::const_node::child_count | ( | ) | const |
Get the number of child nodes if any.
std::string orcus::json::const_node::dump | ( | std::size_t | indent | ) | const |
Dump the subtree below this node to a string.
indent | Number of whitespace characters to use for one indent level. Note that specifying the indent value of 0 will generate output without line breaks. |
const_node_iterator orcus::json::const_node::end | ( | ) | const |
Get an end iterator for an array node. Use it in conjunction with an iterator returned by the begin() method.
document_error | If this method is called on a non-array node. |
bool orcus::json::const_node::has_key | ( | std::string_view | key | ) | const |
Query whether or not a particular key exists in a JSON object node.
key | key value. |
uintptr_t orcus::json::const_node::identity | ( | ) | const |
Return an indentifier of the JSON value object that the node represents. The identifier is derived directly from the memory address of the value object.
std::string_view orcus::json::const_node::key | ( | size_t | index | ) | const |
Get the key by index in a JSON object node. This method works only when the preserve object order option is set.
index | 0-based key index. |
orcus::json::document_error | if the node is not of the object type. |
std::out_of_range | if the index is equal to or greater than the number of keys stored in the node. |
std::vector< std::string_view > orcus::json::const_node::keys | ( | ) | const |
Get a list of keys stored in a JSON object node.
orcus::json::document_error | if the node is not of the object type. |
double orcus::json::const_node::numeric_value | ( | ) | const |
Get the numeric value of a JSON number node.
orcus::json::document_error | if the node is not of the number type. |
const_node orcus::json::const_node::parent | ( | ) | const |
Get the parent node.
orcus::json::document_error | if the node doesn't have a parent node which implies that the node is a root node. |
std::string_view orcus::json::const_node::string_value | ( | ) | const |
Get the string value of a JSON string node.
orcus::json::document_error | if the node is not of the string type. |
node_t orcus::json::const_node::type | ( | ) | const |
Get the type of a node.