mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 22:22:07 +00:00
LibConfig+LibCore+ConfigServer: Support u32 configuration entries
This commit is contained in:
parent
49f697ed56
commit
69beda23c3
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