/* * Copyright (c) 2021, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Unicode { enum class HourCycle : u8 { H11, H12, H23, H24, }; enum class CalendarPatternStyle : u8 { Narrow, Short, Long, Numeric, TwoDigit, }; struct CalendarPattern { String pattern {}; Optional pattern12 {}; // https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Fields Optional era {}; Optional year {}; Optional month {}; Optional weekday {}; Optional day {}; Optional day_period {}; Optional hour {}; Optional minute {}; Optional second {}; Optional fractional_second_digits {}; Optional time_zone_name {}; }; enum class CalendarFormatType : u8 { Date, Time, DateTime, }; struct CalendarFormat { CalendarPattern full_format {}; CalendarPattern long_format {}; CalendarPattern medium_format {}; CalendarPattern short_format {}; }; HourCycle hour_cycle_from_string(StringView hour_cycle); StringView hour_cycle_to_string(HourCycle hour_cycle); CalendarPatternStyle calendar_pattern_style_from_string(StringView style); StringView calendar_pattern_style_to_string(CalendarPatternStyle style); Vector get_regional_hour_cycles(StringView locale); Optional get_default_regional_hour_cycle(StringView locale); Optional get_calendar_format(StringView locale, StringView calendar, CalendarFormatType type); Vector get_calendar_available_formats(StringView locale, StringView calendar); }