mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
@@ -129,11 +129,7 @@ int ConfigFile::read_num_entry(const String& group, const String& key, int defau
|
||||
return default_value;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
int value = read_entry(group, key).to_int(ok);
|
||||
if (!ok)
|
||||
return default_value;
|
||||
return value;
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user