Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
TestArgsManager Struct Reference
Inheritance diagram for TestArgsManager:
[legend]
Collaboration diagram for TestArgsManager:
[legend]

Public Member Functions

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

Public Attributes

RecursiveMutex cs_args

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
common::Settings m_settings GUARDED_BY (cs_args)
std::vector< std::string > m_command GUARDED_BY (cs_args)
std::string m_network GUARDED_BY (cs_args)
std::set< std::string > m_network_only_args GUARDED_BY (cs_args)
std::map< OptionsCategory, std::map< std::string, Arg > > m_available_args GUARDED_BY (cs_args)
std::optional< unsigned int > m_default_flags GUARDED_BY (cs_args)
bool m_accept_any_command GUARDED_BY (cs_args)
std::list< SectionInfo > m_config_sections GUARDED_BY (cs_args)
std::optional< fs::path > m_config_path GUARDED_BY (cs_args)
fs::path m_cached_blocks_path GUARDED_BY (cs_args)
fs::path m_cached_datadir_path GUARDED_BY (cs_args)
fs::path m_cached_network_datadir_path GUARDED_BY (cs_args)
bool ReadConfigStream (std::istream &stream, const std::string &filepath, std::string &error, bool ignore_invalid_keys=false)
bool UseDefaultSection (const std::string &arg) const EXCLUSIVE_LOCKS_REQUIRED(cs_args)
 Returns true if settings values from the default section should be used, depending on the current network and whether the setting is network-specific.
Protected Attributes inherited from ArgsManager
RecursiveMutex cs_args

Detailed Description

Definition at line 52 of file argsman_tests.cpp.

Constructor & Destructor Documentation

◆ TestArgsManager()

TestArgsManager::TestArgsManager ( )
inline

Definition at line 54 of file argsman_tests.cpp.

Member Function Documentation

◆ GetSetting()

common::SettingsValue ArgsManager::GetSetting ( const std::string & arg) const

Get setting value.

Result will be null if setting was unset, true if "-setting" argument was passed false if "-nosetting" argument was passed, and a string if a "-setting=value" argument was passed.

Definition at line 169 of file args.cpp.

Here is the caller graph for this function:

◆ GetSettingsList()

std::vector< common::SettingsValue > ArgsManager::GetSettingsList ( const std::string & arg) const

Get list of setting values.

Definition at line 174 of file args.cpp.

Here is the caller graph for this function:

◆ ReadConfigStream()

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

Definition at line 152 of file config.cpp.

Here is the caller graph for this function:

◆ ReadConfigString()

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

Definition at line 55 of file argsman_tests.cpp.

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

◆ SetNetworkOnlyArg()

void TestArgsManager::SetNetworkOnlyArg ( const std::string & arg)
inline

Definition at line 66 of file argsman_tests.cpp.

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 71 of file argsman_tests.cpp.

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

Member Data Documentation

◆ cs_args

Definition at line 138 of file args.h.


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