MCPcopy Create free account
hub / github.com/dobin/RedEdr / get_msgpack_string

Method get_msgpack_string

RedEdrShared/json.hpp:10753–10824  ·  view source on GitHub ↗

! @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 */

Source from the content-addressed store, hash-verified

10751 @return whether string creation completed
10752 */
10753 bool get_msgpack_string(string_t& result)
10754 {
10755 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::msgpack, "string")))
10756 {
10757 return false;
10758 }
10759
10760 switch (current)
10761 {
10762 // fixstr
10763 case 0xA0:
10764 case 0xA1:
10765 case 0xA2:
10766 case 0xA3:
10767 case 0xA4:
10768 case 0xA5:
10769 case 0xA6:
10770 case 0xA7:
10771 case 0xA8:
10772 case 0xA9:
10773 case 0xAA:
10774 case 0xAB:
10775 case 0xAC:
10776 case 0xAD:
10777 case 0xAE:
10778 case 0xAF:
10779 case 0xB0:
10780 case 0xB1:
10781 case 0xB2:
10782 case 0xB3:
10783 case 0xB4:
10784 case 0xB5:
10785 case 0xB6:
10786 case 0xB7:
10787 case 0xB8:
10788 case 0xB9:
10789 case 0xBA:
10790 case 0xBB:
10791 case 0xBC:
10792 case 0xBD:
10793 case 0xBE:
10794 case 0xBF:
10795 {
10796 return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result);
10797 }
10798
10799 case 0xD9: // str 8
10800 {
10801 std::uint8_t len{};
10802 return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result);
10803 }
10804
10805 case 0xDA: // str 16
10806 {
10807 std::uint16_t len{};
10808 return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result);
10809 }
10810

Callers

nothing calls this directly

Calls 4

get_token_stringFunction · 0.85
createFunction · 0.85
concatFunction · 0.85
parse_errorMethod · 0.45

Tested by

no test coverage detected