#ifndef RFL_PARSING_PARSER_SKIP_HPP_ #define RFL_PARSING_PARSER_SKIP_HPP_ #include #include #include "../Result.hpp" #include "../always_false.hpp" #include "../internal/Skip.hpp" #include "Parser_base.hpp" #include "schema/Type.hpp" namespace rfl { namespace parsing { template requires AreReaderAndWriter< R, W, internal::Skip> struct Parser, ProcessorsType> { using InputVarType = typename R::InputVarType; using OutputVarType = typename W::OutputVarType; static Result> read(const R& _r, const InputVarType& _var) noexcept { if constexpr (_skip_deserialization) { return internal::Skip( std::remove_cvref_t()); } else { const auto to_skip = [&](auto&& _t) { return internal::Skip( std::move(_t)); }; return Parser, ProcessorsType>::read(_r, _var) .transform(to_skip); } } template static void write(const W& _w, const internal::Skip& _skip, const P& _parent) noexcept { if constexpr (_skip_serialization) { using ReflectionType = std::remove_cvref_t::ReflectionType>; Parser::write(_w, ReflectionType(), _parent); } else { Parser, ProcessorsType>::write( _w, _skip.value(), _parent); } } static schema::Type to_schema( std::map* _definitions) { return Parser, ProcessorsType>::to_schema( _definitions); } }; } // namespace parsing } // namespace rfl #endif