blob: 110735d5dbd9e4f190b12c818cd9687cf56e7ff8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#pragma once
#include <memory>
#include "../ValueBroker.h"
namespace crepe {
class DB;
}
namespace crepe::api {
class SaveManager {
public:
//! Get a reference to a value and initialize it with a value if it does not yet exist
template <typename T>
ValueBroker<T> & get(const char * key, const T & default_value);
//! Get a reference to a value
template <typename T>
ValueBroker<T> & get(const char * key);
//! Set a value directly
template <typename T>
void set(const char * key, const T & value);
//! Check if the save file has a value for this \c key
bool has(const char * key);
private:
SaveManager();
virtual ~SaveManager() = default;
public:
// singleton
static SaveManager & get_instance();
SaveManager(const SaveManager &) = delete;
SaveManager(SaveManager &&) = delete;
SaveManager & operator = (const SaveManager &) = delete;
SaveManager & operator = (SaveManager &&) = delete;
private:
std::unique_ptr<DB> db = nullptr;
};
}
#include "SaveManager.hpp"
|