diff --git a/dune/common/configparser.cc b/dune/common/configparser.cc index 1de5239d27edc72d6469a0f892f80f256edac5f2..bb6b7b2b4bbb4ef35772042b264fd3a6af747073 100644 --- a/dune/common/configparser.cc +++ b/dune/common/configparser.cc @@ -137,7 +137,7 @@ void ConfigParser::report(const string prefix) const } } -bool ConfigParser::hasKey(const string& key) const +bool ConfigParser::hasKey(const string& key) { string::size_type dot = key.find("."); @@ -147,14 +147,14 @@ bool ConfigParser::hasKey(const string& key) const if (subs.count(prefix) == 0) return false; - const ConfigParser& s = sub(prefix); + ConfigParser& s = sub(prefix); return s.hasKey(key.substr(dot+1)); } else return (values.count(key) != 0); } -bool ConfigParser::hasSub(const string& key) const +bool ConfigParser::hasSub(const string& key) { string::size_type dot = key.find("."); @@ -164,7 +164,7 @@ bool ConfigParser::hasSub(const string& key) const if (subs.count(prefix) == 0) return false; - const ConfigParser& s = sub(prefix); + ConfigParser& s = sub(prefix); return s.hasSub(key.substr(dot+1)); } else @@ -184,19 +184,6 @@ ConfigParser& ConfigParser::sub(const string& key) return subs[key]; } -const ConfigParser& ConfigParser::sub(const string& key) const -{ - string::size_type dot = key.find("."); - - if (dot != string::npos) - { - const ConfigParser& s = sub(key.substr(0,dot)); - return s.sub(key.substr(dot+1)); - } - else - return subs.at(key); -} - string& ConfigParser::operator[] (const string& key) { string::size_type dot = key.find("."); diff --git a/dune/common/configparser.hh b/dune/common/configparser.hh index 7d0076b28e33fe8bbf3389ac98154013eefcff1f..79e7498f1a2ca58de43b2c72333182d058e3515d 100644 --- a/dune/common/configparser.hh +++ b/dune/common/configparser.hh @@ -94,7 +94,7 @@ namespace Dune { * \param key key name * \return true if key exists in structure, otherwise false */ - bool hasKey(const std::string& key) const; + bool hasKey(const std::string& key); /** \brief test for substructure @@ -104,7 +104,7 @@ namespace Dune { * \param sub substructure name * \return true if substructure exists in structure, otherwise false */ - bool hasSub(const std::string& sub) const; + bool hasSub(const std::string& sub); /** \brief get value reference for key @@ -140,14 +140,6 @@ namespace Dune { ConfigParser& sub(const std::string& sub); - /** \brief get const substructure by name - * - * \param sub substructure name - * \return reference to substructure - */ - const ConfigParser& sub(const std::string& sub) const; - - /** \brief get value as string * * Returns pure string value for given key.