Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 621 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
void ArgsManager::ForceSetMultiArg(const std::string &strArg, | void ArgsManager::ForceSetMultiArg(const std::string &strArg, | ||||
const std::string &strValue) { | const std::string &strValue) { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
m_override_args[strArg].push_back(strValue); | m_override_args[strArg].push_back(strValue); | ||||
} | } | ||||
void ArgsManager::AddArg(const std::string &name, const std::string &help, | void ArgsManager::AddArg(const std::string &name, const std::string &help, | ||||
const bool debug_only, const OptionsCategory &cat) { | unsigned int flags, const bool debug_only, | ||||
const OptionsCategory &cat) { | |||||
// Split arg name from its help param | // Split arg name from its help param | ||||
size_t eq_index = name.find('='); | size_t eq_index = name.find('='); | ||||
if (eq_index == std::string::npos) { | if (eq_index == std::string::npos) { | ||||
eq_index = name.size(); | eq_index = name.size(); | ||||
} | } | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
std::map<std::string, Arg> &arg_map = m_available_args[cat]; | std::map<std::string, Arg> &arg_map = m_available_args[cat]; | ||||
auto ret = | auto ret = | ||||
arg_map.emplace(name.substr(0, eq_index), | arg_map.emplace(name.substr(0, eq_index), | ||||
Arg{name.substr(eq_index, name.size() - eq_index), help, | Arg{name.substr(eq_index, name.size() - eq_index), help, | ||||
ArgsManager::NONE, debug_only}); | ArgsManager::NONE, debug_only}); | ||||
// Make sure an insertion actually happened. | // Make sure an insertion actually happened. | ||||
assert(ret.second); | assert(ret.second); | ||||
} | } | ||||
void ArgsManager::AddHiddenArgs(const std::vector<std::string> &names) { | void ArgsManager::AddHiddenArgs(const std::vector<std::string> &names) { | ||||
for (const std::string &name : names) { | for (const std::string &name : names) { | ||||
AddArg(name, "", false, OptionsCategory::HIDDEN); | AddArg(name, "", ArgsManager::ALLOW_ANY, false, | ||||
OptionsCategory::HIDDEN); | |||||
} | } | ||||
} | } | ||||
void ArgsManager::ClearArg(const std::string &strArg) { | void ArgsManager::ClearArg(const std::string &strArg) { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
m_override_args.erase(strArg); | m_override_args.erase(strArg); | ||||
m_config_args.erase(strArg); | m_config_args.erase(strArg); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 730 Lines • Show Last 20 Lines |