MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / get_msgpack_string

Method get_msgpack_string

Source/Utils/json.hpp:9146–9216  ·  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

9144 @return whether string creation completed
9145 */
9146 bool get_msgpack_string(string_t& result)
9147 {
9148 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::msgpack, "string")))
9149 {
9150 return false;
9151 }
9152
9153 switch (current)
9154 {
9155 // fixstr
9156 case 0xA0:
9157 case 0xA1:
9158 case 0xA2:
9159 case 0xA3:
9160 case 0xA4:
9161 case 0xA5:
9162 case 0xA6:
9163 case 0xA7:
9164 case 0xA8:
9165 case 0xA9:
9166 case 0xAA:
9167 case 0xAB:
9168 case 0xAC:
9169 case 0xAD:
9170 case 0xAE:
9171 case 0xAF:
9172 case 0xB0:
9173 case 0xB1:
9174 case 0xB2:
9175 case 0xB3:
9176 case 0xB4:
9177 case 0xB5:
9178 case 0xB6:
9179 case 0xB7:
9180 case 0xB8:
9181 case 0xB9:
9182 case 0xBA:
9183 case 0xBB:
9184 case 0xBC:
9185 case 0xBD:
9186 case 0xBE:
9187 case 0xBF:
9188 {
9189 return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result);
9190 }
9191
9192 case 0xD9: // str 8
9193 {
9194 std::uint8_t len{};
9195 return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result);
9196 }
9197
9198 case 0xDA: // str 16
9199 {
9200 std::uint16_t len{};
9201 return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result);
9202 }
9203

Callers

nothing calls this directly

Calls 3

get_token_stringFunction · 0.85
createFunction · 0.85
parse_errorMethod · 0.45

Tested by

no test coverage detected