From 84455254c6fd4918e8f87f8804c0139bfc4487d4 Mon Sep 17 00:00:00 2001 From: Jessica James Date: Sat, 8 Aug 2020 19:14:50 -0500 Subject: [PATCH] Added Config::removeSection --- src/common/Config.cpp | 5 +++++ src/include/Jupiter/Config.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/common/Config.cpp b/src/common/Config.cpp index d5fd65b..6d0fe29 100644 --- a/src/common/Config.cpp +++ b/src/common/Config.cpp @@ -76,6 +76,11 @@ bool Jupiter::Config::remove(const Jupiter::ReadableString &in_key) return m_table.erase(in_key) > 0; } +bool Jupiter::Config::removeSection(const Jupiter::ReadableString &in_key) +{ + return m_sections != nullptr && m_sections->erase(in_key) > 0; +} + const std::string &Jupiter::Config::getName() const { return m_name; diff --git a/src/include/Jupiter/Config.h b/src/include/Jupiter/Config.h index e19a0ab..33b8fcd 100644 --- a/src/include/Jupiter/Config.h +++ b/src/include/Jupiter/Config.h @@ -109,6 +109,14 @@ namespace Jupiter */ bool remove(const Jupiter::ReadableString &in_key); + /** + * @brief Removes a section from the table + * + * @param in_key Key of the section to remove + * @return True if an entry was removed, false otherwise + */ + bool removeSection(const Jupiter::ReadableString &in_key); + /** * @brief Fetches the name of this config section * Note: This is the filename on the root node