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:
2025-12-06 10:55:46 -05:00
parent 2b5abeae58
commit ec13264050
365 changed files with 63946 additions and 357 deletions

View File

@@ -0,0 +1,29 @@
#ifndef RFL_IO_LOAD_BYTES_HPP_
#define RFL_IO_LOAD_BYTES_HPP_
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "../Result.hpp"
namespace rfl {
namespace io {
inline Result<std::vector<char>> load_bytes(const std::string& _fname) {
std::ifstream input(_fname, std::ios::binary);
if (input.is_open()) {
std::istreambuf_iterator<char> begin(input), end;
const auto bytes = std::vector<char>(begin, end);
input.close();
return bytes;
} else {
return error("File '" + _fname + "' not found!");
}
}
} // namespace io
} // namespace rfl
#endif

View File

@@ -0,0 +1,28 @@
#ifndef RFL_IO_LOAD_STRING_HPP_
#define RFL_IO_LOAD_STRING_HPP_
#include <fstream>
#include <string>
#include "../Result.hpp"
namespace rfl {
namespace io {
inline Result<std::string> load_string(const std::string& _fname) {
std::ifstream infile(_fname);
if (infile.is_open()) {
auto r = std::string(std::istreambuf_iterator<char>(infile),
std::istreambuf_iterator<char>());
infile.close();
return r;
} else {
return error("Unable to open file '" + _fname +
"' or file could not be found.");
}
}
} // namespace io
} // namespace rfl
#endif

View File

@@ -0,0 +1,29 @@
#ifndef RFL_IO_SAVE_BYTES_HPP_
#define RFL_IO_SAVE_BYTES_HPP_
#include <fstream>
#include <iostream>
#include <string>
#include "../Result.hpp"
namespace rfl {
namespace io {
template <class T, class WriteFunction>
Result<Nothing> save_bytes(const std::string& _fname, const T& _obj,
const WriteFunction& _write) {
try {
std::ofstream output(_fname, std::ios::out | std::ios::binary);
_write(_obj, output);
output.close();
} catch (std::exception& e) {
return error(e.what());
}
return Nothing{};
}
} // namespace io
} // namespace rfl
#endif

View 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