StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
StevEngine::Data::GameData Class Reference

Manages persistent game data storage and retrieval. More...

#include <data/DataManager.hpp>

Public Member Functions

void Init (std::string title)
 Initialize the data manager.
 
template<typename 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.
 

Detailed Description

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.

Member Function Documentation

◆ Delete()

void StevEngine::Data::GameData::Delete ( std::string name)

Delete saved data.

Parameters
nameKey name to delete

◆ 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
titleGame 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
TType of data to read
Parameters
nameKey name of the data
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
TType of data to save
Parameters
nameKey name to save under
dataData value to save

Saves data and writes changes to disk immediately.


The documentation for this class was generated from the following files: