! @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. @return string @throw parse_error.110 if input ended @throw parse_error.113 if an unexpected byte is read */
| 5402 | @throw parse_error.113 if an unexpected byte is read |
| 5403 | */ |
| 5404 | std::string get_msgpack_string() |
| 5405 | { |
| 5406 | check_eof(); |
| 5407 | |
| 5408 | switch (current) |
| 5409 | { |
| 5410 | // fixstr |
| 5411 | case 0xA0: |
| 5412 | case 0xA1: |
| 5413 | case 0xA2: |
| 5414 | case 0xA3: |
| 5415 | case 0xA4: |
| 5416 | case 0xA5: |
| 5417 | case 0xA6: |
| 5418 | case 0xA7: |
| 5419 | case 0xA8: |
| 5420 | case 0xA9: |
| 5421 | case 0xAA: |
| 5422 | case 0xAB: |
| 5423 | case 0xAC: |
| 5424 | case 0xAD: |
| 5425 | case 0xAE: |
| 5426 | case 0xAF: |
| 5427 | case 0xB0: |
| 5428 | case 0xB1: |
| 5429 | case 0xB2: |
| 5430 | case 0xB3: |
| 5431 | case 0xB4: |
| 5432 | case 0xB5: |
| 5433 | case 0xB6: |
| 5434 | case 0xB7: |
| 5435 | case 0xB8: |
| 5436 | case 0xB9: |
| 5437 | case 0xBA: |
| 5438 | case 0xBB: |
| 5439 | case 0xBC: |
| 5440 | case 0xBD: |
| 5441 | case 0xBE: |
| 5442 | case 0xBF: |
| 5443 | { |
| 5444 | return get_string(current & 0x1F); |
| 5445 | } |
| 5446 | |
| 5447 | case 0xD9: // str 8 |
| 5448 | { |
| 5449 | return get_string(get_number<uint8_t>()); |
| 5450 | } |
| 5451 | |
| 5452 | case 0xDA: // str 16 |
| 5453 | { |
| 5454 | return get_string(get_number<uint16_t>()); |
| 5455 | } |
| 5456 | |
| 5457 | case 0xDB: // str 32 |
| 5458 | { |
| 5459 | return get_string(get_number<uint32_t>()); |
| 5460 | } |
| 5461 |