mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +01:00
libutil: Make AbstractConfig::getSettings const
This commit is contained in:
parent
920a878eaa
commit
a7fb257ec2
4 changed files with 5 additions and 5 deletions
|
|
@ -15,7 +15,7 @@ bool GlobalConfig::set(const std::string & name, const std::string & value)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalConfig::getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly)
|
void GlobalConfig::getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly) const
|
||||||
{
|
{
|
||||||
for (auto & config : configRegistrations())
|
for (auto & config : configRegistrations())
|
||||||
config->getSettings(res, overriddenOnly);
|
config->getSettings(res, overriddenOnly);
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void AbstractConfig::reapplyUnknownSettings()
|
||||||
set(s.first, s.second);
|
set(s.first, s.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly)
|
void Config::getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly) const
|
||||||
{
|
{
|
||||||
for (const auto & opt : _settings)
|
for (const auto & opt : _settings)
|
||||||
if (!opt.second.isAlias && (!overriddenOnly || opt.second.setting->overridden)
|
if (!opt.second.isAlias && (!overriddenOnly || opt.second.setting->overridden)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ struct GlobalConfig : public AbstractConfig
|
||||||
|
|
||||||
bool set(const std::string & name, const std::string & value) override;
|
bool set(const std::string & name, const std::string & value) override;
|
||||||
|
|
||||||
void getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly = false) override;
|
void getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly = false) const override;
|
||||||
|
|
||||||
void resetOverridden() override;
|
void resetOverridden() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public:
|
||||||
* - res: map to store settings in
|
* - res: map to store settings in
|
||||||
* - overriddenOnly: when set to true only overridden settings will be added to `res`
|
* - overriddenOnly: when set to true only overridden settings will be added to `res`
|
||||||
*/
|
*/
|
||||||
virtual void getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly = false) = 0;
|
virtual void getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly = false) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the configuration in `contents` and applies it
|
* Parses the configuration in `contents` and applies it
|
||||||
|
|
@ -160,7 +160,7 @@ public:
|
||||||
|
|
||||||
void addSetting(AbstractSetting * setting);
|
void addSetting(AbstractSetting * setting);
|
||||||
|
|
||||||
void getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly = false) override;
|
void getSettings(std::map<std::string, SettingInfo> & res, bool overriddenOnly = false) const override;
|
||||||
|
|
||||||
void resetOverridden() override;
|
void resetOverridden() override;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue