mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 13:31:49 +00:00
dynamic::Value simplified
This commit is contained in:
parent
8e83a07094
commit
a4c21984d5
26 changed files with 230 additions and 297 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue