diff --git a/include/rfl/parsing/CustomParser.hpp b/include/rfl/parsing/CustomParser.hpp index 0192b206..fbebd9ab 100644 --- a/include/rfl/parsing/CustomParser.hpp +++ b/include/rfl/parsing/CustomParser.hpp @@ -7,15 +7,14 @@ #include "../internal/has_to_class_method_v.hpp" #include "../internal/to_ptr_field_tuple.hpp" #include "Parser.hpp" +#include "schema/Type.hpp" namespace rfl { namespace parsing { -template +template struct CustomParser { - static Result read(const ReaderType& _r, - const auto& _var) noexcept { + static Result read(const R& _r, const auto& _var) noexcept { const auto to_class = [](auto&& _h) -> Result { try { if constexpr (internal::has_to_class_method_v) { @@ -31,15 +30,20 @@ struct CustomParser { return Error(e.what()); } }; - return Parser::read(_r, _var) - .and_then(to_class); + return Parser::read(_r, _var).and_then(to_class); } template - static auto write(const WriterType& _w, const OriginalClass& _p, + static auto write(const W& _w, const OriginalClass& _p, const P& _parent) noexcept { - Parser::write( - _w, HelperStruct::from_class(_p), _parent); + Parser::write(_w, HelperStruct::from_class(_p), + _parent); + } + + static schema::Type to_schema( + std::map* _definitions) { + return Parser>::to_schema( + _definitions); } };