diff options
-rw-r--r-- | base/inifile.cc | 8 | ||||
-rw-r--r-- | base/inifile.hh | 7 | ||||
-rw-r--r-- | sim/serialize.cc | 7 | ||||
-rw-r--r-- | sim/serialize.hh | 2 |
4 files changed, 24 insertions, 0 deletions
diff --git a/base/inifile.cc b/base/inifile.cc index 7e7485bcb..2717a534d 100644 --- a/base/inifile.cc +++ b/base/inifile.cc @@ -402,6 +402,14 @@ IniFile::findAppend(const string &_section, const string &entry, return ret; } + +bool +IniFile::sectionExists(const string §ionName) const +{ + return findSection(sectionName) != NULL; +} + + bool IniFile::Section::printUnreferenced(const string §ionName) { diff --git a/base/inifile.hh b/base/inifile.hh index f67fdc7be..f7229f2f2 100644 --- a/base/inifile.hh +++ b/base/inifile.hh @@ -208,6 +208,13 @@ class IniFile bool findAppend(const std::string §ion, const std::string &entry, std::string &value) 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 + /// are any values in that section or not. + /// @return True if the section exists. + bool sectionExists(const std::string §ion) const; + /// Print unreferenced entries in object. Iteratively calls /// printUnreferend() on all the constituent sections. bool printUnreferenced(); diff --git a/sim/serialize.cc b/sim/serialize.cc index bd528c678..0eb26c31d 100644 --- a/sim/serialize.cc +++ b/sim/serialize.cc @@ -494,3 +494,10 @@ Checkpoint::findObj(const std::string §ion, const std::string &entry, return false; } + + +bool +Checkpoint::sectionExists(const std::string §ion) +{ + return db->sectionExists(section); +} diff --git a/sim/serialize.hh b/sim/serialize.hh index 78cbb702a..09e91d816 100644 --- a/sim/serialize.hh +++ b/sim/serialize.hh @@ -244,6 +244,8 @@ class Checkpoint bool findObj(const std::string §ion, const std::string &entry, Serializeable *&value); + + bool sectionExists(const std::string §ion); }; |