Class is responsible for simple loading/saving config and save files as json files.
More...
#include <JsonSerializer.hpp>
|
| template<JsonSerializable T> |
| static std::expected< void, Core::CoriError<> > | Save (const T &data, const std::filesystem::path &filepath) |
| | Saves a serializable object to a JSON file.
|
| template<JsonSerializable T> |
| static std::expected< T, Core::CoriError<> > | Load (const std::filesystem::path &filepath) |
| | Loads an object from a JSON file.
|
Class is responsible for simple loading/saving config and save files as json files.
Definition at line 18 of file JsonSerializer.hpp.
◆ Load()
template<JsonSerializable T>
| std::expected< T, Core::CoriError<> > Cori::FileSystem::JsonSerializer::Load |
( |
const std::filesystem::path & | filepath | ) |
|
|
inlinestatic |
Loads an object from a JSON file.
- Template Parameters
-
- Parameters
-
| filepath | The source file path. |
- Returns
- Expected object with void on success or CoriError<> on failure.
Definition at line 61 of file JsonSerializer.hpp.
◆ Save()
template<JsonSerializable T>
| std::expected< void, Core::CoriError<> > Cori::FileSystem::JsonSerializer::Save |
( |
const T & | data, |
|
|
const std::filesystem::path & | filepath ) |
|
inlinestatic |
Saves a serializable object to a JSON file.
- Template Parameters
-
- Parameters
-
| data | The object to save. |
| filepath | The destination file path. |
- Returns
- Expected object with void on success or CoriError<> on failure.
Definition at line 28 of file JsonSerializer.hpp.
The documentation for this class was generated from the following file: