MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / get_cbor_string

Method get_cbor_string

deps/json/json.hpp:9989–10072  ·  view source on GitHub ↗

! @brief reads a CBOR string This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. Additionally, CBOR's strings with indefinite lengths are supported. @param[out] result created string @return whether string creation completed */

Source from the content-addressed store, hash-verified

9987 @return whether string creation completed
9988 */
9989 bool get_cbor_string(string_t& result)
9990 {
9991 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "string")))
9992 {
9993 return false;
9994 }
9995
9996 switch (current)
9997 {
9998 // UTF-8 string (0x00..0x17 bytes follow)
9999 case 0x60:
10000 case 0x61:
10001 case 0x62:
10002 case 0x63:
10003 case 0x64:
10004 case 0x65:
10005 case 0x66:
10006 case 0x67:
10007 case 0x68:
10008 case 0x69:
10009 case 0x6A:
10010 case 0x6B:
10011 case 0x6C:
10012 case 0x6D:
10013 case 0x6E:
10014 case 0x6F:
10015 case 0x70:
10016 case 0x71:
10017 case 0x72:
10018 case 0x73:
10019 case 0x74:
10020 case 0x75:
10021 case 0x76:
10022 case 0x77:
10023 {
10024 return get_string(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
10025 }
10026
10027 case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
10028 {
10029 std::uint8_t len{};
10030 return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result);
10031 }
10032
10033 case 0x79: // UTF-8 string (two-byte uint16_t for n follow)
10034 {
10035 std::uint16_t len{};
10036 return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result);
10037 }
10038
10039 case 0x7A: // UTF-8 string (four-byte uint32_t for n follow)
10040 {
10041 std::uint32_t len{};
10042 return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result);
10043 }
10044
10045 case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow)
10046 {

Callers

nothing calls this directly

Calls 6

getFunction · 0.85
get_token_stringFunction · 0.85
createFunction · 0.85
concatFunction · 0.85
appendMethod · 0.80
parse_errorMethod · 0.45

Tested by

no test coverage detected