diff options
| author | Lioncash <mathew1800@gmail.com> | 2017-03-22 18:49:11 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2017-03-22 18:49:13 -0400 |
| commit | d8998b63927c63b120efd7ba63dbe62e491305b0 (patch) | |
| tree | f27c2e7b006f1e1da2b078cd1c33e755712fba03 /Source/Core/Common/IniFile.cpp | |
| parent | 46d74a7760e58ec36d59ab525ced11d884bcb267 (diff) | |
IniFile: Provide an rvalue reference overload for SetLines
Allows moving in vectors instead of performing an unnecessary copy.
Diffstat (limited to 'Source/Core/Common/IniFile.cpp')
| -rw-r--r-- | Source/Core/Common/IniFile.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index cf2c89e0f3..065d7e9b3c 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -267,6 +267,11 @@ void IniFile::Section::SetLines(const std::vector<std::string>& lines) m_lines = lines; } +void IniFile::Section::SetLines(std::vector<std::string>&& lines) +{ + m_lines = std::move(lines); +} + bool IniFile::Section::GetLines(std::vector<std::string>* lines, const bool remove_comments) const { for (std::string line : m_lines) @@ -352,6 +357,12 @@ void IniFile::SetLines(const std::string& sectionName, const std::vector<std::st section->SetLines(lines); } +void IniFile::SetLines(const std::string& section_name, std::vector<std::string>&& lines) +{ + Section* section = GetOrCreateSection(section_name); + section->SetLines(std::move(lines)); +} + bool IniFile::DeleteKey(const std::string& sectionName, const std::string& key) { Section* section = GetSection(sectionName); |
