summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/inifile.cc11
-rw-r--r--src/base/inifile.hh6
2 files changed, 17 insertions, 0 deletions
diff --git a/src/base/inifile.cc b/src/base/inifile.cc
index 402c6469f..80ed3eb06 100644
--- a/src/base/inifile.cc
+++ b/src/base/inifile.cc
@@ -230,6 +230,17 @@ IniFile::find(const string &sectionName, const string &entryName,
}
bool
+IniFile::entryExists(const string &sectionName, const string &entryName) const
+{
+ Section *section = findSection(sectionName);
+
+ if (!section)
+ return false;
+ else
+ return section->findEntry(entryName);
+}
+
+bool
IniFile::sectionExists(const string &sectionName) const
{
return findSection(sectionName) != NULL;
diff --git a/src/base/inifile.hh b/src/base/inifile.hh
index b4892d60a..447ec7c0f 100644
--- a/src/base/inifile.hh
+++ b/src/base/inifile.hh
@@ -184,6 +184,12 @@ class IniFile
bool find(const std::string &section, const std::string &entry,
std::string &value) const;
+ /// Determine whether the entry exists within named section exists
+ /// in the .ini file.
+ /// @return True if the section exists.
+ bool entryExists(const std::string &section,
+ const std::string &entry) const;
+
/// Determine whether the named section exists in the .ini file.
/// Note that the 'Section' class is (intentionally) not public,
/// so all clients can do is get a bool that says whether there