feat(reflect-cpp): Switched from glaze -> reflect cpp
A bug was discovered in glaze which prevented valid toml output. We have switched to toml++ and reflect-cpp. The interface has remained the same so this should not break any code
This commit is contained in:
29
build-config/reflect-cpp/include/rfl/io/save_string.hpp
Normal file
29
build-config/reflect-cpp/include/rfl/io/save_string.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef RFL_IO_SAVE_STRING_HPP_
|
||||
#define RFL_IO_SAVE_STRING_HPP_
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "../Result.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace io {
|
||||
|
||||
template <class T, class WriteFunction>
|
||||
Result<Nothing> save_string(const std::string& _fname, const T& _obj,
|
||||
const WriteFunction& _write) {
|
||||
try {
|
||||
std::ofstream outfile;
|
||||
outfile.open(_fname);
|
||||
_write(_obj, outfile);
|
||||
outfile.close();
|
||||
} catch (std::exception& e) {
|
||||
return error(e.what());
|
||||
}
|
||||
return Nothing{};
|
||||
}
|
||||
|
||||
} // namespace io
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user