From e20289f53325036629870b257aee1728157a548e Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Tue, 7 Aug 2018 04:19:20 +0500 Subject: More data saved in Settings --- src/Settings.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/Settings.hpp') diff --git a/src/Settings.hpp b/src/Settings.hpp index 194e736..9132161 100644 --- a/src/Settings.hpp +++ b/src/Settings.hpp @@ -10,4 +10,29 @@ namespace Settings { std::string Read(const std::string &key, const std::string &defaultValue); void Write(const std::string &key, const std::string &value); + + inline bool ReadBool(const std::string &key, bool defaultValue) { + return Read(key, std::to_string(defaultValue)) == "true"; + } + + inline void WriteBool(const std::string &key, bool value) { + Write(key, value ? "true" : "false"); + } + + inline int ReadInt(const std::string &key, int defaultValue) { + return std::stoi(Read(key, std::to_string(defaultValue))); + } + + inline void WriteInt(const std::string &key, int value) { + Write(key, std::to_string(value)); + } + + inline double ReadDouble(const std::string &key, double defaultValue) { + return std::stod(Read(key, std::to_string(defaultValue))); + } + + inline void WriteDouble(const std::string &key, double value) { + Write(key, std::to_string(value)); + } + } \ No newline at end of file -- cgit v1.2.3