! @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 */
| 8793 | @return whether a valid CBOR value was passed to the SAX parser |
| 8794 | */ |
| 8795 | bool parse_cbor_internal(const bool get_char, |
| 8796 | const cbor_tag_handler_t tag_handler) |
| 8797 | { |
| 8798 | switch (get_char ? get() : current) |
| 8799 | { |
| 8800 | // EOF |
| 8801 | case std::char_traits<char_type>::eof(): |
| 8802 | return unexpect_eof(input_format_t::cbor, "value"); |
| 8803 | |
| 8804 | // Integer 0x00..0x17 (0..23) |
| 8805 | case 0x00: |
| 8806 | case 0x01: |
| 8807 | case 0x02: |
| 8808 | case 0x03: |
| 8809 | case 0x04: |
| 8810 | case 0x05: |
| 8811 | case 0x06: |
| 8812 | case 0x07: |
| 8813 | case 0x08: |
| 8814 | case 0x09: |
| 8815 | case 0x0A: |
| 8816 | case 0x0B: |
| 8817 | case 0x0C: |
| 8818 | case 0x0D: |
| 8819 | case 0x0E: |
| 8820 | case 0x0F: |
| 8821 | case 0x10: |
| 8822 | case 0x11: |
| 8823 | case 0x12: |
| 8824 | case 0x13: |
| 8825 | case 0x14: |
| 8826 | case 0x15: |
| 8827 | case 0x16: |
| 8828 | case 0x17: |
| 8829 | return sax->number_unsigned(static_cast<number_unsigned_t>(current)); |
| 8830 | |
| 8831 | case 0x18: // Unsigned integer (one-byte uint8_t follows) |
| 8832 | { |
| 8833 | std::uint8_t number{}; |
| 8834 | return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); |
| 8835 | } |
| 8836 | |
| 8837 | case 0x19: // Unsigned integer (two-byte uint16_t follows) |
| 8838 | { |
| 8839 | std::uint16_t number{}; |
| 8840 | return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); |
| 8841 | } |
| 8842 | |
| 8843 | case 0x1A: // Unsigned integer (four-byte uint32_t follows) |
| 8844 | { |
| 8845 | std::uint32_t number{}; |
| 8846 | return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); |
| 8847 | } |
| 8848 | |
| 8849 | case 0x1B: // Unsigned integer (eight-byte uint64_t follows) |
| 8850 | { |
| 8851 | std::uint64_t number{}; |
| 8852 | return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); |
nothing calls this directly
no test coverage detected