mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibUnicode: Generate a method to lookup available keyword values
This commit is contained in:
parent
c2e5b20eb6
commit
80568d5776
Notes:
sideshowbarker
2024-07-17 10:54:57 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/80568d5776 Pull-request: https://github.com/SerenityOS/serenity/pull/14585
3 changed files with 28 additions and 0 deletions
|
@ -1157,6 +1157,32 @@ struct TextLayout {
|
|||
generate_available_values(generator, "get_available_number_systems"sv, locale_data.keywords.find("nu"sv)->value);
|
||||
generate_available_values(generator, "get_available_currencies"sv, locale_data.currencies);
|
||||
|
||||
generator.append(R"~~~(
|
||||
Span<StringView const> get_available_keyword_values(StringView key)
|
||||
{
|
||||
auto key_value = key_from_string(key);
|
||||
if (!key_value.has_value())
|
||||
return {};
|
||||
|
||||
switch (*key_value) {
|
||||
case Key::Ca:
|
||||
return get_available_calendars();
|
||||
case Key::Co:
|
||||
return get_available_collation_types();
|
||||
case Key::Hc:
|
||||
return get_available_hour_cycles();
|
||||
case Key::Kf:
|
||||
return get_available_collation_case_orderings();
|
||||
case Key::Kn:
|
||||
return get_available_collation_numeric_orderings();
|
||||
case Key::Nu:
|
||||
return get_available_number_systems();
|
||||
}
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
)~~~");
|
||||
|
||||
locale_data.unique_display_patterns.generate(generator, "DisplayPatternImpl"sv, "s_display_patterns"sv, 30);
|
||||
locale_data.unique_language_lists.generate(generator, s_string_index_type, "s_language_lists"sv);
|
||||
locale_data.unique_territory_lists.generate(generator, s_string_index_type, "s_territory_lists"sv);
|
||||
|
|
|
@ -766,6 +766,7 @@ StringView style_to_string(Style style)
|
|||
}
|
||||
}
|
||||
|
||||
Span<StringView const> __attribute__((weak)) get_available_keyword_values(StringView) { return {}; }
|
||||
Span<StringView const> __attribute__((weak)) get_available_calendars() { return {}; }
|
||||
Span<StringView const> __attribute__((weak)) get_available_collation_case_orderings() { return {}; }
|
||||
Span<StringView const> __attribute__((weak)) get_available_collation_numeric_orderings() { return {}; }
|
||||
|
|
|
@ -145,6 +145,7 @@ Optional<String> canonicalize_unicode_locale_id(LocaleID&);
|
|||
String const& default_locale();
|
||||
bool is_locale_available(StringView locale);
|
||||
|
||||
Span<StringView const> get_available_keyword_values(StringView key);
|
||||
Span<StringView const> get_available_calendars();
|
||||
Span<StringView const> get_available_collation_case_orderings();
|
||||
Span<StringView const> get_available_collation_numeric_orderings();
|
||||
|
|
Loading…
Add table
Reference in a new issue