Use a struct for arguments and nested map for categories

Instead of a single map with the category and name as the key,
make m_available_args contain maps. The key will be the category and
the value is a map which actually contains the arguments for that
category. The nested map's key is the argument name, while the value
is a struct that contains the help text and whether the argument is
a debug only argument.
This commit is contained in:
Andrew Chow
2018-05-16 15:15:18 -04:00
parent fd96d54f39
commit 174f7c8080
2 changed files with 66 additions and 25 deletions

View File

@@ -140,12 +140,21 @@ class ArgsManager
protected:
friend class ArgsManagerHelper;
struct Arg
{
std::string m_help_param;
std::string m_help_text;
bool m_debug_only;
Arg(const std::string& help_param, const std::string& help_text, bool debug_only) : m_help_param(help_param), m_help_text(help_text), m_debug_only(debug_only) {};
};
mutable CCriticalSection cs_args;
std::map<std::string, std::vector<std::string>> m_override_args;
std::map<std::string, std::vector<std::string>> m_config_args;
std::string m_network;
std::set<std::string> m_network_only_args;
std::map<std::pair<OptionsCategory, std::string>, std::pair<std::string, bool>> m_available_args;
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args;
void ReadConfigStream(std::istream& stream);