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/load_bytes.hpp
Normal file
29
build-config/reflect-cpp/include/rfl/io/load_bytes.hpp
Normal 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
|
||||
Reference in New Issue
Block a user