CoriEngine
Loading...
Searching...
No Matches
Cori::FileSystem::JsonSerializer Class Reference

Class is responsible for simple loading/saving config and save files as json files. More...

#include <JsonSerializer.hpp>

Static Public Member Functions

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.

Detailed Description

Class is responsible for simple loading/saving config and save files as json files.

Definition at line 18 of file JsonSerializer.hpp.

Member Function Documentation

◆ 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
TA type that satisfies the JsonSerializable concept.
Parameters
filepathThe 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
TA type that satisfies the JsonSerializable concept.
Parameters
dataThe object to save.
filepathThe 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: