! @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 */
| 10723 | @return whether string creation completed |
| 10724 | */ |
| 10725 | bool get_msgpack_string(string_t& result) |
| 10726 | { |
| 10727 | if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::msgpack, "string"))) |
| 10728 | { |
| 10729 | return false; |
| 10730 | } |
| 10731 | |
| 10732 | switch (current) |
| 10733 | { |
| 10734 | // fixstr |
| 10735 | case 0xA0: |
| 10736 | case 0xA1: |
| 10737 | case 0xA2: |
| 10738 | case 0xA3: |
| 10739 | case 0xA4: |
| 10740 | case 0xA5: |
| 10741 | case 0xA6: |
| 10742 | case 0xA7: |
| 10743 | case 0xA8: |
| 10744 | case 0xA9: |
| 10745 | case 0xAA: |
| 10746 | case 0xAB: |
| 10747 | case 0xAC: |
| 10748 | case 0xAD: |
| 10749 | case 0xAE: |
| 10750 | case 0xAF: |
| 10751 | case 0xB0: |
| 10752 | case 0xB1: |
| 10753 | case 0xB2: |
| 10754 | case 0xB3: |
| 10755 | case 0xB4: |
| 10756 | case 0xB5: |
| 10757 | case 0xB6: |
| 10758 | case 0xB7: |
| 10759 | case 0xB8: |
| 10760 | case 0xB9: |
| 10761 | case 0xBA: |
| 10762 | case 0xBB: |
| 10763 | case 0xBC: |
| 10764 | case 0xBD: |
| 10765 | case 0xBE: |
| 10766 | case 0xBF: |
| 10767 | { |
| 10768 | return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result); |
| 10769 | } |
| 10770 | |
| 10771 | case 0xD9: // str 8 |
| 10772 | { |
| 10773 | std::uint8_t len{}; |
| 10774 | return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result); |
| 10775 | } |
| 10776 | |
| 10777 | case 0xDA: // str 16 |
| 10778 | { |
| 10779 | std::uint16_t len{}; |
| 10780 | return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result); |
| 10781 | } |
| 10782 |
nothing calls this directly
no test coverage detected