base: Add getSectionNames to IniFile

Add an accessor to IniFile to list all the sections in the file.
This commit is contained in:
Andrew Bardsley 2014-09-20 17:17:47 -04:00
parent e553ca67d4
commit b2c2e67468
2 changed files with 13 additions and 0 deletions

View file

@ -280,6 +280,16 @@ IniFile::Section::printUnreferenced(const string &sectionName)
}
void
IniFile::getSectionNames(vector<string> &list) const
{
for (SectionTable::const_iterator i = table.begin();
i != table.end(); ++i)
{
list.push_back((*i).first);
}
}
bool
IniFile::printUnreferenced()
{

View file

@ -192,6 +192,9 @@ class IniFile
/// @return True if the section exists.
bool sectionExists(const std::string &section) const;
/// Push all section names into the given vector
void getSectionNames(std::vector<std::string> &list) const;
/// Print unreferenced entries in object. Iteratively calls
/// printUnreferend() on all the constituent sections.
bool printUnreferenced();