mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-06 02:36:18 +08:00
Added XML support; #21
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#ifndef RFL_XML_LOAD_HPP_
|
||||
#define RFL_XML_LOAD_HPP_
|
||||
|
||||
#include "rfl/Result.hpp"
|
||||
#include "rfl/io/load_string.hpp"
|
||||
#include "rfl/xml/read.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
template <class T>
|
||||
Result<T> load(const std::string& _fname) {
|
||||
const auto read_string = [](const auto& _str) { return read<T>(_str); };
|
||||
return rfl::io::load_string(_fname).and_then(read_string);
|
||||
}
|
||||
|
||||
} // namespace xml
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user