mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
LibUnicode: Generate a separate Locale enumeration for special casing
The UCD only cares about a few locales for special casing rules (az, lt, and tr). Unfortunately, LibUnicode cannot use LibLocale once the libraries are separate because LibLocale will need to use LibUnicode for many more things; thus there would be a circular dependency. Instead, just generate the small enum needed for this one use case.
This commit is contained in:
parent
b2d2bb43ce
commit
f082b6ae48
2 changed files with 30 additions and 12 deletions
|
@ -10,7 +10,6 @@
|
|||
#include <AK/Types.h>
|
||||
#include <AK/Utf16View.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibLocale/Locale.h>
|
||||
#include <LibUnicode/CharacterTypes.h>
|
||||
|
||||
#if ENABLE_UNICODE_DATA
|
||||
|
@ -163,17 +162,17 @@ static bool is_followed_by_combining_dot_above(Utf8View const& string, size_t in
|
|||
|
||||
static SpecialCasing const* find_matching_special_case(u32 code_point, Utf8View const& string, Optional<StringView> locale, size_t index, size_t byte_length)
|
||||
{
|
||||
auto requested_locale = Locale::Locale::None;
|
||||
auto requested_locale = Locale::None;
|
||||
|
||||
if (locale.has_value()) {
|
||||
if (auto maybe_locale = Locale::locale_from_string(*locale); maybe_locale.has_value())
|
||||
if (auto maybe_locale = locale_from_string(*locale); maybe_locale.has_value())
|
||||
requested_locale = *maybe_locale;
|
||||
}
|
||||
|
||||
auto special_casings = special_case_mapping(code_point);
|
||||
|
||||
for (auto const* special_casing : special_casings) {
|
||||
if (special_casing->locale != Locale::Locale::None && special_casing->locale != requested_locale)
|
||||
if (special_casing->locale != Locale::None && special_casing->locale != requested_locale)
|
||||
continue;
|
||||
|
||||
switch (special_casing->condition) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue