aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/quantityformatter.cpp
diff options
context:
space:
mode:
authormcheshkov <mcheshkov@yandex-team.ru>2022-02-10 16:46:16 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:16 +0300
commit1312621288956f199a5bd5342b0133d4395fa725 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/icu/i18n/quantityformatter.cpp
parente9d19cec64684c9c1e6b0c98297e5b895cf904fe (diff)
downloadydb-1312621288956f199a5bd5342b0133d4395fa725.tar.gz
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/i18n/quantityformatter.cpp')
-rw-r--r--contrib/libs/icu/i18n/quantityformatter.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/contrib/libs/icu/i18n/quantityformatter.cpp b/contrib/libs/icu/i18n/quantityformatter.cpp
index 88d3f5ffac..9c9aa99b67 100644
--- a/contrib/libs/icu/i18n/quantityformatter.cpp
+++ b/contrib/libs/icu/i18n/quantityformatter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -24,9 +24,9 @@
#include "unicode/fieldpos.h"
#include "standardplural.h"
#include "uassert.h"
-#include "number_decimalquantity.h"
-#include "number_utypes.h"
-#include "formatted_string_builder.h"
+#include "number_decimalquantity.h"
+#include "number_utypes.h"
+#include "formatted_string_builder.h"
U_NAMESPACE_BEGIN
@@ -153,13 +153,13 @@ StandardPlural::Form QuantityFormatter::selectPlural(
UnicodeString pluralKeyword;
const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(&fmt);
if (decFmt != NULL) {
- number::impl::DecimalQuantity dq;
- decFmt->formatToDecimalQuantity(number, dq, status);
+ number::impl::DecimalQuantity dq;
+ decFmt->formatToDecimalQuantity(number, dq, status);
if (U_FAILURE(status)) {
return StandardPlural::OTHER;
}
- pluralKeyword = rules.select(dq);
- decFmt->format(number, formattedNumber, pos, status);
+ pluralKeyword = rules.select(dq);
+ decFmt->format(number, formattedNumber, pos, status);
} else {
if (number.getType() == Formattable::kDouble) {
pluralKeyword = rules.select(number.getDouble());
@@ -176,44 +176,44 @@ StandardPlural::Form QuantityFormatter::selectPlural(
return StandardPlural::orOtherFromString(pluralKeyword);
}
-void QuantityFormatter::formatAndSelect(
- double quantity,
- const NumberFormat& fmt,
- const PluralRules& rules,
- FormattedStringBuilder& output,
- StandardPlural::Form& pluralForm,
- UErrorCode& status) {
- UnicodeString pluralKeyword;
- const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(&fmt);
- if (df != nullptr) {
- number::impl::UFormattedNumberData fn;
- fn.quantity.setToDouble(quantity);
- const number::LocalizedNumberFormatter* lnf = df->toNumberFormatter(status);
- if (U_FAILURE(status)) {
- return;
- }
- lnf->formatImpl(&fn, status);
- if (U_FAILURE(status)) {
- return;
- }
- output = std::move(fn.getStringRef());
- pluralKeyword = rules.select(fn.quantity);
- } else {
- UnicodeString result;
- fmt.format(quantity, result, status);
- if (U_FAILURE(status)) {
- return;
- }
- // This code path is probably RBNF. Use the generic numeric field.
- output.append(result, kGeneralNumericField, status);
- if (U_FAILURE(status)) {
- return;
- }
- pluralKeyword = rules.select(quantity);
- }
- pluralForm = StandardPlural::orOtherFromString(pluralKeyword);
-}
-
+void QuantityFormatter::formatAndSelect(
+ double quantity,
+ const NumberFormat& fmt,
+ const PluralRules& rules,
+ FormattedStringBuilder& output,
+ StandardPlural::Form& pluralForm,
+ UErrorCode& status) {
+ UnicodeString pluralKeyword;
+ const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(&fmt);
+ if (df != nullptr) {
+ number::impl::UFormattedNumberData fn;
+ fn.quantity.setToDouble(quantity);
+ const number::LocalizedNumberFormatter* lnf = df->toNumberFormatter(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ lnf->formatImpl(&fn, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ output = std::move(fn.getStringRef());
+ pluralKeyword = rules.select(fn.quantity);
+ } else {
+ UnicodeString result;
+ fmt.format(quantity, result, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ // This code path is probably RBNF. Use the generic numeric field.
+ output.append(result, kGeneralNumericField, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ pluralKeyword = rules.select(quantity);
+ }
+ pluralForm = StandardPlural::orOtherFromString(pluralKeyword);
+}
+
UnicodeString &QuantityFormatter::format(
const SimpleFormatter &pattern,
const UnicodeString &value,