TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ parse_bson_element_list()

template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType>>
bool nlohmann::detail::binary_reader< BasicJsonType, InputAdapterType, SAX >::parse_bson_element_list ( const bool  is_array)
inlineprivate

Read a BSON element list (as specified in the BSON-spec)

The same binary layout is used for objects and arrays, hence it must be indicated with the argument is_array which one is expected (true --> array, false --> object).

Parameters
[in]is_arrayDetermines if the element list being read is to be treated as an object (is_array == false), or as an array (is_array == true).
Returns
whether a valid BSON-object/array was passed to the SAX parser

Definition at line 8725 of file json.hpp.

8726 {
8727 string_t key;
8728
8729 while (auto element_type = get())
8730 {
8731 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::bson, "element list")))
8732 {
8733 return false;
8734 }
8735
8736 const std::size_t element_type_parse_position = chars_read;
8737
8738 if (JSON_HEDLEY_UNLIKELY(!get_bson_cstr(key)))
8739 {
8740 return false;
8741 }
8742
8743 if (!is_array && !sax->key(key))
8744 {
8745 return false;
8746 }
8747
8748 if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_internal(element_type, element_type_parse_position)))
8749 {
8750 return false;
8751 }
8752
8753 // get_bson_cstr only appends
8754 key.clear();
8755 }
8756
8757 return true;
8758 }
bool parse_bson_element_internal(const char_int_type element_type, const std::size_t element_type_parse_position)
Read a BSON document element of the given element_type.
Definition: json.hpp:8647
bool get_bson_cstr(string_t &result)
Parses a C-style string from the BSON input.
Definition: json.hpp:8567
bool unexpect_eof(const input_format_t format, const char *context) const
Definition: json.hpp:10914
std::size_t chars_read
the number of characters read
Definition: json.hpp:10981
json_sax_t * sax
the SAX parser
Definition: json.hpp:10987
char_int_type get()
get next character from the input
Definition: json.hpp:10769
@ key
the parser read a key of a value in an object