diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index f3ea5751babc..dda5e1ff0efd 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -60,30 +60,6 @@ void IniFile::Section::Set(const std::string& key, const std::string& newValue, Delete(key); } -void IniFile::Section::Set(const std::string& key, const float newValue, const float defaultValue) -{ - if (newValue != defaultValue) - Set(key, newValue); - else - Delete(key); -} - -void IniFile::Section::Set(const std::string& key, int newValue, int defaultValue) -{ - if (newValue != defaultValue) - Set(key, newValue); - else - Delete(key); -} - -void IniFile::Section::Set(const std::string& key, bool newValue, bool defaultValue) -{ - if (newValue != defaultValue) - Set(key, newValue); - else - Delete(key); -} - void IniFile::Section::Set(const std::string& key, const std::vector& newValues) { std::string temp; diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h index 449aed1db0dd..5f513624031c 100644 --- a/Source/Core/Common/IniFile.h +++ b/Source/Core/Common/IniFile.h @@ -50,23 +50,31 @@ class IniFile Set(key, StringFromFormat("%f", newValue)); } - void Set(const std::string& key, const float newValue, const float defaultValue); void Set(const std::string& key, double newValue) { Set(key, StringFromFormat("%f", newValue)); } - void Set(const std::string& key, int newValue, int defaultValue); void Set(const std::string& key, int newValue) { Set(key, StringFromInt(newValue)); } - void Set(const std::string& key, bool newValue, bool defaultValue); void Set(const std::string& key, bool newValue) { Set(key, StringFromBool(newValue)); + } + + template + void Set(const std::string& key, T newValue, const T defaultValue) + { + if (newValue != defaultValue) + Set(key, newValue); + else + Delete(key); + } + void Set(const std::string& key, const std::vector& newValues); bool Get(const std::string& key, int* value, int defaultValue = 0);