Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <util.h>
Public Member Functions | |
ArgsManager () | |
void | SelectConfigNetwork (const std::string &network) |
Select the network in use. More... | |
void | ParseParameters (int argc, const char *const argv[]) |
void | ReadConfigFile (const std::string &confPath) |
void | WarnForSectionOnlyArgs () |
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 network-specific section in the config file. More... | |
std::vector< std::string > | GetArgs (const std::string &strArg) const |
Return a vector of strings of the given argument. More... | |
bool | IsArgSet (const std::string &strArg) const |
Return true if the given argument has been manually set. More... | |
bool | IsArgNegated (const std::string &strArg) const |
Return true if the argument was originally passed as a negated option, i.e. More... | |
std::string | GetArg (const std::string &strArg, const std::string &strDefault) const |
Return string argument or default value. More... | |
int64_t | GetArg (const std::string &strArg, int64_t nDefault) const |
Return integer argument or default value. More... | |
bool | GetBoolArg (const std::string &strArg, bool fDefault) const |
Return boolean argument or default value. More... | |
bool | SoftSetArg (const std::string &strArg, const std::string &strValue) |
Set an argument if it doesn't already have a value. More... | |
bool | SoftSetBoolArg (const std::string &strArg, bool fValue) |
Set a boolean argument if it doesn't already have a value. More... | |
void | ForceSetArg (const std::string &strArg, const std::string &strValue) |
void | ForceRemoveArg (const std::string &strArg) |
std::string | GetChainName () const |
Looks for -regtest, -testnet and returns the appropriate BIP70 chain name. More... | |
std::string | GetDevNetName () const |
Looks for -devnet and returns either "devnet-<name>" or simply "devnet" if no name was specified. More... | |
Protected Member Functions | |
void | ReadConfigStream (std::istream &stream) |
Protected Attributes | |
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 |
Friends | |
class | ArgsManagerHelper |
Detailed Description
Constructor & Destructor Documentation
◆ ArgsManager()
Member Function Documentation
◆ ForceRemoveArg()
void ArgsManager::ForceRemoveArg | ( | const std::string & | strArg | ) |
Definition at line 854 of file util.cpp.
References cs_args, LOCK, m_config_args, m_network, m_override_args, and ArgsManagerHelper::NetworkArg().
Referenced by AppInitParameterInteraction(), CWallet::GenerateNewHDChain(), and WalletInit::ParameterInteraction().
◆ ForceSetArg()
void ArgsManager::ForceSetArg | ( | const std::string & | strArg, |
const std::string & | strValue | ||
) |
Definition at line 848 of file util.cpp.
References cs_args, LOCK, and m_override_args.
Referenced by CommandLineRPC(), InitParameterInteraction(), and SoftSetArg().
◆ GetArg() [1/2]
std::string ArgsManager::GetArg | ( | const std::string & | strArg, |
const std::string & | strDefault | ||
) | const |
Return string argument or default value.
- Parameters
-
strArg Argument to get (e.g. "-foo") strDefault (e.g. "1")
- Returns
- command-line argument or default value
Definition at line 808 of file util.cpp.
References ArgsManagerHelper::GetArg(), and IsArgNegated().
Referenced by AcceptToMemoryPoolWorker(), CChainState::ActivateBestChain(), OptionsModel::addOverriddenOption(), AddTimeData(), AddToCompactExtraTransactions(), CWallet::AddToWallet(), AlertNotify(), AppInit(), AppInitMain(), AppInitParameterInteraction(), AppInitRawTx(), AppInitRPC(), TorController::auth_cb(), CConnman::Ban(), CCoinsViewDB::BatchWrite(), BitcoinGUI::BitcoinGUI(), BlockNotifyCallback(), CallRPC(), llmq::CSigningManager::Cleanup(), CZMQNotificationInterface::Create(), BlockAssembler::CreateNewBlock(), CWallet::CreateTransaction(), CWallet::CreateWalletFromFile(), DefaultOptions(), BerkeleyBatch::Flush(), FlushStateToDisk(), CWallet::GenerateNewHDChain(), GetAuthCookieFile(), GetBackupsDir(), getblockchaininfo(), GetDataDir(), GetDebugLogPath(), GetDevNetName(), GetLangTerritory(), GetListenPort(), GetMinimumFee(), GetPidFile(), GetWalletDir(), HelpExampleRpc(), HTTPBindAddresses(), OptionsModel::Init(), CKeePassIntegrator::init(), CWallet::InitAutoBackup(), InitHTTPServer(), BitcoinApplication::initializeResult(), InitParameterInteraction(), WalletInit::InitPrivateSendSettings(), InitRPCAuthentication(), InitScriptExecutionCache(), InitSignatureCache(), Intro::Intro(), LoadMempool(), PaymentServer::LoadRootCAs(), GUIUtil::loadStyleSheet(), main(), mempoolInfoToJSON(), Misbehaving(), CWallet::NotifyTransactionLock(), GUIUtil::openConfigfile(), WalletInit::ParameterInteraction(), Intro::pickDataDirectory(), PrepareShutdown(), CMNAuth::ProcessMessage(), ProcessMessage(), TorController::protocolinfo_cb(), CMNAuth::PushMNAUTH(), ReadConfigFile(), RPCConsole::RPCConsole(), CWallet::SelectCoins(), StartHTTPServer(), ThreadImport(), CWallet::TopUpKeyPool(), TorControlThread(), CWallet::Unlock(), UpdateMempoolForReorg(), WalletInit::Verify(), and verifychain().
◆ GetArg() [2/2]
int64_t ArgsManager::GetArg | ( | const std::string & | strArg, |
int64_t | nDefault | ||
) | const |
Return integer argument or default value.
- Parameters
-
strArg Argument to get (e.g. "-foo") nDefault (e.g. 1)
- Returns
- command-line argument (0 if invalid number) or default value
Definition at line 816 of file util.cpp.
References atoi64(), ArgsManagerHelper::GetArg(), and IsArgNegated().
◆ GetArgs()
std::vector< std::string > ArgsManager::GetArgs | ( | const std::string & | strArg | ) | const |
Return a vector of strings of the given argument.
- Parameters
-
strArg Argument to get (e.g. "-foo")
- Returns
- command-line arguments
Definition at line 765 of file util.cpp.
References ArgsManagerHelper::AddArgs(), cs_args, IsArgNegated(), LOCK, m_config_args, m_network, m_override_args, ArgsManagerHelper::NetworkArg(), and ArgsManagerHelper::UseDefaultSection().
Referenced by AppInitMain(), AppInitParameterInteraction(), CallRPC(), HTTPBindAddresses(), InitHTTPAllowList(), IsDeprecatedRPCEnabled(), multiUserAuthorized(), WalletInit::Open(), WalletInit::ParameterInteraction(), CConnman::ThreadOpenMasternodeConnections(), and WalletInit::Verify().
◆ GetBoolArg()
bool ArgsManager::GetBoolArg | ( | const std::string & | strArg, |
bool | fDefault | ||
) | const |
Return boolean argument or default value.
- Parameters
-
strArg Argument to get (e.g. "-foo") fDefault (true or false)
- Returns
- command-line argument or default value
Definition at line 824 of file util.cpp.
References ArgsManagerHelper::GetArg(), InterpretBool(), and IsArgNegated().
Referenced by BlockAssembler::AddToBlock(), AdvertiseLocal(), AppInit(), AppInitBasicSetup(), AppInitMain(), AppInitParameterInteraction(), AppInitRawTx(), AppInitRPC(), AppInitServers(), CDBWrapper::CDBWrapper(), CWallet::ChangeWalletPassphrase(), CommandLineRPC(), CWallet::CreateTransaction(), CWallet::CreateWalletFromFile(), CWallet::EncryptWallet(), llmq::CQuorumManager::EnsureQuorumConnections(), GUIUtil::getFont(), PaymentRequestPlus::getMerchant(), GetWarnings(), llmq::CDKGSessionHandler::HandleDKGRound(), HelpMessage(), HelpMessageDialog::HelpMessageDialog(), CKeePassIntegrator::init(), CWallet::InitAutoBackup(), InitHTTPServer(), BitcoinApplication::initializeResult(), InitLogging(), InitParameterInteraction(), WalletInit::InitPrivateSendSettings(), WalletModel::isWalletEnabled(), LoadBlockIndex(), GUIUtil::loadStyleSheet(), main(), MaybeCompactWalletDB(), ObserveSafeMode(), WalletInit::Open(), BerkeleyEnvironment::Open(), OutputTx(), WalletInit::ParameterInteraction(), Intro::pickDataDirectory(), DefaultRequestHandler::PrepareRequest(), ProcessMessage(), CMasternodeSync::ProcessTick(), WalletInit::RegisterRPC(), CWallet::SelectCoins(), OverviewPage::setBalance(), OverviewPage::setWalletModel(), CConnman::Start(), CConnman::ThreadDNSAddressSeed(), ThreadImport(), CWallet::Unlock(), and WalletInit::Verify().
◆ GetChainName()
std::string ArgsManager::GetChainName | ( | ) | const |
Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
- Returns
- CBaseChainParams::MAIN by default; raises runtime error if an invalid combination is given.
Definition at line 1026 of file util.cpp.
References CBaseChainParams::DEVNET, ArgsManagerHelper::GetNetBoolArg(), CBaseChainParams::MAIN, CBaseChainParams::REGTEST, and CBaseChainParams::TESTNET.
Referenced by AppInit(), AppInitRawTx(), AppInitRPC(), and main().
◆ GetDevNetName()
std::string ArgsManager::GetDevNetName | ( | ) | const |
Looks for -devnet and returns either "devnet-<name>" or simply "devnet" if no name was specified.
This function should never be called for non-devnets.
- Returns
- either "devnet-<name>" or "devnet"; raises runtime error if no -devent was specified.
Definition at line 1045 of file util.cpp.
References GetArg(), and IsArgSet().
Referenced by AppInitMain(), CreateBaseChainParams(), FindDevNetGenesisBlock(), NetworkStyle::instantiate(), and ProcessMessage().
◆ IsArgNegated()
bool ArgsManager::IsArgNegated | ( | const std::string & | strArg | ) | const |
Return true if the argument was originally passed as a negated option, i.e.
-nofoo.
- Parameters
-
strArg Argument to get (e.g. "-foo")
- Returns
- true if the argument was passed negated
Definition at line 790 of file util.cpp.
References cs_args, LOCK, m_config_args, m_network, m_override_args, and ArgsManagerHelper::NetworkArg().
Referenced by GetArg(), GetArgs(), GetBoolArg(), and IsArgSet().
◆ IsArgSet()
bool ArgsManager::IsArgSet | ( | const std::string & | strArg | ) | const |
Return true if the given argument has been manually set.
- Parameters
-
strArg Argument to get (e.g. "-foo")
- Returns
- true if the argument has been set
Definition at line 784 of file util.cpp.
References ArgsManagerHelper::GetArg(), and IsArgNegated().
Referenced by AppInit(), AppInitMain(), AppInitParameterInteraction(), AppInitRawTx(), AppInitRPC(), CZMQNotificationInterface::Create(), CWallet::CreateWalletFromFile(), DefaultOptions(), CWallet::GenerateNewHDChain(), GetBackupsDir(), GetDataDir(), GetDevNetName(), GetWalletDir(), HTTPBindAddresses(), InitParameterInteraction(), GUIUtil::loadFonts(), main(), WalletInit::ParameterInteraction(), CMNAuth::ProcessMessage(), ProcessMessage(), CMNAuth::PushMNAUTH(), SoftSetArg(), CConnman::ThreadOpenMasternodeConnections(), and WalletInit::Verify().
◆ ParseParameters()
void ArgsManager::ParseParameters | ( | int | argc, |
const char *const | argv[] | ||
) |
Definition at line 730 of file util.cpp.
References cs_args, InterpretNegatedOption(), LOCK, and m_override_args.
Referenced by AppInit(), AppInitRawTx(), AppInitRPC(), and main().
◆ ReadConfigFile()
void ArgsManager::ReadConfigFile | ( | const std::string & | confPath | ) |
Definition at line 1000 of file util.cpp.
References ClearDatadirCache(), cs_args, fsbridge::fopen(), gArgs, GetArg(), GetConfigFile(), GetDataDir(), LOCK, m_config_args, ReadConfigStream(), and strprintf.
Referenced by AppInit(), AppInitRPC(), and main().
◆ ReadConfigStream()
|
protected |
Definition at line 981 of file util.cpp.
References cs_args, InterpretNegatedOption(), LOCK, and m_config_args.
Referenced by ReadConfigFile().
◆ SelectConfigNetwork()
void ArgsManager::SelectConfigNetwork | ( | const std::string & | network | ) |
Select the network in use.
Definition at line 725 of file util.cpp.
References m_network.
Referenced by SelectBaseParams().
◆ SoftSetArg()
bool ArgsManager::SoftSetArg | ( | const std::string & | strArg, |
const std::string & | strValue | ||
) |
Set an argument if it doesn't already have a value.
- Parameters
-
strArg Argument to set (e.g. "-foo") strValue Value (e.g. "1")
- Returns
- true if argument gets set, false if it already had a value
Definition at line 832 of file util.cpp.
References cs_args, ForceSetArg(), IsArgSet(), and LOCK.
Referenced by OptionsModel::Init(), WalletInit::ParameterInteraction(), Intro::pickDataDirectory(), and SoftSetBoolArg().
◆ SoftSetBoolArg()
bool ArgsManager::SoftSetBoolArg | ( | const std::string & | strArg, |
bool | fValue | ||
) |
Set a boolean argument if it doesn't already have a value.
- Parameters
-
strArg Argument to set (e.g. "-foo") fValue Value (e.g. false)
- Returns
- true if argument gets set, false if it already had a value
Definition at line 840 of file util.cpp.
References SoftSetArg().
Referenced by AppInit(), OptionsModel::Init(), InitParameterInteraction(), WalletBatch::LoadWallet(), and WalletInit::ParameterInteraction().
◆ WarnForSectionOnlyArgs()
void ArgsManager::WarnForSectionOnlyArgs | ( | ) |
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 network-specific section in the config file.
Definition at line 697 of file util.cpp.
References ArgsManagerHelper::GetArgHelper(), LogPrintf, m_config_args, m_network, m_network_only_args, m_override_args, CBaseChainParams::MAIN, and ArgsManagerHelper::NetworkArg().
Referenced by InitParameterInteraction().
Friends And Related Function Documentation
◆ ArgsManagerHelper
|
friend |
Member Data Documentation
◆ cs_args
|
mutableprotected |
Definition at line 283 of file util.h.
Referenced by ForceRemoveArg(), ForceSetArg(), ArgsManagerHelper::GetArg(), GetArgs(), IsArgNegated(), ParseParameters(), ReadConfigFile(), ReadConfigStream(), and SoftSetArg().
◆ m_config_args
|
protected |
Definition at line 285 of file util.h.
Referenced by ForceRemoveArg(), ArgsManagerHelper::GetArg(), GetArgs(), ArgsManagerHelper::GetNetBoolArg(), IsArgNegated(), ReadConfigFile(), ReadConfigStream(), and WarnForSectionOnlyArgs().
◆ m_network
|
protected |
Definition at line 286 of file util.h.
Referenced by ForceRemoveArg(), ArgsManagerHelper::GetArg(), GetArgs(), IsArgNegated(), ArgsManagerHelper::NetworkArg(), SelectConfigNetwork(), ArgsManagerHelper::UseDefaultSection(), and WarnForSectionOnlyArgs().
◆ m_network_only_args
|
protected |
Definition at line 287 of file util.h.
Referenced by ArgsManagerHelper::UseDefaultSection(), and WarnForSectionOnlyArgs().
◆ m_override_args
|
protected |
Definition at line 284 of file util.h.
Referenced by ForceRemoveArg(), ForceSetArg(), ArgsManagerHelper::GetArg(), GetArgs(), ArgsManagerHelper::GetNetBoolArg(), IsArgNegated(), ParseParameters(), and WarnForSectionOnlyArgs().
The documentation for this class was generated from the following files: