TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ sax_parse()

template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType>>
bool nlohmann::detail::binary_reader< BasicJsonType, InputAdapterType, SAX >::sax_parse ( const input_format_t  format,
json_sax_t *  sax_,
const bool  strict = true,
const cbor_tag_handler_t  tag_handler = cbor_tag_handler_t::error 
)
inline
Parameters
[in]formatthe binary format to parse
[in]sax_a SAX event processor
[in]strictwhether to expect the input to be consumed completed
[in]tag_handlerhow to treat CBOR tags
Returns
whether parsing was successful

Definition at line 8479 of file json.hpp.

8483 {
8484 sax = sax_;
8485 bool result = false;
8486
8487 switch (format)
8488 {
8489 case input_format_t::bson:
8490 result = parse_bson_internal();
8491 break;
8492
8493 case input_format_t::cbor:
8494 result = parse_cbor_internal(true, tag_handler);
8495 break;
8496
8497 case input_format_t::msgpack:
8498 result = parse_msgpack_internal();
8499 break;
8500
8501 case input_format_t::ubjson:
8502 result = parse_ubjson_internal();
8503 break;
8504
8505 case input_format_t::json: // LCOV_EXCL_LINE
8506 default: // LCOV_EXCL_LINE
8507 JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
8508 }
8509
8510 // strict mode: next byte must be EOF
8511 if (result && strict)
8512 {
8513 if (format == input_format_t::ubjson)
8514 {
8516 }
8517
8518 else
8519 {
8520 get();
8521 }
8522
8523 if (JSON_HEDLEY_UNLIKELY(current != std::char_traits<char_type>::eof()))
8524 {
8525 return sax->parse_error(chars_read, get_token_string(),
8526 parse_error::create(110, chars_read, exception_message(format, "expected end of input; last byte: 0x" + get_token_string(), "value"), BasicJsonType()));
8527 }
8528 }
8529
8530 return result;
8531 }
char_int_type get_ignore_noop()
Definition: json.hpp:10778
bool parse_cbor_internal(const bool get_char, const cbor_tag_handler_t tag_handler)
Definition: json.hpp:8794
bool parse_ubjson_internal(const bool get_char=true)
Definition: json.hpp:10228
std::string get_token_string() const
Definition: json.hpp:10928
std::string exception_message(const input_format_t format, const std::string &detail, const std::string &context) const
Definition: json.hpp:10941
std::size_t chars_read
the number of characters read
Definition: json.hpp:10981
char_int_type current
the current character
Definition: json.hpp:10978
json_sax_t * sax
the SAX parser
Definition: json.hpp:10987
bool parse_bson_internal()
Reads in a BSON-object and passes it to the SAX-parser.
Definition: json.hpp:8542
char_int_type get()
get next character from the input
Definition: json.hpp:10769
static parse_error create(int id_, const position_t &pos, const std::string &what_arg, const BasicJsonType &context)
create a parse error exception
Definition: json.hpp:2800