template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType>>
template<typename NumberType >
create a byte array by reading bytes from the input
- Template Parameters
-
NumberType | the type of the number |
- Parameters
-
[in] | format | the current format (for diagnostics) |
[in] | len | number of bytes to read |
[out] | result | byte 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 {
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
char_int_type current
the current character
char_int_type get()
get next character from the input