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

Function GetBoolArg

src/util.cpp:427–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425}
426
427bool GetBoolArg(const std::string& strArg, bool fDefault)
428{
429 if (mapArgs.count(strArg)) {
430
431 int n = fDefault ? 1 : 0;
432
433 // sample: -testnet
434 if (mapArgs[strArg].empty())
435 return true;
436
437 try {
438 // stoi() doesn't handle boolean strings
439 if (mapArgs[strArg] == "false")
440 n = 0;
441 else if (mapArgs[strArg] == "true")
442 n = 1;
443 else
444 n = std::stoi(mapArgs[strArg]);
445 } catch (const std::exception& e) {
446 }
447 return (n != 0);
448 }
449 return fDefault;
450}
451
452bool SoftSetArg(const std::string& strArg, const std::string& strValue)
453{

Callers 15

OpenMethod · 0.85
AppInitRawTxFunction · 0.85
OutputTxFunction · 0.85
InitHTTPServerFunction · 0.85
AddToBlockMethod · 0.85
NetworkIdFromCommandLineFunction · 0.85
AppInitFunction · 0.85
OnRPCPreCommandFunction · 0.85
HelpMessageFunction · 0.85
ThreadImportFunction · 0.85
AppInitServersFunction · 0.85

Calls 2

countMethod · 0.45
emptyMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68