diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-03 15:09:05 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-03 15:09:05 +0100 |
commit | a2607bffb1c0f8699021b1b4b3e54fa372e3ed0a (patch) | |
tree | 6ce416f4be55b9d8e3f73d6556450ee86f18774e /src/crepe/api/SaveManager.h | |
parent | 83ce876b4c1b12c3654413515840f5f71907ea6c (diff) |
more WIP savemanager
Diffstat (limited to 'src/crepe/api/SaveManager.h')
-rw-r--r-- | src/crepe/api/SaveManager.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/crepe/api/SaveManager.h b/src/crepe/api/SaveManager.h index 110735d..a1f239d 100644 --- a/src/crepe/api/SaveManager.h +++ b/src/crepe/api/SaveManager.h @@ -14,23 +14,30 @@ 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); + ValueBroker<T> get(const std::string & key, const T & default_value); //! Get a reference to a value template <typename T> - ValueBroker<T> & get(const char * key); + ValueBroker<T> get(const std::string & key); //! Set a value directly template <typename T> - void set(const char * key, const T & value); + void set(const std::string & key, const T & value); //! Check if the save file has a value for this \c key - bool has(const char * key); + bool has(const std::string & key); private: SaveManager(); virtual ~SaveManager() = default; +private: + template <typename T> + std::string serialize(const T &); + + template <typename T> + T deserialize(const std::string &); + public: // singleton static SaveManager & get_instance(); @@ -40,9 +47,8 @@ public: SaveManager & operator = (SaveManager &&) = delete; private: - std::unique_ptr<DB> db = nullptr; + static DB & get_db(); }; } -#include "SaveManager.hpp" |