aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/plurfmt.cpp
diff options
context:
space:
mode:
authormcheshkov <mcheshkov@yandex-team.ru>2022-02-10 16:46:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:15 +0300
commite9d19cec64684c9c1e6b0c98297e5b895cf904fe (patch)
tree2768b1223e96a8a0610a93d18425d9647c1123c8 /contrib/libs/icu/i18n/plurfmt.cpp
parent60040c91ffe701a84689b2c6310ff845e65cff42 (diff)
downloadydb-e9d19cec64684c9c1e6b0c98297e5b895cf904fe.tar.gz
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/icu/i18n/plurfmt.cpp')
-rw-r--r--contrib/libs/icu/i18n/plurfmt.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/contrib/libs/icu/i18n/plurfmt.cpp b/contrib/libs/icu/i18n/plurfmt.cpp
index b99437630e..a802e3606a 100644
--- a/contrib/libs/icu/i18n/plurfmt.cpp
+++ b/contrib/libs/icu/i18n/plurfmt.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
/*
*******************************************************************************
@@ -21,16 +21,16 @@
#include "plurrule_impl.h"
#include "uassert.h"
#include "uhash.h"
-#include "number_decimalquantity.h"
-#include "number_utils.h"
-#include "number_utypes.h"
+#include "number_decimalquantity.h"
+#include "number_utils.h"
+#include "number_utypes.h"
#if !UCONFIG_NO_FORMATTING
U_NAMESPACE_BEGIN
-using number::impl::DecimalQuantity;
-
+using number::impl::DecimalQuantity;
+
static const UChar OTHER_STRING[] = {
0x6F, 0x74, 0x68, 0x65, 0x72, 0 // "other"
};
@@ -159,7 +159,7 @@ PluralFormat::copyObjects(const PluralFormat& other) {
if (other.numberFormat == NULL) {
numberFormat = NumberFormat::createInstance(locale, status);
} else {
- numberFormat = other.numberFormat->clone();
+ numberFormat = other.numberFormat->clone();
}
if (other.pluralRulesWrapper.pluralRules == NULL) {
pluralRulesWrapper.pluralRules = PluralRules::forLocale(locale, status);
@@ -261,40 +261,40 @@ PluralFormat::format(const Formattable& numberObject, double number,
if (msgPattern.countParts() == 0) {
return numberFormat->format(numberObject, appendTo, pos, status);
}
-
+
// Get the appropriate sub-message.
// Select it based on the formatted number-offset.
double numberMinusOffset = number - offset;
- // Call NumberFormatter to get both the DecimalQuantity and the string.
- // This call site needs to use more internal APIs than the Java equivalent.
- number::impl::UFormattedNumberData data;
- if (offset == 0) {
- // could be BigDecimal etc.
- numberObject.populateDecimalQuantity(data.quantity, status);
- } else {
- data.quantity.setToDouble(numberMinusOffset);
- }
+ // Call NumberFormatter to get both the DecimalQuantity and the string.
+ // This call site needs to use more internal APIs than the Java equivalent.
+ number::impl::UFormattedNumberData data;
+ if (offset == 0) {
+ // could be BigDecimal etc.
+ numberObject.populateDecimalQuantity(data.quantity, status);
+ } else {
+ data.quantity.setToDouble(numberMinusOffset);
+ }
UnicodeString numberString;
- auto *decFmt = dynamic_cast<DecimalFormat *>(numberFormat);
- if(decFmt != nullptr) {
- const number::LocalizedNumberFormatter* lnf = decFmt->toNumberFormatter(status);
- if (U_FAILURE(status)) {
- return appendTo;
- }
- lnf->formatImpl(&data, status); // mutates &data
- if (U_FAILURE(status)) {
- return appendTo;
+ auto *decFmt = dynamic_cast<DecimalFormat *>(numberFormat);
+ if(decFmt != nullptr) {
+ const number::LocalizedNumberFormatter* lnf = decFmt->toNumberFormatter(status);
+ if (U_FAILURE(status)) {
+ return appendTo;
}
- numberString = data.getStringRef().toUnicodeString();
+ lnf->formatImpl(&data, status); // mutates &data
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ numberString = data.getStringRef().toUnicodeString();
} else {
- if (offset == 0) {
- numberFormat->format(numberObject, numberString, status);
+ if (offset == 0) {
+ numberFormat->format(numberObject, numberString, status);
} else {
- numberFormat->format(numberMinusOffset, numberString, status);
+ numberFormat->format(numberMinusOffset, numberString, status);
}
}
-
- int32_t partIndex = findSubMessage(msgPattern, 0, pluralRulesWrapper, &data.quantity, number, status);
+
+ int32_t partIndex = findSubMessage(msgPattern, 0, pluralRulesWrapper, &data.quantity, number, status);
if (U_FAILURE(status)) { return appendTo; }
// Replace syntactic # signs in the top level of this sub-message
// (not in nested arguments) with the formatted number-offset.
@@ -353,7 +353,7 @@ PluralFormat::setNumberFormat(const NumberFormat* format, UErrorCode& status) {
if (U_FAILURE(status)) {
return;
}
- NumberFormat* nf = format->clone();
+ NumberFormat* nf = format->clone();
if (nf != NULL) {
delete numberFormat;
numberFormat = nf;
@@ -362,7 +362,7 @@ PluralFormat::setNumberFormat(const NumberFormat* format, UErrorCode& status) {
}
}
-PluralFormat*
+PluralFormat*
PluralFormat::clone() const
{
return new PluralFormat(*this);
@@ -583,7 +583,7 @@ PluralFormat::PluralSelectorAdapter::~PluralSelectorAdapter() {
UnicodeString PluralFormat::PluralSelectorAdapter::select(void *context, double number,
UErrorCode& /*ec*/) const {
(void)number; // unused except in the assertion
- IFixedDecimal *dec=static_cast<IFixedDecimal *>(context);
+ IFixedDecimal *dec=static_cast<IFixedDecimal *>(context);
return pluralRules->select(*dec);
}