diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index 412aa393e1..a53a2a0aa3 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -112,7 +112,7 @@ void ConfigFile::reparse() } } -String ConfigFile::read_entry(const String& group, const String& key, const String& default_value) const +String ConfigFile::read_entry(String const& group, String const& key, String const& default_value) const { if (!has_key(group, key)) { return default_value; @@ -122,7 +122,7 @@ String ConfigFile::read_entry(const String& group, const String& key, const Stri return jt->value; } -int ConfigFile::read_num_entry(const String& group, const String& key, int default_value) const +int ConfigFile::read_num_entry(String const& group, String const& key, int default_value) const { if (!has_key(group, key)) { return default_value; @@ -131,7 +131,7 @@ int ConfigFile::read_num_entry(const String& group, const String& key, int defau return read_entry(group, key).to_int().value_or(default_value); } -bool ConfigFile::read_bool_entry(const String& group, const String& key, bool default_value) const +bool ConfigFile::read_bool_entry(String const& group, String const& key, bool default_value) const { auto value = read_entry(group, key, default_value ? "1" : "0"); if (value == "1" || value.to_lowercase() == "true") @@ -139,21 +139,21 @@ bool ConfigFile::read_bool_entry(const String& group, const String& key, bool de return 0; } -void ConfigFile::write_entry(const String& group, const String& key, const String& value) +void ConfigFile::write_entry(String const& group, String const& key, String const& value) { m_groups.ensure(group).ensure(key) = value; m_dirty = true; } -void ConfigFile::write_num_entry(const String& group, const String& key, int value) +void ConfigFile::write_num_entry(String const& group, String const& key, int value) { write_entry(group, key, String::number(value)); } -void ConfigFile::write_bool_entry(const String& group, const String& key, bool value) +void ConfigFile::write_bool_entry(String const& group, String const& key, bool value) { write_entry(group, key, value ? "1" : "0"); } -void ConfigFile::write_color_entry(const String& group, const String& key, Color value) +void ConfigFile::write_color_entry(String const& group, String const& key, Color value) { write_entry(group, key, String::formatted("{},{},{},{}", value.red(), value.green(), value.blue(), value.alpha())); } @@ -191,7 +191,7 @@ Vector ConfigFile::groups() const return m_groups.keys(); } -Vector ConfigFile::keys(const String& group) const +Vector ConfigFile::keys(String const& group) const { auto it = m_groups.find(group); if (it == m_groups.end()) @@ -199,7 +199,7 @@ Vector ConfigFile::keys(const String& group) const return it->value.keys(); } -bool ConfigFile::has_key(const String& group, const String& key) const +bool ConfigFile::has_key(String const& group, String const& key) const { auto it = m_groups.find(group); if (it == m_groups.end()) @@ -207,18 +207,18 @@ bool ConfigFile::has_key(const String& group, const String& key) const return it->value.contains(key); } -bool ConfigFile::has_group(const String& group) const +bool ConfigFile::has_group(String const& group) const { return m_groups.contains(group); } -void ConfigFile::remove_group(const String& group) +void ConfigFile::remove_group(String const& group) { m_groups.remove(group); m_dirty = true; } -void ConfigFile::remove_entry(const String& group, const String& key) +void ConfigFile::remove_entry(String const& group, String const& key) { auto it = m_groups.find(group); if (it == m_groups.end()) diff --git a/Userland/Libraries/LibCore/ConfigFile.h b/Userland/Libraries/LibCore/ConfigFile.h index bfce1c95ad..aa0528f2f2 100644 --- a/Userland/Libraries/LibCore/ConfigFile.h +++ b/Userland/Libraries/LibCore/ConfigFile.h @@ -31,22 +31,22 @@ public: static NonnullRefPtr open(String const& filename, int fd); ~ConfigFile(); - bool has_group(const String&) const; - bool has_key(const String& group, const String& key) const; + bool has_group(String const&) const; + bool has_key(String const& group, String const& key) const; Vector groups() const; - Vector keys(const String& group) const; + Vector keys(String const& group) const; size_t num_groups() const { return m_groups.size(); } - String read_entry(const String& group, const String& key, const String& default_value = String()) const; - int read_num_entry(const String& group, const String& key, int default_value = 0) const; - bool read_bool_entry(const String& group, const String& key, bool default_value = false) const; + String read_entry(String const& group, String const& key, String const& default_value = String()) const; + int read_num_entry(String const& group, String const& key, int default_value = 0) const; + bool read_bool_entry(String const& group, String const& key, bool default_value = false) const; - void write_entry(const String& group, const String& key, const String& value); - void write_num_entry(const String& group, const String& key, int value); - void write_bool_entry(const String& group, const String& key, bool value); - void write_color_entry(const String& group, const String& key, Color value); + void write_entry(String const& group, String const& key, String const& value); + void write_num_entry(String const& group, String const& key, int value); + void write_bool_entry(String const& group, String const& key, bool value); + void write_color_entry(String const& group, String const& key, Color value); void dump() const; @@ -54,8 +54,8 @@ public: bool sync(); - void remove_group(const String& group); - void remove_entry(const String& group, const String& key); + void remove_group(String const& group); + void remove_entry(String const& group, String const& key); String filename() const { return m_file->filename(); }