This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string.
9974 {
9975 if (JSON_HEDLEY_UNLIKELY(!
unexpect_eof(input_format_t::msgpack,
"string")))
9976 {
9977 return false;
9978 }
9979
9981 {
9982
9983 case 0xA0:
9984 case 0xA1:
9985 case 0xA2:
9986 case 0xA3:
9987 case 0xA4:
9988 case 0xA5:
9989 case 0xA6:
9990 case 0xA7:
9991 case 0xA8:
9992 case 0xA9:
9993 case 0xAA:
9994 case 0xAB:
9995 case 0xAC:
9996 case 0xAD:
9997 case 0xAE:
9998 case 0xAF:
9999 case 0xB0:
10000 case 0xB1:
10001 case 0xB2:
10002 case 0xB3:
10003 case 0xB4:
10004 case 0xB5:
10005 case 0xB6:
10006 case 0xB7:
10007 case 0xB8:
10008 case 0xB9:
10009 case 0xBA:
10010 case 0xBB:
10011 case 0xBC:
10012 case 0xBD:
10013 case 0xBE:
10014 case 0xBF:
10015 {
10016 return get_string(input_format_t::msgpack,
static_cast<unsigned int>(
current) & 0x1Fu, result);
10017 }
10018
10019 case 0xD9:
10020 {
10021 std::uint8_t len{};
10022 return get_number(input_format_t::msgpack, len) &&
get_string(input_format_t::msgpack, len, result);
10023 }
10024
10025 case 0xDA:
10026 {
10027 std::uint16_t len{};
10028 return get_number(input_format_t::msgpack, len) &&
get_string(input_format_t::msgpack, len, result);
10029 }
10030
10031 case 0xDB:
10032 {
10033 std::uint32_t len{};
10034 return get_number(input_format_t::msgpack, len) &&
get_string(input_format_t::msgpack, len, result);
10035 }
10036
10037 default:
10038 {
10041 }
10042 }
10043 }
bool get_string(const input_format_t format, const NumberType len, string_t &result)
create a string by reading characters from the input
bool unexpect_eof(const input_format_t format, const char *context) const
std::string get_token_string() const
std::string exception_message(const input_format_t format, const std::string &detail, const std::string &context) const
std::size_t chars_read
the number of characters read
char_int_type current
the current character
json_sax_t * sax
the SAX parser
static parse_error create(int id_, const position_t &pos, const std::string &what_arg, const BasicJsonType &context)
create a parse error exception