diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2018-06-03 14:18:58 +0200 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2018-06-03 14:53:56 +0200 |
| commit | cba32b12e77c8f023ca5efeda7c386b856ad3f47 (patch) | |
| tree | a3ef6f9f07fc85c4d5cc66ff3c2f6403c978baa5 /Source/Core/Common/IniFile.h | |
| parent | fc0193c4b108d9a914b841829b1c0f0306b609b9 (diff) | |
IniFile: Use templates for Set()
Diffstat (limited to 'Source/Core/Common/IniFile.h')
| -rw-r--r-- | Source/Core/Common/IniFile.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h index 697e700e7e..4830422ea3 100644 --- a/Source/Core/Common/IniFile.h +++ b/Source/Core/Common/IniFile.h @@ -12,6 +12,7 @@ #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/StringUtil.h" struct CaseInsensitiveStringCompare { @@ -35,20 +36,17 @@ public: bool Delete(const std::string& key); void Set(const std::string& key, const std::string& newValue); - void Set(const std::string& key, const std::string& newValue, const std::string& defaultValue); - void Set(const std::string& key, u32 newValue); - void Set(const std::string& key, u64 new_value); - void Set(const std::string& key, float newValue); - void Set(const std::string& key, double newValue); - void Set(const std::string& key, int newValue); - void Set(const std::string& key, s64 new_value); - void Set(const std::string& key, bool newValue); + template <typename T> + void Set(const std::string& key, const T& new_value) + { + Set(key, ValueToString(new_value)); + } template <typename T> - void Set(const std::string& key, T newValue, const T defaultValue) + void Set(const std::string& key, const T& new_value, const std::common_type_t<T>& default_value) { - if (newValue != defaultValue) - Set(key, newValue); + if (new_value != default_value) + Set(key, new_value); else Delete(key); } |
