Manages persistent game data storage and retrieval.
More...
#include <data/DataManager.hpp>
|
void | Init (std::string title) |
| Initialize the data manager.
|
|
template<typename T> |
T | Read (std::string name) |
| Read data of specified type.
|
|
template<typename T> |
void | Save (std::string name, T data) |
| Save data of specified type.
|
|
void | Delete (std::string name) |
| Delete saved data.
|
|
std::string | GetAppdataPath () |
| Get path to app data directory.
|
|
std::string | GetLogPath () |
| Get path to log directory.
|
|
Manages persistent game data storage and retrieval.
GameData handles saving and loading persistent game data. It manages the application data directory and provides methods to read and write different data types.
◆ Delete()
void StevEngine::Data::GameData::Delete |
( |
std::string | name | ) |
|
Delete saved data.
- Parameters
-
◆ GetAppdataPath()
std::string StevEngine::Data::GameData::GetAppdataPath |
( |
| ) |
|
|
inline |
Get path to app data directory.
- Returns
- Path to app data directory
◆ GetLogPath()
std::string StevEngine::Data::GameData::GetLogPath |
( |
| ) |
|
|
inline |
Get path to log directory.
- Returns
- Path to log directory
◆ Init()
void StevEngine::Data::GameData::Init |
( |
std::string | title | ) |
|
Initialize the data manager.
- Parameters
-
title | Game title used for data directory name |
Creates necessary data directories and loads existing data if present.
◆ Read()
template<typename T>
T StevEngine::Data::GameData::Read |
( |
std::string | name | ) |
|
|
inline |
Read data of specified type.
- Template Parameters
-
- Parameters
-
- Returns
- Value of type T
Reads and returns data of the specified type. Throws error if key doesn't exist.
◆ Save()
template<typename T>
void StevEngine::Data::GameData::Save |
( |
std::string | name, |
|
|
T | data ) |
|
inline |
Save data of specified type.
- Template Parameters
-
- Parameters
-
name | Key name to save under |
data | Data value to save |
Saves data and writes changes to disk immediately.
The documentation for this class was generated from the following files: