TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ get_bson_string()

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_string ( const NumberType  len,
string_t &  result 
)
inlineprivate

Parses a zero-terminated string of length len from the BSON input.

Parameters
[in]lenThe length (including the zero-byte at the end) of the string to be read.
[in,out]resultA reference to the string variable where the read string is to be stored.
Template Parameters
NumberTypeThe type of the length len
Precondition
len >= 1
Returns
true if the string was successfully parsed

Definition at line 8601 of file json.hpp.

8602 {
8603 if (JSON_HEDLEY_UNLIKELY(len < 1))
8604 {
8605 auto last_token = get_token_string();
8606 return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "string length must be at least 1, is " + std::to_string(len), "string"), BasicJsonType()));
8607 }
8608
8609 return get_string(input_format_t::bson, len - static_cast<NumberType>(1), result) && get() != std::char_traits<char_type>::eof();
8610 }
bool get_string(const input_format_t format, const NumberType len, string_t &result)
create a string by reading characters from the input
Definition: json.hpp:10849
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
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