 |
Bitcoin Core
22.99.0
P2P Digital Currency
|
Go to the documentation of this file.
5 #ifndef BITCOIN_UTIL_SETTINGS_H
6 #define BITCOIN_UTIL_SETTINGS_H
39 std::map<std::string, std::map<std::string, std::vector<SettingsValue>>>
ro_config;
44 std::map<std::string, SettingsValue>&
values,
45 std::vector<std::string>& errors);
49 const std::map<std::string, SettingsValue>&
values,
50 std::vector<std::string>& errors);
61 const std::string& section,
62 const std::string&
name,
63 bool ignore_default_section_config,
69 const std::string& section,
70 const std::string&
name,
71 bool ignore_default_section_config);
87 explicit SettingsSpan(
const std::vector<SettingsValue>& vec) noexcept;
99 template <
typename Map,
typename Key>
100 auto FindKey(Map&& map, Key&& key) -> decltype(&map.at(key))
102 auto it = map.find(key);
103 return it == map.end() ? nullptr : &it->second;
108 #endif // BITCOIN_UTIL_SETTINGS_H
bool WriteSettings(const fs::path &path, const std::map< std::string, SettingsValue > &values, std::vector< std::string > &errors)
Write settings file.
const SettingsValue * data
size_t negated() const
Number of negated values.
bool last_negated() const
True if the last value is negated.
std::map< std::string, SettingsValue > forced_settings
Map of setting name to forced setting value.
const SettingsValue * end() const
Pointer to end of values.
std::map< std::string, std::map< std::string, std::vector< SettingsValue > > > ro_config
Map of config section name and setting name to list of config file values.
bool ReadSettings(const fs::path &path, std::map< std::string, SettingsValue > &values, std::vector< std::string > &errors)
Read settings file.
static const int64_t values[]
A selection of numbers that do not trigger int64_t overflow when added/subtracted.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
bool empty() const
True if there are any non-negated values.
SettingsSpan(const SettingsValue &value) noexcept
auto FindKey(Map &&map, Key &&key) -> decltype(&map.at(key))
Map lookup helper.
const SettingsValue * begin() const
Pointer to first non-negated value.
bool OnlyHasDefaultSectionSetting(const Settings &settings, const std::string §ion, const std::string &name)
Return true if a setting is set in the default config file section, and not overridden by a higher pr...
SettingsValue GetSetting(const Settings &settings, const std::string §ion, const std::string &name, bool ignore_default_section_config, bool get_chain_name)
Get settings value from combined sources: forced settings, command line arguments,...
SettingsSpan(const SettingsValue *data, size_t size) noexcept
std::map< std::string, SettingsValue > rw_settings
Map of setting name to read-write file setting value.
std::map< std::string, std::vector< SettingsValue > > command_line_options
Map of setting name to list of command line values.
std::vector< SettingsValue > GetSettingsList(const Settings &settings, const std::string §ion, const std::string &name, bool ignore_default_section_config)
Get combined setting value similar to GetSetting(), except if setting was specified multiple times,...
Accessor for list of settings that skips negated values when iterated over.