Changeset View
Changeset View
Standalone View
Standalone View
src/util.h
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | protected: | ||||
mutable CCriticalSection cs_args; | mutable CCriticalSection cs_args; | ||||
std::map<std::string, std::vector<std::string>> m_override_args; | std::map<std::string, std::vector<std::string>> m_override_args; | ||||
std::map<std::string, std::vector<std::string>> m_config_args; | std::map<std::string, std::vector<std::string>> m_config_args; | ||||
std::string m_network; | std::string m_network; | ||||
std::set<std::string> m_network_only_args; | std::set<std::string> m_network_only_args; | ||||
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args; | std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args; | ||||
void ReadConfigStream(std::istream &stream); | bool ReadConfigStream(std::istream &stream, std::string &error, | ||||
bool ignore_invalid_keys = false); | |||||
public: | public: | ||||
ArgsManager(); | ArgsManager(); | ||||
/** | /** | ||||
* Select the network in use | * Select the network in use | ||||
*/ | */ | ||||
void SelectConfigNetwork(const std::string &network); | void SelectConfigNetwork(const std::string &network); | ||||
void ParseParameters(int argc, const char *const argv[]); | bool ParseParameters(int argc, const char *const argv[], | ||||
void ReadConfigFiles(); | std::string &error); | ||||
bool ReadConfigFiles(std::string &error, bool ignore_invalid_keys = false); | |||||
/** | /** | ||||
* Log warnings for options in m_section_only_args when they are specified | * Log warnings for options in m_section_only_args when they are specified | ||||
* in the default section but not overridden on the command line or in a | * in the default section but not overridden on the command line or in a | ||||
* network-specific section in the config file. | * network-specific section in the config file. | ||||
*/ | */ | ||||
void WarnForSectionOnlyArgs(); | void WarnForSectionOnlyArgs(); | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
void AddArg(const std::string &name, const std::string &help, | void AddArg(const std::string &name, const std::string &help, | ||||
const bool debug_only, const OptionsCategory &cat); | const bool debug_only, const OptionsCategory &cat); | ||||
// Remove an arg setting, used only in testing | // Remove an arg setting, used only in testing | ||||
void ClearArg(const std::string &strArg); | void ClearArg(const std::string &strArg); | ||||
/** | /** | ||||
* Clear available arguments | |||||
*/ | |||||
void ClearArgs() { m_available_args.clear(); } | |||||
/** | |||||
* Get the help string | * Get the help string | ||||
*/ | */ | ||||
std::string GetHelpMessage(); | std::string GetHelpMessage(); | ||||
/** | |||||
* Check whether we know of this arg | |||||
*/ | |||||
bool IsArgKnown(const std::string &key, std::string &error); | |||||
}; | }; | ||||
extern ArgsManager gArgs; | extern ArgsManager gArgs; | ||||
/** | /** | ||||
* @return true if help has been requested via a command-line arg | * @return true if help has been requested via a command-line arg | ||||
*/ | */ | ||||
bool HelpRequested(const ArgsManager &args); | bool HelpRequested(const ArgsManager &args); | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |