mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 23:30:20 +00:00
LibConfig+LibCore+ConfigServer: Support u32 configuration entries
This commit is contained in:
parent
49f697ed56
commit
69beda23c3
Notes:
sideshowbarker
2024-07-17 08:34:29 +09:00
Author: https://github.com/trflynn89
Commit: 69beda23c3
Pull-request: https://github.com/SerenityOS/serenity/pull/16601
10 changed files with 88 additions and 16 deletions
|
@ -150,15 +150,6 @@ DeprecatedString ConfigFile::read_entry(DeprecatedString const& group, Deprecate
|
|||
return jt->value;
|
||||
}
|
||||
|
||||
int ConfigFile::read_num_entry(DeprecatedString const& group, DeprecatedString const& key, int default_value) const
|
||||
{
|
||||
if (!has_key(group, key)) {
|
||||
return default_value;
|
||||
}
|
||||
|
||||
return read_entry(group, key).to_int().value_or(default_value);
|
||||
}
|
||||
|
||||
bool ConfigFile::read_bool_entry(DeprecatedString const& group, DeprecatedString const& key, bool default_value) const
|
||||
{
|
||||
auto value = read_entry(group, key, default_value ? "true" : "false");
|
||||
|
@ -171,11 +162,6 @@ void ConfigFile::write_entry(DeprecatedString const& group, DeprecatedString con
|
|||
m_dirty = true;
|
||||
}
|
||||
|
||||
void ConfigFile::write_num_entry(DeprecatedString const& group, DeprecatedString const& key, int value)
|
||||
{
|
||||
write_entry(group, key, DeprecatedString::number(value));
|
||||
}
|
||||
|
||||
void ConfigFile::write_bool_entry(DeprecatedString const& group, DeprecatedString const& key, bool value)
|
||||
{
|
||||
write_entry(group, key, value ? "true" : "false");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue