TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ get_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_binary ( const input_format_t  format,
const NumberType  len,
binary_t &  result 
)
inlineprivate

create a byte array by reading bytes from the input

Template Parameters
NumberTypethe type of the number
Parameters
[in]formatthe current format (for diagnostics)
[in]lennumber of bytes to read
[out]resultbyte array created by reading len bytes
Returns
whether byte array creation completed
Note
We can not reserve len bytes for the result, because len may be too large. Usually, unexpect_eof() detects the end of the input before we run out of memory.

Definition at line 10886 of file json.hpp.

10889 {
10890 bool success = true;
10891
10892 for (NumberType i = 0; i < len; i++)
10893 {
10894 get();
10895
10896 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, "binary")))
10897 {
10898 success = false;
10899 break;
10900 }
10901
10902 result.push_back(static_cast<std::uint8_t>(current));
10903 }
10904
10905 return success;
10906 }
bool unexpect_eof(const input_format_t format, const char *context) const
Definition: json.hpp:10914
char_int_type current
the current character
Definition: json.hpp:10978
char_int_type get()
get next character from the input
Definition: json.hpp:10769