aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlyssa Milburn2013-04-19 00:20:46 +0200
committerAlyssa Milburn2013-04-19 00:22:07 +0200
commitace04a92a2d85a330c00f8479fa7b3cf2aad7c4d (patch)
treefda1040bdc13a6016de4505f715543cd2b0e6e72 /common
parentd7a4a12b67755f258f3d60eadc9f9bd555ad119f (diff)
downloadscummvm-rg350-ace04a92a2d85a330c00f8479fa7b3cf2aad7c4d.tar.gz
scummvm-rg350-ace04a92a2d85a330c00f8479fa7b3cf2aad7c4d.tar.bz2
scummvm-rg350-ace04a92a2d85a330c00f8479fa7b3cf2aad7c4d.zip
COMMON: Add ConfigFile::addSection function.
Diffstat (limited to 'common')
-rw-r--r--common/config-file.cpp9
-rw-r--r--common/config-file.h1
2 files changed, 10 insertions, 0 deletions
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 &section) {
+ Section *s = getSection(section);
+ if (s)
+ return;
+
+ Section newSection;
+ newSection.name = section;
+ _sections.push_back(newSection);
+}
void ConfigFile::removeSection(const String &section) {
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 &section) const;
+ void addSection(const String &section);
void removeSection(const String &section);
void renameSection(const String &oldName, const String &newName);