diff --git a/src/Rules.cpp b/src/Rules.cpp index cc39e6b6..8ba84a26 100644 --- a/src/Rules.cpp +++ b/src/Rules.cpp @@ -146,12 +146,14 @@ void Rules::set (const std::string& key, const std::string& value) } //////////////////////////////////////////////////////////////////////////////// -// Provide a vector of all configuration keys. -std::vector Rules::all () const +// Provide a vector of all configuration keys. If a stem is provided, only +// return matching keys. +std::vector Rules::all (const std::string& stem) const { std::vector items; for (const auto& it : _settings) - items.push_back (it.first); + if (stem == "" || it.first.find (stem) == 0) + items.push_back (it.first); return items; } diff --git a/src/Rules.h b/src/Rules.h index 88d9f782..5766b40b 100644 --- a/src/Rules.h +++ b/src/Rules.h @@ -49,7 +49,7 @@ public: void set (const std::string&, const double); void set (const std::string&, const std::string&); - std::vector all () const; + std::vector all (const std::string& stem = "") const; std::string dump () const;