MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / parse_cbor_internal

Method parse_cbor_internal

dependencies/json/json.hpp:8110–8543  ·  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

8108 @return whether a valid CBOR value was passed to the SAX parser
8109 */
8110 bool parse_cbor_internal(const bool get_char,
8111 const cbor_tag_handler_t tag_handler)
8112 {
8113 switch (get_char ? get() : current)
8114 {
8115 // EOF
8116 case std::char_traits<char_type>::eof():
8117 return unexpect_eof(input_format_t::cbor, "value");
8118
8119 // Integer 0x00..0x17 (0..23)
8120 case 0x00:
8121 case 0x01:
8122 case 0x02:
8123 case 0x03:
8124 case 0x04:
8125 case 0x05:
8126 case 0x06:
8127 case 0x07:
8128 case 0x08:
8129 case 0x09:
8130 case 0x0A:
8131 case 0x0B:
8132 case 0x0C:
8133 case 0x0D:
8134 case 0x0E:
8135 case 0x0F:
8136 case 0x10:
8137 case 0x11:
8138 case 0x12:
8139 case 0x13:
8140 case 0x14:
8141 case 0x15:
8142 case 0x16:
8143 case 0x17:
8144 return sax->number_unsigned(static_cast<number_unsigned_t>(current));
8145
8146 case 0x18: // Unsigned integer (one-byte uint8_t follows)
8147 {
8148 std::uint8_t number{};
8149 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
8150 }
8151
8152 case 0x19: // Unsigned integer (two-byte uint16_t follows)
8153 {
8154 std::uint16_t number{};
8155 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
8156 }
8157
8158 case 0x1A: // Unsigned integer (four-byte uint32_t follows)
8159 {
8160 std::uint32_t number{};
8161 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
8162 }
8163
8164 case 0x1B: // Unsigned integer (eight-byte uint64_t follows)
8165 {
8166 std::uint64_t number{};
8167 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);

Callers

nothing calls this directly

Calls 11

getFunction · 0.70
get_token_stringFunction · 0.70
createFunction · 0.70
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