mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
LibUnicode: Generate era, month, weekday and day period calendar symbols
The parsing in parse_calendar_symbols() might be a bit more verbose than it really needs to be, but it is to ensure the symbols are generated in a known order that we can control with enumerations.
This commit is contained in:
parent
26f9666191
commit
2bbf8aa24c
3 changed files with 355 additions and 6 deletions
|
@ -140,4 +140,40 @@ Vector<CalendarPattern> get_calendar_available_formats([[maybe_unused]] StringVi
|
|||
#endif
|
||||
}
|
||||
|
||||
Optional<StringView> get_calendar_era_symbol([[maybe_unused]] StringView locale, [[maybe_unused]] StringView calendar, [[maybe_unused]] CalendarPatternStyle style, [[maybe_unused]] Unicode::Era value)
|
||||
{
|
||||
#if ENABLE_UNICODE_DATA
|
||||
return Detail::get_calendar_era_symbol(locale, calendar, style, value);
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
Optional<StringView> get_calendar_month_symbol([[maybe_unused]] StringView locale, [[maybe_unused]] StringView calendar, [[maybe_unused]] CalendarPatternStyle style, [[maybe_unused]] Unicode::Month value)
|
||||
{
|
||||
#if ENABLE_UNICODE_DATA
|
||||
return Detail::get_calendar_month_symbol(locale, calendar, style, value);
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
Optional<StringView> get_calendar_weekday_symbol([[maybe_unused]] StringView locale, [[maybe_unused]] StringView calendar, [[maybe_unused]] CalendarPatternStyle style, [[maybe_unused]] Unicode::Weekday value)
|
||||
{
|
||||
#if ENABLE_UNICODE_DATA
|
||||
return Detail::get_calendar_weekday_symbol(locale, calendar, style, value);
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
Optional<StringView> get_calendar_day_period_symbol([[maybe_unused]] StringView locale, [[maybe_unused]] StringView calendar, [[maybe_unused]] CalendarPatternStyle style, [[maybe_unused]] Unicode::DayPeriod value)
|
||||
{
|
||||
#if ENABLE_UNICODE_DATA
|
||||
return Detail::get_calendar_day_period_symbol(locale, calendar, style, value);
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,45 @@
|
|||
|
||||
namespace Unicode {
|
||||
|
||||
enum class Era : u8 {
|
||||
BC,
|
||||
AD,
|
||||
};
|
||||
|
||||
enum class Month : u8 {
|
||||
January,
|
||||
February,
|
||||
March,
|
||||
April,
|
||||
May,
|
||||
June,
|
||||
July,
|
||||
August,
|
||||
September,
|
||||
October,
|
||||
November,
|
||||
December,
|
||||
};
|
||||
|
||||
enum class Weekday : u8 {
|
||||
Sunday,
|
||||
Monday,
|
||||
Tuesday,
|
||||
Wednesday,
|
||||
Thursday,
|
||||
Friday,
|
||||
Saturday,
|
||||
};
|
||||
|
||||
enum class DayPeriod : u8 {
|
||||
AM,
|
||||
PM,
|
||||
Morning,
|
||||
Afternoon,
|
||||
Evening,
|
||||
Night,
|
||||
};
|
||||
|
||||
enum class HourCycle : u8 {
|
||||
H11,
|
||||
H12,
|
||||
|
@ -99,5 +138,9 @@ Vector<Unicode::HourCycle> get_regional_hour_cycles(StringView locale);
|
|||
Optional<Unicode::HourCycle> get_default_regional_hour_cycle(StringView locale);
|
||||
Optional<CalendarFormat> get_calendar_format(StringView locale, StringView calendar, CalendarFormatType type);
|
||||
Vector<CalendarPattern> get_calendar_available_formats(StringView locale, StringView calendar);
|
||||
Optional<StringView> get_calendar_era_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::Era value);
|
||||
Optional<StringView> get_calendar_month_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::Month value);
|
||||
Optional<StringView> get_calendar_weekday_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::Weekday value);
|
||||
Optional<StringView> get_calendar_day_period_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::DayPeriod value);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue