changeset 3f943443ae30 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=3f943443ae30
description:
        base: Add getSectionNames to IniFile

        Add an accessor to IniFile to list all the sections in the file.

diffstat:

 src/base/inifile.cc |  10 ++++++++++
 src/base/inifile.hh |   3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)

diffs (33 lines):

diff -r fa66d9c5e180 -r 3f943443ae30 src/base/inifile.cc
--- a/src/base/inifile.cc       Mon Aug 25 14:32:00 2014 -0500
+++ b/src/base/inifile.cc       Sat Sep 20 17:17:47 2014 -0400
@@ -280,6 +280,16 @@
 }
 
 
+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()
 {
diff -r fa66d9c5e180 -r 3f943443ae30 src/base/inifile.hh
--- a/src/base/inifile.hh       Mon Aug 25 14:32:00 2014 -0500
+++ b/src/base/inifile.hh       Sat Sep 20 17:17:47 2014 -0400
@@ -192,6 +192,9 @@
     /// @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();
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to