diff --git a/Common/Data/Format/IniFile.h b/Common/Data/Format/IniFile.h index 8fa1e5c750..d5161787fe 100644 --- a/Common/Data/Format/IniFile.h +++ b/Common/Data/Format/IniFile.h @@ -133,30 +133,7 @@ public: // Returns true if key exists in section bool Exists(const char* sectionName, const char* key) const; - // TODO: Get rid of these, in favor of the Section ones. - void Set(const char* sectionName, const char* key, const char* newValue) { - GetOrCreateSection(sectionName)->Set(key, newValue); - } - void Set(const char* sectionName, const char* key, const std::string& newValue) { - GetOrCreateSection(sectionName)->Set(key, newValue.c_str()); - } - void Set(const char* sectionName, const char* key, int newValue) { - GetOrCreateSection(sectionName)->Set(key, newValue); - } - void Set(const char* sectionName, const char* key, uint32_t newValue) { - GetOrCreateSection(sectionName)->Set(key, newValue); - } - void Set(const char* sectionName, const char* key, uint64_t newValue) { - GetOrCreateSection(sectionName)->Set(key, newValue); - } - void Set(const char* sectionName, const char* key, bool newValue) { - GetOrCreateSection(sectionName)->Set(key, newValue); - } - void Set(const char* sectionName, const char* key, const std::vector& newValues) { - GetOrCreateSection(sectionName)->Set(key, newValues); - } - - // TODO: Get rid of these, in favor of the Section ones. + // These will not create the section if it doesn't exist. bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = ""); bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0); bool Get(const char* sectionName, const char* key, uint32_t* value, uint32_t defaultValue = 0); @@ -164,13 +141,6 @@ public: bool Get(const char* sectionName, const char* key, bool* value, bool defaultValue = false); bool Get(const char* sectionName, const char* key, std::vector& values); - template bool GetIfExists(const char* sectionName, const char* key, T value) - { - if (Exists(sectionName, key)) - return Get(sectionName, key, value); - return false; - } - bool GetKeys(const char* sectionName, std::vector& keys) const; bool DeleteKey(const char* sectionName, const char* key); diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index abf2970ce5..7aa9c55945 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -334,7 +334,7 @@ void SplitString(std::string_view str, const char delim, std::vector &output) { +void GetQuotedStrings(std::string_view str, std::vector &output) { size_t next = 0; bool even = 0; for (size_t pos = 0, len = str.length(); pos < len; ++pos) { @@ -372,11 +372,11 @@ void GetQuotedStrings(const std::string& str, std::vector &output) } } +// TODO: this is quite inefficient. std::string ReplaceAll(std::string_view input, std::string_view src, std::string_view dest) { size_t pos = 0; std::string result(input); - if (src == dest) return result; diff --git a/Common/StringUtils.h b/Common/StringUtils.h index da1ddf7468..2930d419e5 100644 --- a/Common/StringUtils.h +++ b/Common/StringUtils.h @@ -86,7 +86,7 @@ void SplitString(std::string_view str, const char delim, std::vector &output); -void GetQuotedStrings(const std::string& str, std::vector& output); +void GetQuotedStrings(std::string_view str, std::vector &output); std::string ReplaceAll(std::string_view input, std::string_view src, std::string_view dest);