#ifndef RFL_CBOR_READ_HPP_ #define RFL_CBOR_READ_HPP_ #include #include #include #include #include #include "../Processors.hpp" #include "../internal/wrap_in_rfl_array_t.hpp" #include "Parser.hpp" #include "Reader.hpp" namespace rfl::cbor { using InputObjectType = typename Reader::InputObjectType; using InputVarType = typename Reader::InputVarType; /// Parses an object from CBOR using reflection. template Result> read(const std::vector& _bytes) { auto val = jsoncons::cbor::decode_cbor(_bytes); auto r = Reader(); return Parser>::read(r, InputVarType{&val}); } /// Parses an object from a stream. template Result> read(std::istream& _stream) { auto val = jsoncons::cbor::decode_cbor(_stream); auto r = Reader(); return Parser>::read(r, InputVarType{&val}); } } // namespace rfl::cbor #endif