summaryrefslogtreecommitdiffstats
path: root/src/Settings.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-07 01:19:20 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-07 01:19:20 +0200
commite20289f53325036629870b257aee1728157a548e (patch)
tree46e549df2406bf1e958b6ff5c2787cdae49e974c /src/Settings.hpp
parentTextureAtlas padding small textures (diff)
downloadAltCraft-e20289f53325036629870b257aee1728157a548e.tar
AltCraft-e20289f53325036629870b257aee1728157a548e.tar.gz
AltCraft-e20289f53325036629870b257aee1728157a548e.tar.bz2
AltCraft-e20289f53325036629870b257aee1728157a548e.tar.lz
AltCraft-e20289f53325036629870b257aee1728157a548e.tar.xz
AltCraft-e20289f53325036629870b257aee1728157a548e.tar.zst
AltCraft-e20289f53325036629870b257aee1728157a548e.zip
Diffstat (limited to '')
-rw-r--r--src/Settings.hpp25
1 files changed, 25 insertions, 0 deletions
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