mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
LibTimeZone: Add method to convert a time zone to a string
This commit is contained in:
committed by
Linus Groh
parent
14535fb67a
commit
1c2c98ac5d
Notes:
sideshowbarker
2024-07-17 21:13:24 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/1c2c98ac5d0 Pull-request: https://github.com/SerenityOS/serenity/pull/11799 Reviewed-by: https://github.com/linusg ✅
@@ -231,7 +231,7 @@ static void generate_time_zone_data_implementation(Core::File& file, TimeZoneDat
|
||||
namespace TimeZone {
|
||||
)~~~");
|
||||
|
||||
auto append_from_string = [&](StringView enum_title, StringView enum_snake, auto const& values, auto const& aliases) {
|
||||
auto append_string_conversions = [&](StringView enum_title, StringView enum_snake, auto const& values, auto const& aliases) {
|
||||
HashValueMap<String> hashes;
|
||||
hashes.ensure_capacity(values.size());
|
||||
|
||||
@@ -248,9 +248,10 @@ namespace TimeZone {
|
||||
options.sensitivity = CaseSensitivity::CaseInsensitive;
|
||||
|
||||
generate_value_from_string(generator, "{}_from_string"sv, enum_title, enum_snake, move(hashes), options);
|
||||
generate_value_to_string(generator, "{}_to_string"sv, enum_title, enum_snake, format_identifier, values);
|
||||
};
|
||||
|
||||
append_from_string("TimeZone"sv, "time_zone"sv, time_zone_data.time_zone_names, time_zone_data.time_zone_aliases);
|
||||
append_string_conversions("TimeZone"sv, "time_zone"sv, time_zone_data.time_zone_names, time_zone_data.time_zone_aliases);
|
||||
|
||||
generator.append(R"~~~(
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user