#ifndef RFL_TOML_READ_HPP_ #define RFL_TOML_READ_HPP_ #include #include #include #include "../Processors.hpp" #include "../internal/wrap_in_rfl_array_t.hpp" #include "Parser.hpp" #include "Reader.hpp" namespace rfl::toml { using InputVarType = typename Reader::InputVarType; /// Parses an object from a TOML var. template auto read(InputVarType _var) { const auto r = Reader(); return Parser>::read(r, _var); } /// Parses an object from TOML using reflection. template Result> read(const std::string& _toml_str) { auto table = ::toml::parse(_toml_str); return read(&table); } /// Parses an object from a stringstream. template auto read(std::istream& _stream) { const auto toml_str = std::string(std::istreambuf_iterator(_stream), std::istreambuf_iterator()); return read(toml_str); } } // namespace rfl::toml #endif