From: Andrew Bardsley Date: Sat, 20 Sep 2014 21:17:47 +0000 (-0400) Subject: base: Add getSectionNames to IniFile X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2c2e67468bba6dbbbfb6856ca94fdcfa1492258;p=gem5.git base: Add getSectionNames to IniFile Add an accessor to IniFile to list all the sections in the file. --- diff --git a/src/base/inifile.cc b/src/base/inifile.cc index 011887635..402c6469f 100644 --- a/src/base/inifile.cc +++ b/src/base/inifile.cc @@ -280,6 +280,16 @@ IniFile::Section::printUnreferenced(const string §ionName) } +void +IniFile::getSectionNames(vector &list) const +{ + for (SectionTable::const_iterator i = table.begin(); + i != table.end(); ++i) + { + list.push_back((*i).first); + } +} + bool IniFile::printUnreferenced() { diff --git a/src/base/inifile.hh b/src/base/inifile.hh index 83cf80cf0..c2d263619 100644 --- a/src/base/inifile.hh +++ b/src/base/inifile.hh @@ -192,6 +192,9 @@ class IniFile /// @return True if the section exists. bool sectionExists(const std::string §ion) const; + /// Push all section names into the given vector + void getSectionNames(std::vector &list) const; + /// Print unreferenced entries in object. Iteratively calls /// printUnreferend() on all the constituent sections. bool printUnreferenced();