MCPcopy Create free account
hub / github.com/KratosMultiphysics/Kratos / get_cbor_binary

Method get_cbor_binary

external_libraries/json/json.hpp:10796–10883  ·  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

10794 @return whether byte array creation completed
10795 */
10796 bool get_cbor_binary(binary_t& result)
10797 {
10798 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary")))
10799 {
10800 return false;
10801 }
10802
10803 switch (current)
10804 {
10805 // Binary data (0x00..0x17 bytes follow)
10806 case 0x40:
10807 case 0x41:
10808 case 0x42:
10809 case 0x43:
10810 case 0x44:
10811 case 0x45:
10812 case 0x46:
10813 case 0x47:
10814 case 0x48:
10815 case 0x49:
10816 case 0x4A:
10817 case 0x4B:
10818 case 0x4C:
10819 case 0x4D:
10820 case 0x4E:
10821 case 0x4F:
10822 case 0x50:
10823 case 0x51:
10824 case 0x52:
10825 case 0x53:
10826 case 0x54:
10827 case 0x55:
10828 case 0x56:
10829 case 0x57:
10830 {
10831 return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
10832 }
10833
10834 case 0x58: // Binary data (one-byte uint8_t for n follows)
10835 {
10836 std::uint8_t len{};
10837 return get_number(input_format_t::cbor, len) &&
10838 get_binary(input_format_t::cbor, len, result);
10839 }
10840
10841 case 0x59: // Binary data (two-byte uint16_t for n follow)
10842 {
10843 std::uint16_t len{};
10844 return get_number(input_format_t::cbor, len) &&
10845 get_binary(input_format_t::cbor, len, result);
10846 }
10847
10848 case 0x5A: // Binary data (four-byte uint32_t for n follow)
10849 {
10850 std::uint32_t len{};
10851 return get_number(input_format_t::cbor, len) &&
10852 get_binary(input_format_t::cbor, len, result);
10853 }

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected