! @brief reads a MessagePack string This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. @param[out] result created string @return whether string creation completed */
| 6378 | @return whether string creation completed |
| 6379 | */ |
| 6380 | bool get_msgpack_string(string_t& result) |
| 6381 | { |
| 6382 | if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::msgpack, "string"))) |
| 6383 | { |
| 6384 | return false; |
| 6385 | } |
| 6386 | |
| 6387 | switch (current) |
| 6388 | { |
| 6389 | // fixstr |
| 6390 | case 0xA0: |
| 6391 | case 0xA1: |
| 6392 | case 0xA2: |
| 6393 | case 0xA3: |
| 6394 | case 0xA4: |
| 6395 | case 0xA5: |
| 6396 | case 0xA6: |
| 6397 | case 0xA7: |
| 6398 | case 0xA8: |
| 6399 | case 0xA9: |
| 6400 | case 0xAA: |
| 6401 | case 0xAB: |
| 6402 | case 0xAC: |
| 6403 | case 0xAD: |
| 6404 | case 0xAE: |
| 6405 | case 0xAF: |
| 6406 | case 0xB0: |
| 6407 | case 0xB1: |
| 6408 | case 0xB2: |
| 6409 | case 0xB3: |
| 6410 | case 0xB4: |
| 6411 | case 0xB5: |
| 6412 | case 0xB6: |
| 6413 | case 0xB7: |
| 6414 | case 0xB8: |
| 6415 | case 0xB9: |
| 6416 | case 0xBA: |
| 6417 | case 0xBB: |
| 6418 | case 0xBC: |
| 6419 | case 0xBD: |
| 6420 | case 0xBE: |
| 6421 | case 0xBF: |
| 6422 | { |
| 6423 | return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result); |
| 6424 | } |
| 6425 | |
| 6426 | case 0xD9: // str 8 |
| 6427 | { |
| 6428 | std::uint8_t len; |
| 6429 | return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result); |
| 6430 | } |
| 6431 | |
| 6432 | case 0xDA: // str 16 |
| 6433 | { |
| 6434 | std::uint16_t len; |
| 6435 | return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result); |
| 6436 | } |
| 6437 |
nothing calls this directly
no test coverage detected