diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h index 2502c966c5db974efefae0b050b6efe104728505..5f218e2a1dc0f05d15bc93628702cdcf0c663a6a 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h @@ -132,8 +132,6 @@ public: bool use_cache = true) const; /// Searches for a key in the configuration property std::vector<std::string> getKeys(const std::string &keyName) const; - /// Returns a list of all keys under a given root key - std::vector<std::string> getKeysRecursive(const std::string &root = "") const; /// Returns a list of all full keys in the config std::vector<std::string> keys() const; /// Removes the value from a selected keyName @@ -287,6 +285,9 @@ private: /// if valid bool addDirectoryifExists(const std::string &directoryName, std::vector<std::string> &directoryList); + /// Returns a list of all keys under a given root key + void getKeysRecursive(const std::string &root, + std::vector<std::string> &allKeys) const; // Forward declaration of inner class template <class T> class WrappedObject; diff --git a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp index 5ba7a9c5f15da078dc63ad8f65a492a6233caee5..0d1c898db516d6bd5485c6b51655e54e659254f3 100644 --- a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp +++ b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp @@ -1003,10 +1003,13 @@ ConfigServiceImpl::getKeys(const std::string &keyName) const { * * @return Vector containing all config options */ -std::vector<std::string> ConfigServiceImpl::getKeysRecursive(const std::string &root) const { - std::vector<std::string> allKeys; +void ConfigServiceImpl::getKeysRecursive(const std::string &root, + std::vector<std::string> &allKeys) const { std::vector<std::string> rootKeys = getKeys(root); + if(rootKeys.size() == 0) + allKeys.push_back(root); + for (auto rkIt = rootKeys.begin(); rkIt != rootKeys.end(); ++rkIt) { std::string searchString; if (root.empty()) { @@ -1015,18 +1018,8 @@ std::vector<std::string> ConfigServiceImpl::getKeysRecursive(const std::string & searchString = root + "." + *rkIt; } - std::vector<std::string> subKeys = getKeysRecursive(searchString); - - if (subKeys.size() == 0) { - allKeys.push_back(*rkIt); - } else { - for (auto skIt = subKeys.begin(); skIt != subKeys.end(); ++skIt) { - allKeys.push_back(*rkIt + "." + *skIt); - } - } + getKeysRecursive(searchString, allKeys); } - - return allKeys; } /** @@ -1038,7 +1031,9 @@ std::vector<std::string> ConfigServiceImpl::getKeysRecursive(const std::string & * @return Vector containing all config options */ std::vector<std::string> ConfigServiceImpl::keys() const { - return getKeysRecursive(); + std::vector<std::string> allKeys; + getKeysRecursive("", allKeys); + return allKeys; } /** Removes a key from the memory stored properties file and inserts the key