diff options
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" |