MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / MergeSettings

Function MergeSettings

src/common/settings.cpp:41–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39//! specific logic for how to merge the sources.
40template <typename Fn>
41static void MergeSettings(const Settings& settings, const std::string& section, const std::string& name, Fn&& fn)
42{
43 // Merge in the forced settings
44 if (auto* value = FindKey(settings.forced_settings, name)) {
45 fn(SettingsSpan(*value), Source::FORCED);
46 }
47 // Merge in the command-line options
48 if (auto* values = FindKey(settings.command_line_options, name)) {
49 fn(SettingsSpan(*values), Source::COMMAND_LINE);
50 }
51 // Merge in the read-write settings
52 if (const SettingsValue* value = FindKey(settings.rw_settings, name)) {
53 fn(SettingsSpan(*value), Source::RW_SETTINGS);
54 }
55 // Merge in the network-specific section of the config file
56 if (!section.empty()) {
57 if (auto* map = FindKey(settings.ro_config, section)) {
58 if (auto* values = FindKey(*map, name)) {
59 fn(SettingsSpan(*values), Source::CONFIG_FILE_NETWORK_SECTION);
60 }
61 }
62 }
63 // Merge in the default section of the config file
64 if (auto* map = FindKey(settings.ro_config, "")) {
65 if (auto* values = FindKey(*map, name)) {
66 fn(SettingsSpan(*values), Source::CONFIG_FILE_DEFAULT_SECTION);
67 }
68 }
69}
70} // namespace
71
72bool ReadSettings(const fs::path& path, std::map<std::string, SettingsValue>& values, std::vector<std::string>& errors)

Callers 3

GetSettingFunction · 0.85
GetSettingsListFunction · 0.85

Calls 4

FindKeyFunction · 0.85
fnFunction · 0.85
SettingsSpanClass · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected