From 9c3265f1ef1a443c611ca71eb19a137271c2434c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Wed, 15 Feb 2017 16:25:37 +0100 Subject: [PATCH] Config: Keep track of deleted keys This allows deleted keys to be deleted from INIs properly. --- Source/Core/Common/Config.cpp | 2 ++ Source/Core/Common/Config.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Source/Core/Common/Config.cpp b/Source/Core/Common/Config.cpp index 5ed41ef589..796ed62653 100644 --- a/Source/Core/Common/Config.cpp +++ b/Source/Core/Common/Config.cpp @@ -120,6 +120,8 @@ bool Section::Delete(const std::string& key) return false; m_values.erase(it); + + m_deleted_keys.push_back(key); m_dirty = true; return true; } diff --git a/Source/Core/Common/Config.h b/Source/Core/Common/Config.h index 3b8614f264..f08de4ec8b 100644 --- a/Source/Core/Common/Config.h +++ b/Source/Core/Common/Config.h @@ -98,6 +98,7 @@ public: virtual bool HasLines() const { return m_lines.size() > 0; } const std::string& GetName() const { return m_name; } const SectionValueMap& GetValues() const { return m_values; } + const std::vector& GetDeletedKeys() const { return m_deleted_keys; } bool IsDirty() const { return m_dirty; } void ClearDirty() { m_dirty = false; } protected: @@ -109,6 +110,7 @@ protected: static const std::string& NULL_STRING; SectionValueMap m_values; + std::vector m_deleted_keys; std::vector m_lines; };