MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / parse_cbor_internal

Method parse_cbor_internal

Source/Utils/json.hpp:8041–8473  ·  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

8039 @return whether a valid CBOR value was passed to the SAX parser
8040 */
8041 bool parse_cbor_internal(const bool get_char,
8042 const cbor_tag_handler_t tag_handler)
8043 {
8044 switch (get_char ? get() : current)
8045 {
8046 // EOF
8047 case std::char_traits<char_type>::eof():
8048 return unexpect_eof(input_format_t::cbor, "value");
8049
8050 // Integer 0x00..0x17 (0..23)
8051 case 0x00:
8052 case 0x01:
8053 case 0x02:
8054 case 0x03:
8055 case 0x04:
8056 case 0x05:
8057 case 0x06:
8058 case 0x07:
8059 case 0x08:
8060 case 0x09:
8061 case 0x0A:
8062 case 0x0B:
8063 case 0x0C:
8064 case 0x0D:
8065 case 0x0E:
8066 case 0x0F:
8067 case 0x10:
8068 case 0x11:
8069 case 0x12:
8070 case 0x13:
8071 case 0x14:
8072 case 0x15:
8073 case 0x16:
8074 case 0x17:
8075 return sax->number_unsigned(static_cast<number_unsigned_t>(current));
8076
8077 case 0x18: // Unsigned integer (one-byte uint8_t follows)
8078 {
8079 std::uint8_t number{};
8080 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
8081 }
8082
8083 case 0x19: // Unsigned integer (two-byte uint16_t follows)
8084 {
8085 std::uint16_t number{};
8086 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
8087 }
8088
8089 case 0x1A: // Unsigned integer (four-byte uint32_t follows)
8090 {
8091 std::uint32_t number{};
8092 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);
8093 }
8094
8095 case 0x1B: // Unsigned integer (eight-byte uint64_t follows)
8096 {
8097 std::uint64_t number{};
8098 return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);

Callers

nothing calls this directly

Calls 11

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