TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ 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

Definition at line 6149 of file json.hpp.

6150 {
6151 if (ref_stack.empty())
6152 {
6153 root = BasicJsonType(std::forward<Value>(v));
6154 return &root;
6155 }
6156
6157 JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());
6158
6159 if (ref_stack.back()->is_array())
6160 {
6161 ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));
6162 return &(ref_stack.back()->m_value.array->back());
6163 }
6164
6165 JSON_ASSERT(ref_stack.back()->is_object());
6166 JSON_ASSERT(object_element);
6167 *object_element = BasicJsonType(std::forward<Value>(v));
6168 return object_element;
6169 }
std::vector< BasicJsonType * > ref_stack
stack to model hierarchy of values
Definition: json.hpp:6174
BasicJsonType * object_element
helper to hold the reference for the next object element
Definition: json.hpp:6176
BasicJsonType & root
the parsed JSON value
Definition: json.hpp:6172