Skip to content

Class zmbt::JsonNode

ClassList > zmbt > JsonNode

Mutator/accessor wrapper over shared JSON value. More...

  • #include <json_node.hpp>

Public Functions

Type Name
JsonNode (std::shared_ptr< boost::json::value > root)
JsonNode ()
JsonNode (boost::json::storage_ptr sp)
JsonNode (JsonNode const & o)
JsonNode (JsonNode & o)
JsonNode (JsonNode && o)
JsonNode (boost::json::value const & v)
JsonNode (boost::json::value && v)
boost::json::array const & as_array () const
boost::json::array & as_array ()
boost::json::object const & as_object () const
boost::json::object & as_object ()
boost::json::value const & at (boost::json::string_view json_ptr) const
boost::json::value const & at (boost::json::string_view fmtstr, T && first, A &&... rest) const
JsonNode branch (boost::json::kind kind, boost::json::string_view subnode_ptr)
create JsonNode proxy over subnode
JsonNode branch (boost::json::string_view subnode_ptr)
JsonNode branch (boost::json::kind kind, boost::json::string_view fmtstr, T && first, A &&... rest)
JsonNode branch (boost::json::string_view fmtstr, T && first, A &&... rest)
bool contains (boost::json::string_view json_ptr) const
bool contains (boost::json::string_view fmtstr, T && first, A &&... rest) const
JsonNode copy () const
boost::json::value const * find_pointer (boost::json::string_view json_ptr) const
boost::json::value const * find_pointer (boost::json::string_view fmtstr, T && first, A &&... rest) const
boost::json::value * find_pointer (boost::json::string_view fmtstr, T && first, A &&... rest)
boost::json::array & get_or_create_array (boost::json::string_view json_ptr="")
boost::json::array & get_or_create_array (boost::json::string_view fmtstr, T && first, A &&... rest)
boost::json::object & get_or_create_object (boost::json::string_view json_ptr="")
boost::json::object & get_or_create_object (boost::json::string_view fmtstr, T && first, A &&... rest)
boost::json::value get_or_default (boost::json::string_view json_ptr, boost::json::value const & dflt) const
bool is_null () const
boost::json::value const * node (boost::json::error_code & ec) const
boost::json::value * node (boost::json::error_code & ec)
boost::json::value const & node () const
boost::json::value & node ()
boost::json::string_view node_ptr () const
boost::json::value & operator() (boost::json::string_view json_ptr="")
boost::json::value & operator() (boost::json::string_view fmtstr, T && first, A &&... rest)
boost::json::value const & operator() (boost::json::string_view json_ptr="") const
boost::json::value const & operator() (boost::json::string_view fmtstr, T && first, A &&... rest) const
JsonNode & operator= (JsonNode const &) = default
JsonNode & operator= (JsonNode &&) = default
std::shared_ptr< boost::json::value > const & root () const
std::size_t size () const
~JsonNode () noexcept

Detailed Description

Provides read/write access to the referenced value internal structure via JSON Pointer. Each instance owns a shared pointer to the root value, so subnode proxies may prolong original object lifetime.

Additions to the standard JSON Pointer syntax: At-the-end token: '@'. Points to the last element of an array. Queries with at-the-end token always results in creating a new node on empty array. Past-the-end token: '+'. Points to the new element of an array. Queries with past-the-end token always results in creating a new node.

The rules for the additional tokens are:

For each @ token * if the node is null, the token substituted with 0; otherwise * if the node is an empty array, the token substituted with 0; otherwise * if the node is a non-empty array, the token substituted with node size - 1; otherwise * an error is produced.

For each + token * if the node is null, the token substituted with 0; otherwise * if the node is an array, the token substituted with node size; otherwise * an error is produced.

Public Functions Documentation

function JsonNode [2/9]

inline explicit zmbt::JsonNode::JsonNode (
    std::shared_ptr< boost::json::value > root
) 

function JsonNode [3/9]

inline zmbt::JsonNode::JsonNode () 

function JsonNode [4/9]

inline explicit zmbt::JsonNode::JsonNode (
    boost::json::storage_ptr sp
) 

function JsonNode [5/9]

inline zmbt::JsonNode::JsonNode (
    JsonNode const & o
) 

function JsonNode [6/9]

inline zmbt::JsonNode::JsonNode (
    JsonNode & o
) 

function JsonNode [7/9]

inline zmbt::JsonNode::JsonNode (
    JsonNode && o
) 

function JsonNode [8/9]

inline zmbt::JsonNode::JsonNode (
    boost::json::value const & v
) 

function JsonNode [9/9]

inline zmbt::JsonNode::JsonNode (
    boost::json::value && v
) 

function as_array [1/2]

inline boost::json::array const & zmbt::JsonNode::as_array () const

function as_array [2/2]

inline boost::json::array & zmbt::JsonNode::as_array () 

function as_object [1/2]

inline boost::json::object const & zmbt::JsonNode::as_object () const

function as_object [2/2]

inline boost::json::object & zmbt::JsonNode::as_object () 

function at [1/2]

boost::json::value const & zmbt::JsonNode::at (
    boost::json::string_view json_ptr
) const

function at [2/2]

template<class T, class... A>
inline boost::json::value const & zmbt::JsonNode::at (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) const

function branch [1/4]

create JsonNode proxy over subnode

JsonNode zmbt::JsonNode::branch (
    boost::json::kind kind,
    boost::json::string_view subnode_ptr
) 


function branch [2/4]

inline JsonNode zmbt::JsonNode::branch (
    boost::json::string_view subnode_ptr
) 

function branch [3/4]

template<class T, class... A>
inline JsonNode zmbt::JsonNode::branch (
    boost::json::kind kind,
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) 

function branch [4/4]

template<class T, class... A>
inline JsonNode zmbt::JsonNode::branch (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) 

function contains [1/2]

inline bool zmbt::JsonNode::contains (
    boost::json::string_view json_ptr
) const

function contains [2/2]

template<class T, class... A>
inline bool zmbt::JsonNode::contains (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) const

function copy

inline JsonNode zmbt::JsonNode::copy () const

function find_pointer [1/3]

inline boost::json::value const * zmbt::JsonNode::find_pointer (
    boost::json::string_view json_ptr
) const

function find_pointer [2/3]

template<class T, class... A>
inline boost::json::value const * zmbt::JsonNode::find_pointer (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) const

function find_pointer [3/3]

template<class T, class... A>
inline boost::json::value * zmbt::JsonNode::find_pointer (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) 

function get_or_create_array [1/2]

inline boost::json::array & zmbt::JsonNode::get_or_create_array (
    boost::json::string_view json_ptr=""
) 

function get_or_create_array [2/2]

template<class T, class... A>
inline boost::json::array & zmbt::JsonNode::get_or_create_array (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) 

function get_or_create_object [1/2]

inline boost::json::object & zmbt::JsonNode::get_or_create_object (
    boost::json::string_view json_ptr=""
) 

function get_or_create_object [2/2]

template<class T, class... A>
inline boost::json::object & zmbt::JsonNode::get_or_create_object (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) 

function get_or_default

inline boost::json::value zmbt::JsonNode::get_or_default (
    boost::json::string_view json_ptr,
    boost::json::value const & dflt
) const

function is_null

inline bool zmbt::JsonNode::is_null () const

function node [1/4]

inline boost::json::value const * zmbt::JsonNode::node (
    boost::json::error_code & ec
) const

function node [2/4]

inline boost::json::value * zmbt::JsonNode::node (
    boost::json::error_code & ec
) 

function node [3/4]

inline boost::json::value const & zmbt::JsonNode::node () const

function node [4/4]

inline boost::json::value & zmbt::JsonNode::node () 

function node_ptr

inline boost::json::string_view zmbt::JsonNode::node_ptr () const

function operator() [1/4]

inline boost::json::value & zmbt::JsonNode::operator() (
    boost::json::string_view json_ptr=""
) 

function operator() [2/4]

template<class T, class... A>
inline boost::json::value & zmbt::JsonNode::operator() (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) 

function operator() [3/4]

inline boost::json::value const & zmbt::JsonNode::operator() (
    boost::json::string_view json_ptr=""
) const

function operator() [4/4]

template<class T, class... A>
inline boost::json::value const & zmbt::JsonNode::operator() (
    boost::json::string_view fmtstr,
    T && first,
    A &&... rest
) const

function operator=

JsonNode & zmbt::JsonNode::operator= (
    JsonNode const &
) = default

function operator=

JsonNode & zmbt::JsonNode::operator= (
    JsonNode &&
) = default

function root

inline std::shared_ptr< boost::json::value > const & zmbt::JsonNode::root () const

function size

inline std::size_t zmbt::JsonNode::size () const

function ~JsonNode

zmbt::JsonNode::~JsonNode () noexcept

Friends Documentation

friend operator<<

inline std::ostream & zmbt::JsonNode::operator<< (
    std::ostream & os,
    JsonNode const & view
) 


The documentation for this class was generated from the following file zmbt-framework/zmbt-framework/backends/cxx/include/zmbt/core/json_node.hpp