aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/quantityformatter.cpp
diff options
context:
space:
mode:
authorromankoshelev <romankoshelev@yandex-team.com>2023-08-14 19:51:50 +0300
committerromankoshelev <romankoshelev@yandex-team.com>2023-08-15 01:24:11 +0300
commitcfcd865e05c0d0525ea27d1e153a043b32a85138 (patch)
tree68d3b3b25271e8a4998505897a269ff7ce119b76 /contrib/libs/icu/i18n/quantityformatter.cpp
parentccb790c507bd5e8ffe2ef9886ce5ee0a7ce22a15 (diff)
downloadydb-cfcd865e05c0d0525ea27d1e153a043b32a85138.tar.gz
Update ICU to 73.2
Diffstat (limited to 'contrib/libs/icu/i18n/quantityformatter.cpp')
-rw-r--r--contrib/libs/icu/i18n/quantityformatter.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/contrib/libs/icu/i18n/quantityformatter.cpp b/contrib/libs/icu/i18n/quantityformatter.cpp
index 9c9aa99b67..0a1982e3d4 100644
--- a/contrib/libs/icu/i18n/quantityformatter.cpp
+++ b/contrib/libs/icu/i18n/quantityformatter.cpp
@@ -32,14 +32,14 @@ U_NAMESPACE_BEGIN
QuantityFormatter::QuantityFormatter() {
for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
- formatters[i] = NULL;
+ formatters[i] = nullptr;
}
}
QuantityFormatter::QuantityFormatter(const QuantityFormatter &other) {
for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
- if (other.formatters[i] == NULL) {
- formatters[i] = NULL;
+ if (other.formatters[i] == nullptr) {
+ formatters[i] = nullptr;
} else {
formatters[i] = new SimpleFormatter(*other.formatters[i]);
}
@@ -53,8 +53,8 @@ QuantityFormatter &QuantityFormatter::operator=(
}
for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
delete formatters[i];
- if (other.formatters[i] == NULL) {
- formatters[i] = NULL;
+ if (other.formatters[i] == nullptr) {
+ formatters[i] = nullptr;
} else {
formatters[i] = new SimpleFormatter(*other.formatters[i]);
}
@@ -71,7 +71,7 @@ QuantityFormatter::~QuantityFormatter() {
void QuantityFormatter::reset() {
for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
delete formatters[i];
- formatters[i] = NULL;
+ formatters[i] = nullptr;
}
}
@@ -81,26 +81,26 @@ UBool QuantityFormatter::addIfAbsent(
UErrorCode &status) {
int32_t pluralIndex = StandardPlural::indexFromString(variant, status);
if (U_FAILURE(status)) {
- return FALSE;
+ return false;
}
- if (formatters[pluralIndex] != NULL) {
- return TRUE;
+ if (formatters[pluralIndex] != nullptr) {
+ return true;
}
SimpleFormatter *newFmt = new SimpleFormatter(rawPattern, 0, 1, status);
- if (newFmt == NULL) {
+ if (newFmt == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- return FALSE;
+ return false;
}
if (U_FAILURE(status)) {
delete newFmt;
- return FALSE;
+ return false;
}
formatters[pluralIndex] = newFmt;
- return TRUE;
+ return true;
}
UBool QuantityFormatter::isValid() const {
- return formatters[StandardPlural::OTHER] != NULL;
+ return formatters[StandardPlural::OTHER] != nullptr;
}
const SimpleFormatter *QuantityFormatter::getByVariant(
@@ -108,7 +108,7 @@ const SimpleFormatter *QuantityFormatter::getByVariant(
U_ASSERT(isValid());
int32_t pluralIndex = StandardPlural::indexOrOtherIndexFromString(variant);
const SimpleFormatter *pattern = formatters[pluralIndex];
- if (pattern == NULL) {
+ if (pattern == nullptr) {
pattern = formatters[StandardPlural::OTHER];
}
return pattern;
@@ -127,9 +127,9 @@ UnicodeString &QuantityFormatter::format(
return appendTo;
}
const SimpleFormatter *pattern = formatters[p];
- if (pattern == NULL) {
+ if (pattern == nullptr) {
pattern = formatters[StandardPlural::OTHER];
- if (pattern == NULL) {
+ if (pattern == nullptr) {
status = U_INVALID_STATE_ERROR;
return appendTo;
}
@@ -152,7 +152,7 @@ StandardPlural::Form QuantityFormatter::selectPlural(
}
UnicodeString pluralKeyword;
const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(&fmt);
- if (decFmt != NULL) {
+ if (decFmt != nullptr) {
number::impl::DecimalQuantity dq;
decFmt->formatToDecimalQuantity(number, dq, status);
if (U_FAILURE(status)) {