aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/SaveManager.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-26 15:58:39 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-26 15:58:39 +0200
commite0b1ddae296037376948a4c6f200d89e6d1ba81e (patch)
treef70e5a9b73e0b10e5c9fe263e146e9884474ac0f /src/crepe/api/SaveManager.h
parent2d67cf09b80297d13f642afd7db13dba53ca2b9b (diff)
WIP save manager
Diffstat (limited to 'src/crepe/api/SaveManager.h')
-rw-r--r--src/crepe/api/SaveManager.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/crepe/api/SaveManager.h b/src/crepe/api/SaveManager.h
new file mode 100644
index 0000000..37463ca
--- /dev/null
+++ b/src/crepe/api/SaveManager.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "../Proxy.h"
+
+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>
+ Proxy<T> & get(const char * key, const T & default_value);
+
+ //! Get a reference to a value
+ template <typename T>
+ Proxy<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();
+
+public:
+ // singleton
+ static SaveManager & get_instance();
+ SaveManager(const SaveManager &) = delete;
+ SaveManager(SaveManager &&) = delete;
+ SaveManager & operator = (const SaveManager &) = delete;
+ SaveManager & operator = (SaveManager &&) = delete;
+};
+
+}
+
+#include "SaveManager.hpp"