dynamic::Value simplified

This commit is contained in:
MihailRis
2024-05-07 18:39:12 +03:00
parent 8e83a07094
commit a4c21984d5
26 changed files with 230 additions and 297 deletions
+3 -5
View File
@@ -104,7 +104,7 @@ bool files::write_binary_json(fs::path filename, const dynamic::Map* obj, bool c
return files::write_bytes(filename, bytes.data(), bytes.size());
}
std::unique_ptr<dynamic::Map> files::read_json(fs::path filename) {
std::shared_ptr<dynamic::Map> files::read_json(fs::path filename) {
std::string text = files::read_string(filename);
try {
auto obj = json::parse(filename.string(), text);
@@ -115,12 +115,10 @@ std::unique_ptr<dynamic::Map> files::read_json(fs::path filename) {
}
}
std::unique_ptr<dynamic::Map> files::read_binary_json(fs::path file) {
std::shared_ptr<dynamic::Map> files::read_binary_json(fs::path file) {
size_t size;
std::unique_ptr<ubyte[]> bytes (files::read_bytes(file, size));
return std::unique_ptr<dynamic::Map>(
json::from_binary(bytes.get(), size)
);
return json::from_binary(bytes.get(), size);
}
std::vector<std::string> files::read_list(fs::path filename) {