TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ get_bson_binary()

template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType>>
template<typename NumberType >
bool nlohmann::detail::binary_reader< BasicJsonType, InputAdapterType, SAX >::get_bson_binary ( const NumberType  len,
binary_t &  result 
)
inlineprivate

Parses a byte array input of length len from the BSON input.

Parameters
[in]lenThe length of the byte array to be read.
[in,out]resultA reference to the binary variable where the read array is to be stored.
Template Parameters
NumberTypeThe type of the length len
Precondition
len >= 0
Returns
true if the byte array was successfully parsed

Definition at line 8622 of file json.hpp.

8623 {
8624 if (JSON_HEDLEY_UNLIKELY(len < 0))
8625 {
8626 auto last_token = get_token_string();
8627 return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "byte array length cannot be negative, is " + std::to_string(len), "binary"), BasicJsonType()));
8628 }
8629
8630 // All BSON binary values have a subtype
8631 std::uint8_t subtype{};
8632 get_number<std::uint8_t>(input_format_t::bson, subtype);
8633 result.set_subtype(subtype);
8634 return get_binary(input_format_t::bson, len, result);
8635 }
bool get_binary(const input_format_t format, const NumberType len, binary_t &result)
create a byte array by reading bytes from the input
Definition: json.hpp:10886
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
json_sax_t * sax
the SAX parser
Definition: json.hpp:10987
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