MCPcopy Create free account
hub / github.com/AllentDan/LibtorchSegmentation / get_msgpack_string

Method get_msgpack_string

src/utils/json.hpp:9147–9217  ·  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

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

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