LibTimeZone: Use new generator util to generate all time zones

Added the call to generate_available_values(), then realized it is the
exact same as the existing, manually written implementation. So let's
use the new utility.
This commit is contained in:
Timothy Flynn 2022-01-30 17:35:24 -05:00 committed by Linus Groh
parent bb0f548614
commit 2e1db1b090
Notes: sideshowbarker 2024-07-17 19:57:46 +09:00

View file

@ -619,22 +619,11 @@ Optional<Array<NamedOffset, 2>> get_named_time_zone_offsets(TimeZone time_zone,
return named_offsets; return named_offsets;
} }
)~~~");
Span<StringView const> all_time_zones() generate_available_values(generator, "all_time_zones"sv, time_zone_data.time_zone_names);
{
static constexpr auto all_time_zones = Array {
)~~~");
for (auto const& time_zone : time_zone_data.time_zone_names) {
generator.set("time_zone", time_zone);
generator.append("\"@time_zone@\"sv, ");
}
generator.append(R"~~~( generator.append(R"~~~(
};
return all_time_zones;
}
} }
)~~~"); )~~~");