![]() |
Bitcoin ABC 0.31.6
P2P Digital Currency
|
#include <common/args.h>
#include <chainparamsbase.h>
#include <logging.h>
#include <sync.h>
#include <tinyformat.h>
#include <univalue.h>
#include <util/chaintype.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/settings.h>
#include <util/strencodings.h>
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <map>
#include <optional>
#include <stdexcept>
#include <string>
#include <variant>
Go to the source code of this file.
Namespaces | |
namespace | common |
Functions | |
static bool | InterpretBool (const std::string &strValue) |
Interpret a string argument as a boolean. More... | |
static std::string | SettingName (const std::string &arg) |
KeyInfo | InterpretKey (std::string key) |
Parse "name", "section.name", "noname", "section.noname" settings keys. More... | |
std::optional< util::SettingsValue > | InterpretValue (const KeyInfo &key, const std::optional< std::string > &value, unsigned int flags, std::string &error) |
Interpret settings value based on registered flags. More... | |
bool | ParseKeyValue (std::string &key, std::optional< std::string > &val) |
static void | SaveErrors (const std::vector< std::string > errors, std::vector< std::string > *error_out) |
std::optional< std::string > | SettingToString (const util::SettingsValue &value) |
std::string | SettingToString (const util::SettingsValue &value, const std::string &strDefault) |
std::optional< int64_t > | SettingToInt (const util::SettingsValue &value) |
int64_t | SettingToInt (const util::SettingsValue &value, int64_t nDefault) |
std::optional< bool > | SettingToBool (const util::SettingsValue &value) |
bool | SettingToBool (const util::SettingsValue &value, bool fDefault) |
bool | HelpRequested (const ArgsManager &args) |
void | SetupHelpOptions (ArgsManager &args) |
Add help options to the args manager. More... | |
std::string | HelpMessageGroup (const std::string &message) |
Format a string to be used as group of options in help messages. More... | |
std::string | HelpMessageOpt (const std::string &option, const std::string &message) |
Format a string to be used as option description in help messages. More... | |
fs::path | GetDefaultDataDir () |
bool | CheckDataDirOption (const ArgsManager &args) |
Variables | |
const char *const | BITCOIN_CONF_FILENAME = "bitcoin.conf" |
const char *const | BITCOIN_SETTINGS_FILENAME = "settings.json" |
ArgsManager | gArgs |
static const int | screenWidth = 79 |
static const int | optIndent = 2 |
static const int | msgIndent = 7 |
bool CheckDataDirOption | ( | const ArgsManager & | args | ) |
fs::path GetDefaultDataDir | ( | ) |
std::string HelpMessageGroup | ( | const std::string & | message | ) |
std::string HelpMessageOpt | ( | const std::string & | option, |
const std::string & | message | ||
) |
Format a string to be used as option description in help messages.
option | Option message (e.g. "-rpcuser=<user>") |
message | Option description (e.g. "Username for JSON-RPC connections") |
Definition at line 720 of file args.cpp.
bool HelpRequested | ( | const ArgsManager & | args | ) |
|
static |
Interpret a string argument as a boolean.
The definition of atoi() requires that non-numeric string values like "foo", return 0. This means that if a user unintentionally supplies a non-integer argument here, the return value is always false. This means that -foo=false does what the user probably expects, but -foo=true is well defined but does not do what they probably expected.
The return value of atoi() is undefined when given input not representable as an int. On most systems this means string value between "-2147483648" and "2147483647" are well defined (this method will return true). Setting -txindex=2147483648 on most systems, however, is probably undefined.
For a more extensive discussion of this topic (and a wide range of opinions on the Right Way to change this code), see PR12713.
Definition at line 59 of file args.cpp.
KeyInfo InterpretKey | ( | std::string | key | ) |
Parse "name", "section.name", "noname", "section.noname" settings keys.
Definition at line 78 of file args.cpp.
std::optional< util::SettingsValue > InterpretValue | ( | const KeyInfo & | key, |
const std::optional< std::string > & | value, | ||
unsigned int | flags, | ||
std::string & | error | ||
) |
Interpret settings value based on registered flags.
[in] | key | key information to know if key was negated |
[in] | value | string value of setting to be parsed |
[in] | flags | ArgsManager registered argument flags |
[out] | error | Error description if settings value is not valid |
Definition at line 107 of file args.cpp.
bool ParseKeyValue | ( | std::string & | key, |
std::optional< std::string > & | val | ||
) |
|
static |
|
static |
std::optional< bool > SettingToBool | ( | const util::SettingsValue & | value | ) |
bool SettingToBool | ( | const util::SettingsValue & | value, |
bool | fDefault | ||
) |
std::optional< int64_t > SettingToInt | ( | const util::SettingsValue & | value | ) |
int64_t SettingToInt | ( | const util::SettingsValue & | value, |
int64_t | nDefault | ||
) |
std::optional< std::string > SettingToString | ( | const util::SettingsValue & | value | ) |
std::string SettingToString | ( | const util::SettingsValue & | value, |
const std::string & | strDefault | ||
) |
void SetupHelpOptions | ( | ArgsManager & | args | ) |
const char* const BITCOIN_SETTINGS_FILENAME = "settings.json" |
ArgsManager gArgs |