From 0fa54358b06b58f4d17073bcc8a959eb9498aadc Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 12 Nov 2019 13:56:18 -0500 Subject: [PATCH] refactor: Add ArgsManager::GetSettingsList method Add for consistency with ArgsManager::GetSetting method and to make setting types accessible to ArgsManager callers and tests (test added next commit). This commit does not change behavior. --- src/util/system.cpp | 11 +++++++---- src/util/system.h | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/util/system.cpp b/src/util/system.cpp index 8ea8234225..b6a026b02a 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -352,11 +352,8 @@ Optional ArgsManager::GetArgFlags(const std::string& name) const std::vector ArgsManager::GetArgs(const std::string& strArg) const { - LOCK(cs_args); - bool ignore_default_section_config = !UseDefaultSection(strArg); std::vector result; - for (const util::SettingsValue& value : - util::GetSettingsList(m_settings, m_network, SettingName(strArg), ignore_default_section_config)) { + for (const util::SettingsValue& value : GetSettingsList(strArg)) { result.push_back(value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str()); } return result; @@ -869,6 +866,12 @@ util::SettingsValue ArgsManager::GetSetting(const std::string& arg) const m_settings, m_network, SettingName(arg), !UseDefaultSection(arg), /* get_chain_name= */ false); } +std::vector ArgsManager::GetSettingsList(const std::string& arg) const +{ + LOCK(cs_args); + return util::GetSettingsList(m_settings, m_network, SettingName(arg), !UseDefaultSection(arg)); +} + bool RenameOver(fs::path src, fs::path dest) { #ifdef WIN32 diff --git a/src/util/system.h b/src/util/system.h index 4db3028196..633560d70c 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -180,6 +180,11 @@ protected: */ util::SettingsValue GetSetting(const std::string& arg) const; + /** + * Get list of setting values. + */ + std::vector GetSettingsList(const std::string& arg) const; + public: ArgsManager();