MCPcopy Create free account
hub / github.com/aixed/WeChat-Hook / get_cbor_binary

Method get_cbor_binary

include/json.hpp:9998–10085  ·  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

9996 @return whether byte array creation completed
9997 */
9998 bool get_cbor_binary(binary_t& result)
9999 {
10000 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary")))
10001 {
10002 return false;
10003 }
10004
10005 switch (current)
10006 {
10007 // Binary data (0x00..0x17 bytes follow)
10008 case 0x40:
10009 case 0x41:
10010 case 0x42:
10011 case 0x43:
10012 case 0x44:
10013 case 0x45:
10014 case 0x46:
10015 case 0x47:
10016 case 0x48:
10017 case 0x49:
10018 case 0x4A:
10019 case 0x4B:
10020 case 0x4C:
10021 case 0x4D:
10022 case 0x4E:
10023 case 0x4F:
10024 case 0x50:
10025 case 0x51:
10026 case 0x52:
10027 case 0x53:
10028 case 0x54:
10029 case 0x55:
10030 case 0x56:
10031 case 0x57:
10032 {
10033 return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
10034 }
10035
10036 case 0x58: // Binary data (one-byte uint8_t for n follows)
10037 {
10038 std::uint8_t len{};
10039 return get_number(input_format_t::cbor, len) &&
10040 get_binary(input_format_t::cbor, len, result);
10041 }
10042
10043 case 0x59: // Binary data (two-byte uint16_t for n follow)
10044 {
10045 std::uint16_t len{};
10046 return get_number(input_format_t::cbor, len) &&
10047 get_binary(input_format_t::cbor, len, result);
10048 }
10049
10050 case 0x5A: // Binary data (four-byte uint32_t for n follow)
10051 {
10052 std::uint32_t len{};
10053 return get_number(input_format_t::cbor, len) &&
10054 get_binary(input_format_t::cbor, len, result);
10055 }

Callers

nothing calls this directly

Calls 8

insertMethod · 0.80
getFunction · 0.70
get_token_stringFunction · 0.70
createFunction · 0.70
concatFunction · 0.70
endMethod · 0.45
beginMethod · 0.45
parse_errorMethod · 0.45

Tested by

no test coverage detected