Renderd7-nightly  v0.7.0
nlohmann::detail::json_sax_dom_parser< BasicJsonType > Class Template Reference

SAX implementation to create a JSON value from SAX events. More...

#include <json.hpp>

Public Member Functions

 json_sax_dom_parser (BasicJsonType &r, const bool allow_exceptions_=true)
 

Private Member Functions

template<typename Value >
JSON_HEDLEY_RETURNS_NON_NULL BasicJsonType * handle_value (Value &&v)
 

Private Attributes

BasicJsonType & root
 the parsed JSON value
 
std::vector< BasicJsonType * > ref_stack {}
 stack to model hierarchy of values
 
BasicJsonType * object_element = nullptr
 helper to hold the reference for the next object element
 
bool errored = false
 whether a syntax error occurred
 
const bool allow_exceptions = true
 whether to throw exceptions in case of errors
 

Detailed Description

template<typename BasicJsonType>
class nlohmann::detail::json_sax_dom_parser< BasicJsonType >

SAX implementation to create a JSON value from SAX events.

This class implements the json_sax interface and processes the SAX events to create a JSON value which makes it basically a DOM parser. The structure or hierarchy of the JSON value is managed by the stack ref_stack which contains a pointer to the respective array or object for each recursion depth.

After successful parsing, the value that is passed by reference to the constructor contains the parsed value.

Template Parameters
BasicJsonTypethe JSON type

Constructor & Destructor Documentation

◆ json_sax_dom_parser()

template<typename BasicJsonType >
nlohmann::detail::json_sax_dom_parser< BasicJsonType >::json_sax_dom_parser ( BasicJsonType &  r,
const bool  allow_exceptions_ = true 
)
inlineexplicit
Parameters
[in,out]rreference to a JSON value that is manipulated while parsing
[in]allow_exceptions_whether parse errors yield exceptions

Member Function Documentation

◆ handle_value()

template<typename BasicJsonType >
template<typename Value >
JSON_HEDLEY_RETURNS_NON_NULL BasicJsonType* nlohmann::detail::json_sax_dom_parser< BasicJsonType >::handle_value ( Value &&  v)
inlineprivate
Invariant
If the ref stack is empty, then the passed value will be the new root.
If the ref stack contains a value, then it is an array or an object to which we can add elements

GitHub |