MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / parse_cbor_internal

Method parse_cbor_internal

Source/external/json.hpp:9494–9972  ·  view source on GitHub ↗

! @param[in] get_char whether a new character should be retrieved from the input (true) or whether the last read character should be considered instead (false) @param[in] tag_handler how CBOR tags should be treated @return whether a valid CBOR value was passed to the SAX parser */

Source from the content-addressed store, hash-verified

9492 @return whether a valid CBOR value was passed to the SAX parser
9493 */
9494 bool parse_cbor_internal(const bool get_char,
9495 const cbor_tag_handler_t tag_handler)
9496 {
9497 switch (get_char ? get() : current)
9498 {
9499 // EOF
9500 case std::char_traits<char_type>::eof():
9501 return unexpect_eof(input_format_t::cbor, "value");
9502
9503 // Integer 0x00..0x17 (0..23)
9504 case 0x00:
9505 case 0x01:
9506 case 0x02:
9507 case 0x03:
9508 case 0x04:
9509 case 0x05:
9510 case 0x06:
9511 case 0x07:
9512 case 0x08:
9513 case 0x09:
9514 case 0x0A:
9515 case 0x0B:
9516 case 0x0C:
9517 case 0x0D:
9518 case 0x0E:
9519 case 0x0F:
9520 case 0x10:
9521 case 0x11:
9522 case 0x12:
9523 case 0x13:
9524 case 0x14:
9525 case 0x15:
9526 case 0x16:
9527 case 0x17:
9528 return sax->number_unsigned(static_cast<number_unsigned_t>(current));
9529
9530 case 0x18: // Unsigned integer (one-byte uint8_t follows)
9531 {
9532 std::uint8_t number{};
9533 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
9534 }
9535
9536 case 0x19: // Unsigned integer (two-byte uint16_t follows)
9537 {
9538 std::uint16_t number{};
9539 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
9540 }
9541
9542 case 0x1A: // Unsigned integer (four-byte uint32_t follows)
9543 {
9544 std::uint32_t number{};
9545 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
9546 }
9547
9548 case 0x1B: // Unsigned integer (eight-byte uint64_t follows)
9549 {
9550 std::uint64_t number{};
9551 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);

Callers

nothing calls this directly

Calls 12

getFunction · 0.85
get_token_stringFunction · 0.85
createFunction · 0.85
concatFunction · 0.85
number_unsignedMethod · 0.45
number_integerMethod · 0.45
binaryMethod · 0.45
stringMethod · 0.45
parse_errorMethod · 0.45
booleanMethod · 0.45
nullMethod · 0.45
number_floatMethod · 0.45

Tested by

no test coverage detected