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

Method get_cbor_binary

deps/json/json.hpp:10085–10172  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

10083 @return whether byte array creation completed
10084 */
10085 bool get_cbor_binary(binary_t& result)
10086 {
10087 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary")))
10088 {
10089 return false;
10090 }
10091
10092 switch (current)
10093 {
10094 // Binary data (0x00..0x17 bytes follow)
10095 case 0x40:
10096 case 0x41:
10097 case 0x42:
10098 case 0x43:
10099 case 0x44:
10100 case 0x45:
10101 case 0x46:
10102 case 0x47:
10103 case 0x48:
10104 case 0x49:
10105 case 0x4A:
10106 case 0x4B:
10107 case 0x4C:
10108 case 0x4D:
10109 case 0x4E:
10110 case 0x4F:
10111 case 0x50:
10112 case 0x51:
10113 case 0x52:
10114 case 0x53:
10115 case 0x54:
10116 case 0x55:
10117 case 0x56:
10118 case 0x57:
10119 {
10120 return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
10121 }
10122
10123 case 0x58: // Binary data (one-byte uint8_t for n follows)
10124 {
10125 std::uint8_t len{};
10126 return get_number(input_format_t::cbor, len) &&
10127 get_binary(input_format_t::cbor, len, result);
10128 }
10129
10130 case 0x59: // Binary data (two-byte uint16_t for n follow)
10131 {
10132 std::uint16_t len{};
10133 return get_number(input_format_t::cbor, len) &&
10134 get_binary(input_format_t::cbor, len, result);
10135 }
10136
10137 case 0x5A: // Binary data (four-byte uint32_t for n follow)
10138 {
10139 std::uint32_t len{};
10140 return get_number(input_format_t::cbor, len) &&
10141 get_binary(input_format_t::cbor, len, result);
10142 }

Callers

nothing calls this directly

Calls 7

getFunction · 0.85
get_token_stringFunction · 0.85
createFunction · 0.85
concatFunction · 0.85
endMethod · 0.45
beginMethod · 0.45
parse_errorMethod · 0.45

Tested by

no test coverage detected