MCPcopy Create free account
hub / github.com/dobin/RedEdr / parse_cbor_internal

Method parse_cbor_internal

RedEdrShared/json.hpp:9596–10074  ·  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

9594 @return whether a valid CBOR value was passed to the SAX parser
9595 */
9596 bool parse_cbor_internal(const bool get_char,
9597 const cbor_tag_handler_t tag_handler)
9598 {
9599 switch (get_char ? get() : current)
9600 {
9601 // EOF
9602 case char_traits<char_type>::eof():
9603 return unexpect_eof(input_format_t::cbor, "value");
9604
9605 // Integer 0x00..0x17 (0..23)
9606 case 0x00:
9607 case 0x01:
9608 case 0x02:
9609 case 0x03:
9610 case 0x04:
9611 case 0x05:
9612 case 0x06:
9613 case 0x07:
9614 case 0x08:
9615 case 0x09:
9616 case 0x0A:
9617 case 0x0B:
9618 case 0x0C:
9619 case 0x0D:
9620 case 0x0E:
9621 case 0x0F:
9622 case 0x10:
9623 case 0x11:
9624 case 0x12:
9625 case 0x13:
9626 case 0x14:
9627 case 0x15:
9628 case 0x16:
9629 case 0x17:
9630 return sax->number_unsigned(static_cast<number_unsigned_t>(current));
9631
9632 case 0x18: // Unsigned integer (one-byte uint8_t follows)
9633 {
9634 std::uint8_t number{};
9635 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
9636 }
9637
9638 case 0x19: // Unsigned integer (two-byte uint16_t follows)
9639 {
9640 std::uint16_t number{};
9641 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
9642 }
9643
9644 case 0x1A: // Unsigned integer (four-byte uint32_t follows)
9645 {
9646 std::uint32_t number{};
9647 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
9648 }
9649
9650 case 0x1B: // Unsigned integer (eight-byte uint64_t follows)
9651 {
9652 std::uint64_t number{};
9653 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