mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as to_number will handle something such as: ``` Optional<I> opt; if constexpr (IsSigned<I>) opt = view.to_int<I>(); else opt = view.to_uint<I>(); ``` For us. The main goal here however is to have a single generic number conversion API between all of the String classes.
This commit is contained in:
parent
a4ecc65398
commit
e2e7c4d574
155 changed files with 397 additions and 412 deletions
|
@ -441,7 +441,7 @@ static ErrorOr<void> parse_number_systems(ByteString locale_numbers_path, CLDR&
|
|||
auto patterns = value.as_string().split(';');
|
||||
NumberFormat format {};
|
||||
|
||||
if (auto type = split_key[0].template to_uint<u64>(); type.has_value()) {
|
||||
if (auto type = split_key[0].template to_number<u64>(); type.has_value()) {
|
||||
VERIFY(*type % 10 == 0);
|
||||
format.magnitude = static_cast<u8>(log10(*type));
|
||||
|
||||
|
@ -580,7 +580,7 @@ static ErrorOr<void> parse_number_systems(ByteString locale_numbers_path, CLDR&
|
|||
locale.number_systems.append(system_index);
|
||||
}
|
||||
|
||||
locale.minimum_grouping_digits = minimum_grouping_digits.template to_uint<u8>().value();
|
||||
locale.minimum_grouping_digits = minimum_grouping_digits.template to_number<u8>().value();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue