Orcus
Loading...
Searching...
No Matches
orcus::json::document_tree Class Reference

#include <json_document_tree.hpp>

Public Member Functions

 document_tree (const document_tree &)=delete
 
 document_tree (document_tree &&other)
 
 document_tree (document_resource &res)
 
 document_tree (std::initializer_list< detail::init::node > vs)
 
 document_tree (array vs)
 
 document_tree (object obj)
 
document_treeoperator= (std::initializer_list< detail::init::node > vs)
 
document_treeoperator= (array vs)
 
document_treeoperator= (object obj)
 
void load (std::string_view stream, const json_config &config)
 
json::const_node get_document_root () const
 
json::node get_document_root ()
 
std::string dump () const
 
std::string dump_xml () const
 
std::string dump_yaml () const
 
void swap (document_tree &other)
 

Friends

class const_node
 
class node
 

Detailed Description

This class stores a parsed JSON document tree structure.

Member Function Documentation

◆ dump()

std::string orcus::json::document_tree::dump ( ) const

Dump the JSON document tree to string.

Returns
a string representation of the JSON document tree.

◆ dump_xml()

std::string orcus::json::document_tree::dump_xml ( ) const

Dump the JSON document tree to an XML structure.

Returns
a string containing an XML structure representing the JSON content.

◆ dump_yaml()

std::string orcus::json::document_tree::dump_yaml ( ) const

Dump the JSON document tree as YAML output.

Returns
string containing a YAML output representing the JSON document tree structure.

◆ get_document_root() [1/2]

json::node orcus::json::document_tree::get_document_root ( )

Get the root node of the document.

Returns
root node of the document.

◆ get_document_root() [2/2]

json::const_node orcus::json::document_tree::get_document_root ( ) const

Get the root node of the document.

Returns
root node of the document.

◆ load()

void orcus::json::document_tree::load ( std::string_view stream,
const json_config & config )

Load raw string stream containing a JSON structure to populate the document tree.

Parameters
streamstream containing a JSON structure.
configconfiguration object.

◆ swap()

void orcus::json::document_tree::swap ( document_tree & other)

Swap the content of the document with another document instance.

Parameters
otherdocument instance to swap the content with.