From ace04a92a2d85a330c00f8479fa7b3cf2aad7c4d Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Fri, 19 Apr 2013 00:20:46 +0200 Subject: COMMON: Add ConfigFile::addSection function. --- common/config-file.cpp | 9 +++++++++ common/config-file.h | 1 + 2 files changed, 10 insertions(+) (limited to 'common') diff --git a/common/config-file.cpp b/common/config-file.cpp index fe042e9eda..0ce6dcf0c8 100644 --- a/common/config-file.cpp +++ b/common/config-file.cpp @@ -226,6 +226,15 @@ bool ConfigFile::saveToStream(WriteStream &stream) { return !stream.err(); } +void ConfigFile::addSection(const String §ion) { + Section *s = getSection(section); + if (s) + return; + + Section newSection; + newSection.name = section; + _sections.push_back(newSection); +} void ConfigFile::removeSection(const String §ion) { assert(isValidName(section)); diff --git a/common/config-file.h b/common/config-file.h index 8bd731c038..8bba851110 100644 --- a/common/config-file.h +++ b/common/config-file.h @@ -106,6 +106,7 @@ public: bool saveToStream(WriteStream &stream); bool hasSection(const String §ion) const; + void addSection(const String §ion); void removeSection(const String §ion); void renameSection(const String &oldName, const String &newName); -- cgit v1.2.3