aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/unum.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/unum.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/unum.cpp')
-rw-r--r--contrib/libs/icu/i18n/unum.cpp216
1 files changed, 108 insertions, 108 deletions
diff --git a/contrib/libs/icu/i18n/unum.cpp b/contrib/libs/icu/i18n/unum.cpp
index cce3db7d0b..a0b66dd025 100644
--- a/contrib/libs/icu/i18n/unum.cpp
+++ b/contrib/libs/icu/i18n/unum.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
/*
*******************************************************************************
@@ -135,11 +135,11 @@ unum_open( UNumberFormatStyle style,
*status = U_MEMORY_ALLOCATION_ERROR;
}
- if (U_FAILURE(*status) && retVal != NULL) {
- delete retVal;
- retVal = NULL;
- }
-
+ if (U_FAILURE(*status) && retVal != NULL) {
+ delete retVal;
+ retVal = NULL;
+ }
+
return reinterpret_cast<UNumberFormat *>(retVal);
}
@@ -252,34 +252,34 @@ unum_formatDouble( const UNumberFormat* fmt,
return res.extract(result, resultLength, *status);
}
-U_CAPI int32_t U_EXPORT2
-unum_formatDoubleForFields(const UNumberFormat* format,
- double number,
- UChar* result,
- int32_t resultLength,
- UFieldPositionIterator* fpositer,
- UErrorCode* status)
-{
- if (U_FAILURE(*status))
- return -1;
-
- if (result == NULL ? resultLength != 0 : resultLength < 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
-
- UnicodeString res;
- if (result != NULL) {
- // NULL destination for pure preflighting: empty dummy string
- // otherwise, alias the destination buffer
- res.setTo(result, 0, resultLength);
- }
-
- ((const NumberFormat*)format)->format(number, res, (FieldPositionIterator*)fpositer, *status);
-
- return res.extract(result, resultLength, *status);
-}
-
+U_CAPI int32_t U_EXPORT2
+unum_formatDoubleForFields(const UNumberFormat* format,
+ double number,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPositionIterator* fpositer,
+ UErrorCode* status)
+{
+ if (U_FAILURE(*status))
+ return -1;
+
+ if (result == NULL ? resultLength != 0 : resultLength < 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+
+ UnicodeString res;
+ if (result != NULL) {
+ // NULL destination for pure preflighting: empty dummy string
+ // otherwise, alias the destination buffer
+ res.setTo(result, 0, resultLength);
+ }
+
+ ((const NumberFormat*)format)->format(number, res, (FieldPositionIterator*)fpositer, *status);
+
+ return res.extract(result, resultLength, *status);
+}
+
U_CAPI int32_t U_EXPORT2
unum_formatDecimal(const UNumberFormat* fmt,
const char * number,
@@ -303,7 +303,7 @@ unum_formatDecimal(const UNumberFormat* fmt,
}
if (length < 0) {
- length = static_cast<int32_t>(uprv_strlen(number));
+ length = static_cast<int32_t>(uprv_strlen(number));
}
StringPiece numSP(number, length);
Formattable numFmtbl(numSP, *status);
@@ -512,43 +512,43 @@ U_CAPI int32_t U_EXPORT2
unum_getAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr)
{
- const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
- if (attr == UNUM_LENIENT_PARSE) {
- // Supported for all subclasses
- return nf->isLenient();
- }
- else if (attr == UNUM_MAX_INTEGER_DIGITS) {
- return nf->getMaximumIntegerDigits();
- }
- else if (attr == UNUM_MIN_INTEGER_DIGITS) {
- return nf->getMinimumIntegerDigits();
- }
- else if (attr == UNUM_INTEGER_DIGITS) {
- // TODO: what should this return?
- return nf->getMinimumIntegerDigits();
- }
- else if (attr == UNUM_MAX_FRACTION_DIGITS) {
- return nf->getMaximumFractionDigits();
- }
- else if (attr == UNUM_MIN_FRACTION_DIGITS) {
- return nf->getMinimumFractionDigits();
- }
- else if (attr == UNUM_FRACTION_DIGITS) {
- // TODO: what should this return?
- return nf->getMinimumFractionDigits();
- }
- else if (attr == UNUM_ROUNDING_MODE) {
- return nf->getRoundingMode();
- }
-
- // The remaining attributes are only supported for DecimalFormat
- const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
- if (df != NULL) {
- UErrorCode ignoredStatus = U_ZERO_ERROR;
- return df->getAttribute(attr, ignoredStatus);
- }
-
- return -1;
+ const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
+ if (attr == UNUM_LENIENT_PARSE) {
+ // Supported for all subclasses
+ return nf->isLenient();
+ }
+ else if (attr == UNUM_MAX_INTEGER_DIGITS) {
+ return nf->getMaximumIntegerDigits();
+ }
+ else if (attr == UNUM_MIN_INTEGER_DIGITS) {
+ return nf->getMinimumIntegerDigits();
+ }
+ else if (attr == UNUM_INTEGER_DIGITS) {
+ // TODO: what should this return?
+ return nf->getMinimumIntegerDigits();
+ }
+ else if (attr == UNUM_MAX_FRACTION_DIGITS) {
+ return nf->getMaximumFractionDigits();
+ }
+ else if (attr == UNUM_MIN_FRACTION_DIGITS) {
+ return nf->getMinimumFractionDigits();
+ }
+ else if (attr == UNUM_FRACTION_DIGITS) {
+ // TODO: what should this return?
+ return nf->getMinimumFractionDigits();
+ }
+ else if (attr == UNUM_ROUNDING_MODE) {
+ return nf->getRoundingMode();
+ }
+
+ // The remaining attributes are only supported for DecimalFormat
+ const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
+ if (df != NULL) {
+ UErrorCode ignoredStatus = U_ZERO_ERROR;
+ return df->getAttribute(attr, ignoredStatus);
+ }
+
+ return -1;
}
U_CAPI void U_EXPORT2
@@ -556,42 +556,42 @@ unum_setAttribute( UNumberFormat* fmt,
UNumberFormatAttribute attr,
int32_t newValue)
{
- NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt);
- if (attr == UNUM_LENIENT_PARSE) {
- // Supported for all subclasses
- // keep this here as the class may not be a DecimalFormat
- return nf->setLenient(newValue != 0);
- }
- else if (attr == UNUM_MAX_INTEGER_DIGITS) {
- return nf->setMaximumIntegerDigits(newValue);
- }
- else if (attr == UNUM_MIN_INTEGER_DIGITS) {
- return nf->setMinimumIntegerDigits(newValue);
- }
- else if (attr == UNUM_INTEGER_DIGITS) {
- nf->setMinimumIntegerDigits(newValue);
- return nf->setMaximumIntegerDigits(newValue);
- }
- else if (attr == UNUM_MAX_FRACTION_DIGITS) {
- return nf->setMaximumFractionDigits(newValue);
- }
- else if (attr == UNUM_MIN_FRACTION_DIGITS) {
- return nf->setMinimumFractionDigits(newValue);
- }
- else if (attr == UNUM_FRACTION_DIGITS) {
- nf->setMinimumFractionDigits(newValue);
- return nf->setMaximumFractionDigits(newValue);
- }
- else if (attr == UNUM_ROUNDING_MODE) {
- return nf->setRoundingMode((NumberFormat::ERoundingMode)newValue);
- }
-
- // The remaining attributes are only supported for DecimalFormat
- DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
- if (df != NULL) {
- UErrorCode ignoredStatus = U_ZERO_ERROR;
- df->setAttribute(attr, newValue, ignoredStatus);
- }
+ NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt);
+ if (attr == UNUM_LENIENT_PARSE) {
+ // Supported for all subclasses
+ // keep this here as the class may not be a DecimalFormat
+ return nf->setLenient(newValue != 0);
+ }
+ else if (attr == UNUM_MAX_INTEGER_DIGITS) {
+ return nf->setMaximumIntegerDigits(newValue);
+ }
+ else if (attr == UNUM_MIN_INTEGER_DIGITS) {
+ return nf->setMinimumIntegerDigits(newValue);
+ }
+ else if (attr == UNUM_INTEGER_DIGITS) {
+ nf->setMinimumIntegerDigits(newValue);
+ return nf->setMaximumIntegerDigits(newValue);
+ }
+ else if (attr == UNUM_MAX_FRACTION_DIGITS) {
+ return nf->setMaximumFractionDigits(newValue);
+ }
+ else if (attr == UNUM_MIN_FRACTION_DIGITS) {
+ return nf->setMinimumFractionDigits(newValue);
+ }
+ else if (attr == UNUM_FRACTION_DIGITS) {
+ nf->setMinimumFractionDigits(newValue);
+ return nf->setMaximumFractionDigits(newValue);
+ }
+ else if (attr == UNUM_ROUNDING_MODE) {
+ return nf->setRoundingMode((NumberFormat::ERoundingMode)newValue);
+ }
+
+ // The remaining attributes are only supported for DecimalFormat
+ DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
+ if (df != NULL) {
+ UErrorCode ignoredStatus = U_ZERO_ERROR;
+ df->setAttribute(attr, newValue, ignoredStatus);
+ }
}
U_CAPI double U_EXPORT2