MCPcopy Create free account
hub / github.com/ElementsProject/elements / MergeSettings

Function MergeSettings

src/util/settings.cpp:33–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31//! specific logic for how to merge the sources.
32template <typename Fn>
33static void MergeSettings(const Settings& settings, const std::string& section, const std::string& name, Fn&& fn)
34{
35 // Merge in the forced settings
36 if (auto* value = FindKey(settings.forced_settings, name)) {
37 fn(SettingsSpan(*value), Source::FORCED);
38 }
39 // Merge in the command-line options
40 if (auto* values = FindKey(settings.command_line_options, name)) {
41 fn(SettingsSpan(*values), Source::COMMAND_LINE);
42 }
43 // Merge in the read-write settings
44 if (const SettingsValue* value = FindKey(settings.rw_settings, name)) {
45 fn(SettingsSpan(*value), Source::RW_SETTINGS);
46 }
47 // Merge in the network-specific section of the config file
48 if (!section.empty()) {
49 if (auto* map = FindKey(settings.ro_config, section)) {
50 if (auto* values = FindKey(*map, name)) {
51 fn(SettingsSpan(*values), Source::CONFIG_FILE_NETWORK_SECTION);
52 }
53 }
54 }
55 // Merge in the default section of the config file
56 if (auto* map = FindKey(settings.ro_config, "")) {
57 if (auto* values = FindKey(*map, name)) {
58 fn(SettingsSpan(*values), Source::CONFIG_FILE_DEFAULT_SECTION);
59 }
60 }
61}
62} // namespace
63
64bool 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