#ifndef RFL_YAML_WRITE_HPP_ #define RFL_YAML_WRITE_HPP_ #include #include #include #include #include #include "../Processors.hpp" #include "../parsing/Parent.hpp" #include "Parser.hpp" namespace rfl { namespace yaml { /// Writes a YAML into an ostream. template std::ostream& write(const auto& _obj, std::ostream& _stream) { using T = std::remove_cvref_t; using ParentType = parsing::Parent; const auto out = Ref::make(); auto w = Writer(out); Parser>::write(w, _obj, typename ParentType::Root{}); _stream << out->c_str(); return _stream; } /// Returns a YAML string. template std::string write(const auto& _obj) { using T = std::remove_cvref_t; using ParentType = parsing::Parent; const auto out = Ref::make(); auto w = Writer(out); Parser>::write(w, _obj, typename ParentType::Root{}); return out->c_str(); } } // namespace yaml } // namespace rfl #endif