From b0d7600970d2fdb1eb6fff813c7336ea34d4e228 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Fri, 28 Aug 2026 22:22:24 +0200 Subject: Indent tweaks --- server/src/locale.cppm | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'server/src/locale.cppm') diff --git a/server/src/locale.cppm b/server/src/locale.cppm index 06607f0..da80f76 100644 --- a/server/src/locale.cppm +++ b/server/src/locale.cppm @@ -50,11 +50,11 @@ struct icu_locale_hash }; using icu_locale_priority_map = - std::unordered_map; + std::unordered_map; using icu_priority_locale = std::pair; auto operator<(icu_priority_locale const& lhs, icu_priority_locale const& rhs) - -> bool + -> bool { return lhs.second < rhs.second; } @@ -66,7 +66,7 @@ class icu_priority_locale_vec_iterator : public icu::Locale::Iterator public: explicit icu_priority_locale_vec_iterator( - std::vector&& ls) + std::vector&& ls) : ls_(std::move(ls)) { } @@ -80,8 +80,9 @@ public: export template concept locale_input_range = - std::ranges::input_range - && std::same_as>; + std::ranges::input_range + && std::same_as< + std::locale const&, std::ranges::range_const_reference_t>; // Helps select a locale based on the Accept-Language header in an // HTTP request. @@ -92,15 +93,15 @@ export class selector std::shared_ptr lgen_; auto make_matcher( - locale_input_range auto supported_locales, std::locale default_locale) + locale_input_range auto supported_locales, std::locale default_locale) { auto builder = icu::LocaleMatcher::Builder{}; for (auto const& supported_locale : supported_locales) { auto const& supported_locale_info = - std::use_facet(supported_locale); + std::use_facet(supported_locale); auto supported_icu_locale = - icu::Locale{supported_locale_info.name().c_str()}; + icu::Locale{supported_locale_info.name().c_str()}; if (supported_icu_locale.isBogus()) throw std::runtime_error{ "supported locale gives rise to bogus ICU locale" @@ -108,7 +109,7 @@ export class selector builder.addSupportedLocale(supported_icu_locale); } auto const& default_locale_info = - std::use_facet(default_locale); + std::use_facet(default_locale); auto default_icu_locale = icu::Locale{default_locale_info.name().c_str()}; if (default_icu_locale.isBogus()) throw std::runtime_error{"default locale gives rise to bogus ICU locale"}; @@ -170,7 +171,7 @@ export class selector while (kw = keywords->next(&kw_len, ec), !U_FAILURE(ec) && kw) { auto value = - l.getKeywordValue(icu::StringPiece(kw, kw_len), ec); + l.getKeywordValue(icu::StringPiece(kw, kw_len), ec); if (!added_at) { posix_name += "@"; @@ -195,8 +196,8 @@ public: // Note: lgen must live at least as long as the selector constructed here! // It is unfortunately not possible to copy/move a blocale::generator. explicit selector( - locale_input_range auto locales, std::locale default_, - std::shared_ptr lgen) + locale_input_range auto locales, std::locale default_, + std::shared_ptr lgen) : default_{default_}, matcher_{make_matcher(locales, default_)}, lgen_{lgen} { } @@ -211,7 +212,7 @@ public: accept_language | std::views::split(","sv) | std::views::enumerate) { auto [lang_range_ut, mweight_ut] = - util::split_on(std::string_view{lang_prio}, ';'); + util::split_on(std::string_view{lang_prio}, ';'); auto lang_range_str = trim_ows(lang_range_ut); auto mweight_str = mweight_ut.transform(trim_ows); if (lang_range_str == "*") @@ -227,7 +228,7 @@ public: { auto weight_str = mweight_str->substr(2, 4); if (auto mweight = - util::parse_float(weight_str, std::chars_format::fixed); + util::parse_float(weight_str, std::chars_format::fixed); mweight && 0.0f < *mweight && *mweight < 1.0f) { weight = *mweight; @@ -248,7 +249,7 @@ public: } auto desired_locales = - std::vector{dlpm.begin(), dlpm.end()}; + std::vector{dlpm.begin(), dlpm.end()}; std::sort(desired_locales.begin(), desired_locales.end()); auto it = icu_priority_locale_vec_iterator{std::move(desired_locales)}; auto ec = UErrorCode::U_ZERO_ERROR; @@ -267,7 +268,7 @@ export auto to_bcp47_lang_tag(std::locale locale) -> std::optional auto const& locale_info = std::use_facet(locale); auto ec = UErrorCode::U_ZERO_ERROR; auto bcp47_lang_tag = - icu::Locale{locale_info.name().c_str()}.toLanguageTag(ec); + icu::Locale{locale_info.name().c_str()}.toLanguageTag(ec); if (U_FAILURE(ec)) return std::nullopt; return bcp47_lang_tag; -- cgit v1.3