summaryrefslogtreecommitdiff
path: root/Source/Core/Common/IniFile.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2018-12-26 20:15:32 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2018-12-26 20:15:32 -0600
commita464025bba1db6f4f26d011fd52d10a9321f1d87 (patch)
tree971c1689bb4570e59345af1dcf7d4be6dad69d68 /Source/Core/Common/IniFile.cpp
parentf510f6ef0d72764cae23a1c662ffdc92c45acd9e (diff)
IniFile: Minor cleanup. Removed unused function. Improved template usage.
Diffstat (limited to 'Source/Core/Common/IniFile.cpp')
-rw-r--r--Source/Core/Common/IniFile.cpp48
1 files changed, 4 insertions, 44 deletions
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp
index 604c4b0fc9..85fd180cd5 100644
--- a/Source/Core/Common/IniFile.cpp
+++ b/Source/Core/Common/IniFile.cpp
@@ -45,23 +45,18 @@ IniFile::Section::Section(std::string name_) : name{std::move(name_)}
{
}
-void IniFile::Section::Set(const std::string& key, const std::string& newValue)
+void IniFile::Section::Set(const std::string& key, std::string new_value)
{
auto it = values.find(key);
if (it != values.end())
- it->second = newValue;
+ it->second = std::move(new_value);
else
{
- values[key] = newValue;
+ values[key] = std::move(new_value);
keys_order.push_back(key);
}
}
-void IniFile::Section::Set(const std::string& key, const std::vector<std::string>& newValues)
-{
- Set(key, JoinStrings(newValues, ","));
-}
-
bool IniFile::Section::Get(const std::string& key, std::string* value,
const std::string& defaultValue) const
{
@@ -80,36 +75,6 @@ bool IniFile::Section::Get(const std::string& key, std::string* value,
return false;
}
-bool IniFile::Section::Get(const std::string& key, std::vector<std::string>* out) const
-{
- std::string temp;
- bool retval = Get(key, &temp);
- if (!retval || temp.empty())
- {
- return false;
- }
-
- // ignore starting comma, if any
- size_t subStart = temp.find_first_not_of(",");
-
- // split by comma
- while (subStart != std::string::npos)
- {
- // Find next comma
- size_t subEnd = temp.find(',', subStart);
- if (subStart != subEnd)
- {
- // take from first char until next comma
- out->push_back(StripSpaces(temp.substr(subStart, subEnd - subStart)));
- }
-
- // Find the next non-comma char
- subStart = temp.find_first_not_of(",", subEnd);
- }
-
- return true;
-}
-
bool IniFile::Section::Exists(const std::string& key) const
{
return values.find(key) != values.end();
@@ -126,12 +91,7 @@ bool IniFile::Section::Delete(const std::string& key)
return true;
}
-void IniFile::Section::SetLines(const std::vector<std::string>& lines)
-{
- m_lines = lines;
-}
-
-void IniFile::Section::SetLines(std::vector<std::string>&& lines)
+void IniFile::Section::SetLines(std::vector<std::string> lines)
{
m_lines = std::move(lines);
}