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

Class binary_reader

dependencies/json/json.hpp:7763–10165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7761*/
7762template<typename BasicJsonType, typename InputAdapterType, typename SAX = json_sax_dom_parser<BasicJsonType>>
7763class binary_reader
7764{
7765 using number_integer_t = typename BasicJsonType::number_integer_t;
7766 using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
7767 using number_float_t = typename BasicJsonType::number_float_t;
7768 using string_t = typename BasicJsonType::string_t;
7769 using binary_t = typename BasicJsonType::binary_t;
7770 using json_sax_t = SAX;
7771 using char_type = typename InputAdapterType::char_type;
7772 using char_int_type = typename std::char_traits<char_type>::int_type;
7773
7774 public:
7775 /*!
7776 @brief create a binary reader
7777
7778 @param[in] adapter input adapter to read from
7779 */
7780 explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(adapter))
7781 {
7782 (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
7783 }
7784
7785 // make class move-only
7786 binary_reader(const binary_reader&) = delete;
7787 binary_reader(binary_reader&&) = default;
7788 binary_reader& operator=(const binary_reader&) = delete;
7789 binary_reader& operator=(binary_reader&&) = default;
7790 ~binary_reader() = default;
7791
7792 /*!
7793 @param[in] format the binary format to parse
7794 @param[in] sax_ a SAX event processor
7795 @param[in] strict whether to expect the input to be consumed completed
7796 @param[in] tag_handler how to treat CBOR tags
7797
7798 @return
7799 */
7800 JSON_HEDLEY_NON_NULL(3)
7801 bool sax_parse(const input_format_t format,
7802 json_sax_t* sax_,
7803 const bool strict = true,
7804 const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error)
7805 {
7806 sax = sax_;
7807 bool result = false;
7808
7809 switch (format)
7810 {
7811 case input_format_t::bson:
7812 result = parse_bson_internal();
7813 break;
7814
7815 case input_format_t::cbor:
7816 result = parse_cbor_internal(true, tag_handler);
7817 break;
7818
7819 case input_format_t::msgpack:
7820 result = parse_msgpack_internal();

Callers

nothing calls this directly

Calls 5

getFunction · 0.70
get_token_stringFunction · 0.70
createFunction · 0.70
little_endianessFunction · 0.70
parse_errorMethod · 0.45

Tested by

no test coverage detected