1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-29 23:42:07 +00:00

LibUnicode: Parse and generate calendar (ca) Unicode keywords

Also removes a few fly-by "StringView x = nullptr;" unnecessary
initializers.
This commit is contained in:
Timothy Flynn 2021-11-28 10:39:55 -05:00 committed by Linus Groh
parent 48ce72e472
commit 71903ea7e1
4 changed files with 78 additions and 13 deletions

View file

@ -372,7 +372,9 @@ static constexpr Array<CalendarData, @size@> @name@ { {)~~~");
)~~~");
};
auto append_hour_cycles = [&](String name, auto const& hour_cycles) {
auto append_hour_cycles = [&](String name, auto const& hour_cycle_region) {
auto const& hour_cycles = locale_data.hour_cycles.find(hour_cycle_region)->value;
generator.set("name", name);
generator.set("size", String::number(hour_cycles.size()));
@ -388,7 +390,7 @@ static constexpr Array<u8, @size@> @name@ { { )~~~");
};
generate_mapping(generator, locale_data.locales, "CalendarData"sv, "s_calendars"sv, "s_calendars_{}", [&](auto const& name, auto const& value) { append_calendars(name, value.calendars); });
generate_mapping(generator, locale_data.hour_cycles, "u8"sv, "s_hour_cycles"sv, "s_hour_cycles_{}", [&](auto const& name, auto const& value) { append_hour_cycles(name, value); });
generate_mapping(generator, locale_data.hour_cycle_regions, "u8"sv, "s_hour_cycles"sv, "s_hour_cycles_{}", [&](auto const& name, auto const& value) { append_hour_cycles(name, value); });
auto append_from_string = [&](StringView enum_title, StringView enum_snake, auto const& values, Vector<Alias> const& aliases = {}) {
HashValueMap<String> hashes;