Bitcoin Core
27.99.0
P2P Digital Currency
|
#include <common/args.h>
#include <chainparamsbase.h>
#include <common/settings.h>
#include <logging.h>
#include <sync.h>
#include <tinyformat.h>
#include <univalue.h>
#include <util/chaintype.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/strencodings.h>
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <map>
#include <optional>
#include <stdexcept>
#include <string>
#include <utility>
#include <variant>
Go to the source code of this file.
Namespaces | |
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< common::SettingsValue > | InterpretValue (const KeyInfo &key, const std::string *value, unsigned int flags, std::string &error) |
Interpret settings value based on registered flags. More... | |
static void | SaveErrors (const std::vector< std::string > errors, std::vector< std::string > *error_out) |
std::optional< std::string > | SettingToString (const common::SettingsValue &value) |
std::string | SettingToString (const common::SettingsValue &value, const std::string &strDefault) |
std::optional< int64_t > | SettingToInt (const common::SettingsValue &value) |
int64_t | SettingToInt (const common::SettingsValue &value, int64_t nDefault) |
std::optional< bool > | SettingToBool (const common::SettingsValue &value) |
bool | SettingToBool (const common::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... | |
bool | HasTestOption (const ArgsManager &args, const std::string &test_option) |
Checks if a particular test option is present in -test command-line arg options. 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 |
const std::vector< std::string > | TEST_OPTIONS_DOC |
bool CheckDataDirOption | ( | const ArgsManager & | args | ) |
fs::path GetDefaultDataDir | ( | ) |
bool HasTestOption | ( | const ArgsManager & | args, |
const std::string & | test_option | ||
) |
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 678 of file args.cpp.
bool HelpRequested | ( | const ArgsManager & | args | ) |
|
static |
Interpret a string argument as a boolean.
The definition of LocaleIndependentAtoi<int>() 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 LocaleIndependentAtoi<int>(...) is zero when given input not representable as an int.
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 58 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<common::SettingsValue> InterpretValue | ( | const KeyInfo & | key, |
const 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 106 of file args.cpp.
|
static |
|
static |
std::optional<bool> SettingToBool | ( | const common::SettingsValue & | value | ) |
bool SettingToBool | ( | const common::SettingsValue & | value, |
bool | fDefault | ||
) |
std::optional<int64_t> SettingToInt | ( | const common::SettingsValue & | value | ) |
int64_t SettingToInt | ( | const common::SettingsValue & | value, |
int64_t | nDefault | ||
) |
std::optional<std::string> SettingToString | ( | const common::SettingsValue & | value | ) |
std::string SettingToString | ( | const common::SettingsValue & | value, |
const std::string & | strDefault | ||
) |
void SetupHelpOptions | ( | ArgsManager & | args | ) |
const char* const BITCOIN_SETTINGS_FILENAME = "settings.json" |
ArgsManager gArgs |