MCPcopy Create free account
hub / github.com/LUX-Core/lux / ParseParameters

Function ParseParameters

src/util.cpp:370–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370void ParseParameters(int argc, const char* const argv[])
371{
372 mapArgs.clear();
373 mapMultiArgs.clear();
374
375 for (int i = 1; i < argc; i++) {
376 std::string str(argv[i]);
377 std::string strValue;
378 size_t is_index = str.find('=');
379 if (is_index != std::string::npos) {
380 strValue = str.substr(is_index + 1);
381 str = str.substr(0, is_index);
382 }
383#ifdef WIN32
384 boost::to_lower(str);
385 if (boost::algorithm::starts_with(str, "/"))
386 str = "-" + str.substr(1);
387#endif
388
389 if (str[0] != '-')
390 break;
391
392 // Interpret --foo as -foo.
393 // If both --foo and -foo are set, the last takes effect.
394 if (str.length() > 1 && str[1] == '-')
395 str = str.substr(1);
396
397 mapArgs[str] = strValue;
398 mapMultiArgs[str].push_back(strValue);
399 }
400
401 // New 0.6 features:
402 for (const PAIRTYPE(string, string) & entry : mapArgs) {
403 // interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
404 InterpretNegativeSetting(entry.first, mapArgs);
405 }
406}
407
408bool IsArgSet(const std::string& strArg)
409{

Callers 6

AppInitRawTxFunction · 0.85
AppInitFunction · 0.85
AppInitRPCFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
ResetArgsFunction · 0.85
mainFunction · 0.85

Calls 5

InterpretNegativeSettingFunction · 0.85
clearMethod · 0.45
findMethod · 0.45
lengthMethod · 0.45
push_backMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
ResetArgsFunction · 0.68