Orcus
|
#include <json_document_tree.hpp>
Public Member Functions | |
node (const node &other) | |
node (node &&rhs) | |
node_t | type () const |
size_t | child_count () const |
std::vector< pstring > | keys () const |
pstring | key (size_t index) const |
node | child (size_t index) const |
node | child (const pstring &key) const |
node | parent () const |
pstring | string_value () const |
double | numeric_value () const |
node & | operator= (const node &other) |
uintptr_t | identity () const |
Friends | |
class | ::orcus::json_document_tree |
Each node instance represents a JSON value object stored in the document tree.
node orcus::json::detail::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. |
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::detail::node::child_count | ( | ) | const |
Get the number of child nodes if any.
uintptr_t orcus::json::detail::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.
pstring orcus::json::detail::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<pstring> orcus::json::detail::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::detail::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. |
node orcus::json::detail::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. |
pstring orcus::json::detail::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::detail::node::type | ( | ) | const |
Get the type of a node.