MCPcopy Create free account
hub / github.com/LAStools/LAStools / get_cbor_binary

Method get_cbor_binary

src/json.hpp:10155–10242  ·  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

10153 @return whether byte array creation completed
10154 */
10155 bool get_cbor_binary(binary_t& result)
10156 {
10157 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary")))
10158 {
10159 return false;
10160 }
10161
10162 switch (current)
10163 {
10164 // Binary data (0x00..0x17 bytes follow)
10165 case 0x40:
10166 case 0x41:
10167 case 0x42:
10168 case 0x43:
10169 case 0x44:
10170 case 0x45:
10171 case 0x46:
10172 case 0x47:
10173 case 0x48:
10174 case 0x49:
10175 case 0x4A:
10176 case 0x4B:
10177 case 0x4C:
10178 case 0x4D:
10179 case 0x4E:
10180 case 0x4F:
10181 case 0x50:
10182 case 0x51:
10183 case 0x52:
10184 case 0x53:
10185 case 0x54:
10186 case 0x55:
10187 case 0x56:
10188 case 0x57:
10189 {
10190 return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
10191 }
10192
10193 case 0x58: // Binary data (one-byte uint8_t for n follows)
10194 {
10195 std::uint8_t len{};
10196 return get_number(input_format_t::cbor, len) &&
10197 get_binary(input_format_t::cbor, len, result);
10198 }
10199
10200 case 0x59: // Binary data (two-byte uint16_t for n follow)
10201 {
10202 std::uint16_t len{};
10203 return get_number(input_format_t::cbor, len) &&
10204 get_binary(input_format_t::cbor, len, result);
10205 }
10206
10207 case 0x5A: // Binary data (four-byte uint32_t for n follow)
10208 {
10209 std::uint32_t len{};
10210 return get_number(input_format_t::cbor, len) &&
10211 get_binary(input_format_t::cbor, len, result);
10212 }

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected