| 222 | } |
| 223 | |
| 224 | bool OnlyHasDefaultSectionSetting(const Settings& settings, const std::string& section, const std::string& name) |
| 225 | { |
| 226 | bool has_default_section_setting = false; |
| 227 | bool has_other_setting = false; |
| 228 | MergeSettings(settings, section, name, [&](SettingsSpan span, Source source) { |
| 229 | if (span.empty()) return; |
| 230 | else if (source == Source::CONFIG_FILE_DEFAULT_SECTION) has_default_section_setting = true; |
| 231 | else has_other_setting = true; |
| 232 | }); |
| 233 | // If a value is set in the default section and not explicitly overwritten by the |
| 234 | // user on the command line or in a different section, then we want to enable |
| 235 | // warnings about the value being ignored. |
| 236 | return has_default_section_setting && !has_other_setting; |
| 237 | } |
| 238 | |
| 239 | SettingsSpan::SettingsSpan(const std::vector<SettingsValue>& vec) noexcept : SettingsSpan(vec.data(), vec.size()) {} |
| 240 | const SettingsValue* SettingsSpan::begin() const { return data + negated(); } |