Bitcoin Core 31.99.0
P2P Digital Currency
Public Member Functions | List of all members
TestArgsManager Struct Reference
Inheritance diagram for TestArgsManager:
[legend]
Collaboration diagram for TestArgsManager:
[legend]

Public Member Functions

void ReadConfigString (const std::string &str_config)
 
void SetupArgs (const std::vector< std::pair< std::string, unsigned int > > &args)
 
bool ReadConfigStream (std::istream &stream, const std::string &filepath, std::string &error, bool ignore_invalid_keys=false) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
- Public Member Functions inherited from ArgsManager
common::SettingsValue GetSetting (const std::string &arg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get setting value. More...
 
std::vector< common::SettingsValueGetSettingsList (const std::string &arg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get list of setting values. More...
 
 ArgsManager ()
 
 ~ArgsManager ()
 
void SelectConfigNetwork (const std::string &network) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Select the network in use. More...
 
bool ParseParameters (int argc, const char *const argv[], std::string &error) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
fs::path GetConfigFilePath () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return config file path (read-only) More...
 
void SetConfigFilePath (fs::path) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
bool ReadConfigFiles (std::string &error, bool ignore_invalid_keys=false) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
std::set< std::string > GetUnsuitableSectionOnlyArgs () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 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::list< SectionInfoGetUnrecognizedSections () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Log warnings for unrecognized section names in the config file. More...
 
std::optional< const CommandGetCommand () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get the command and command args (returns std::nullopt if no command provided) More...
 
fs::path GetBlocksDirPath () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get blocks directory path. More...
 
fs::path GetDataDirBase () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get data directory path. More...
 
fs::path GetDataDirNet () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get data directory path with appended network identifier. More...
 
void ClearPathCache () EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Clear cached directory paths. More...
 
std::vector< std::string > GetArgs (const std::string &strArg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return a vector of strings of the given argument. More...
 
bool IsArgSet (const std::string &strArg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return true if the given argument has been manually set. More...
 
bool IsArgNegated (const std::string &strArg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 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 EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return string argument or default value. More...
 
std::optional< std::string > GetArg (const std::string &strArg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
fs::path GetPathArg (std::string arg, const fs::path &default_value={}) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return path argument or default value. More...
 
template<std::integral Int>
Int GetArg (const std::string &strArg, Int nDefault) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return integer argument or default value. More...
 
template<std::integral Int>
std::optional< Int > GetArg (const std::string &strArg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
int64_t GetIntArg (const std::string &strArg, int64_t nDefault) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
std::optional< int64_t > GetIntArg (const std::string &strArg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
bool GetBoolArg (const std::string &strArg, bool fDefault) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return boolean argument or default value. More...
 
std::optional< bool > GetBoolArg (const std::string &strArg) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
bool SoftSetArg (const std::string &strArg, const std::string &strValue) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Set an argument if it doesn't already have a value. More...
 
bool SoftSetBoolArg (const std::string &strArg, bool fValue) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Set a boolean argument if it doesn't already have a value. More...
 
void ForceSetArg (const std::string &strArg, const std::string &strValue) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
ChainType GetChainType () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Returns the appropriate chain type from the program arguments. More...
 
std::string GetChainTypeString () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Returns the appropriate chain type string from the program arguments. More...
 
void AddArg (const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Add argument. More...
 
void AddCommand (const std::string &cmd, const std::string &help) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Add subcommand. More...
 
void AddHiddenArgs (const std::vector< std::string > &args) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Add many hidden arguments. More...
 
void ClearArgs () EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Clear available arguments. More...
 
void CheckMultipleCLIArgs () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Check CLI command args. More...
 
std::string GetHelpMessage () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get the help string. More...
 
std::optional< unsigned int > GetArgFlags (const std::string &name) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Return Flags for known arg. More...
 
void SetDefaultFlags (std::optional< unsigned int >) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Set default flags to return for an unknown arg. More...
 
bool GetSettingsPath (fs::path *filepath=nullptr, bool temp=false, bool backup=false) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get settings file path, or return false if read-write settings were disabled with -nosettings. More...
 
bool ReadSettingsFile (std::vector< std::string > *errors=nullptr) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Read settings file. More...
 
bool WriteSettingsFile (std::vector< std::string > *errors=nullptr, bool backup=false) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Write settings file or backup settings file. More...
 
common::SettingsValue GetPersistentSetting (const std::string &name) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Get current setting from config file or read/write settings file, ignoring nonpersistent command line or forced settings values. More...
 
template<typename Fn >
void LockSettings (Fn &&fn) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Access settings with lock held. More...
 
void LogArgs () const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 Log the config file options and the command line arguments, useful for troubleshooting. More...
 

Additional Inherited Members

- Public Types inherited from ArgsManager
enum  Flags : uint32_t {
  ALLOW_ANY = 0x01 , DISALLOW_NEGATION = 0x20 , DISALLOW_ELISION = 0x40 , DEBUG_ONLY = 0x100 ,
  NETWORK_ONLY = 0x200 , SENSITIVE = 0x400 , COMMAND = 0x800
}
 Flags controlling how config and command line arguments are validated and interpreted. More...
 
- Protected Member Functions inherited from ArgsManager
bool ReadConfigStream (std::istream &stream, const std::string &filepath, std::string &error, bool ignore_invalid_keys=false) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 
bool ReadConfigString (const std::string &str_config) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
 

Detailed Description

Definition at line 52 of file argsman_tests.cpp.

Member Function Documentation

◆ ReadConfigStream()

bool ArgsManager::ReadConfigStream ( std::istream &  stream,
const std::string &  filepath,
std::string &  error,
bool  ignore_invalid_keys = false 
)

Definition at line 160 of file config.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadConfigString()

void TestArgsManager::ReadConfigString ( const std::string &  str_config)
inline

Definition at line 54 of file argsman_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetupArgs()

void TestArgsManager::SetupArgs ( const std::vector< std::pair< std::string, unsigned int > > &  args)
inline

Definition at line 58 of file argsman_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this struct was generated from the following file: