mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
Issue #1971 - Part 2: Update ICU source to 63.2.
This commit is contained in:
parent
8df84683be
commit
1e69214382
3160 changed files with 275815 additions and 234203 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
|
|
@ -247,6 +247,33 @@ 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_formatDecimal(const UNumberFormat* fmt,
|
||||
|
|
@ -271,7 +298,7 @@ unum_formatDecimal(const UNumberFormat* fmt,
|
|||
}
|
||||
|
||||
if (length < 0) {
|
||||
length = uprv_strlen(number);
|
||||
length = static_cast<int32_t>(uprv_strlen(number));
|
||||
}
|
||||
StringPiece numSP(number, length);
|
||||
Formattable numFmtbl(numSP, *status);
|
||||
|
|
@ -480,20 +507,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();
|
||||
}
|
||||
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 attributea 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 );
|
||||
}
|
||||
// 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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
|
|
@ -501,18 +551,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);
|
||||
}
|
||||
// The remaining attributea 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
|
||||
|
|
@ -875,32 +949,4 @@ unum_formatUFormattable(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);
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue