Issue #1971 - Part 2: Update ICU source to 63.2.

This commit is contained in:
Job Bautista 2022-07-24 21:03:27 +08:00 • committed by roytam1
commit 1e69214382
3160 changed files with 275815 additions and 234203 deletions

View file

@ -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
/*
* Copyright (C) 1997-2016, International Business Machines Corporation and
@ -50,6 +50,10 @@ class TimeZoneFormat;
class SharedNumberFormat;
class SimpleDateFormatMutableNFs;
namespace number {
class LocalizedNumberFormatter;
}
/**
*
* SimpleDateFormat is a concrete class for formatting and parsing dates in a
@ -1143,7 +1147,7 @@ public:
* Overrides base class method and
* This method clears per field NumberFormat instances
* previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)}
* @param adoptNF the NumbeferFormat used
* @param formatToAdopt the NumbeferFormat used
* @stable ICU 54
*/
void adoptNumberFormat(NumberFormat *formatToAdopt);
@ -1158,7 +1162,7 @@ public:
* Per field NumberFormat can also be cleared in {@see DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)}
*
* @param fields the fields to override(like y)
* @param adoptNF the NumbeferFormat used
* @param formatToAdopt the NumbeferFormat used
* @param status Receives a status code, which will be U_ZERO_ERROR
* if the operation succeeds.
* @stable ICU 54
@ -1170,7 +1174,7 @@ public:
* @param field The UDateFormatField to get
* @stable ICU 54
*/
const NumberFormat * getNumberFormatForField(UChar field) const;
const NumberFormat * getNumberFormatForField(char16_t field) const;
#ifndef U_HIDE_INTERNAL_API
/**
@ -1262,13 +1266,12 @@ private:
* succeeds.
*/
void subFormat(UnicodeString &appendTo,
UChar ch,
char16_t ch,
int32_t count,
UDisplayContext capitalizationContext,
int32_t fieldNum,
FieldPositionHandler& handler,
Calendar& cal,
SimpleDateFormatMutableNFs &mutableNFs,
UErrorCode& status) const; // in case of illegal argument
/**
@ -1284,7 +1287,7 @@ private:
* @param minDigits Minimum number of digits the result should have
* @param maxDigits Maximum number of digits the result should have
*/
void zeroPaddingNumber(NumberFormat *currentNumberFormat,
void zeroPaddingNumber(const NumberFormat *currentNumberFormat,
UnicodeString &appendTo,
int32_t value,
int32_t minDigits,
@ -1294,7 +1297,7 @@ private:
* Return true if the given format character, occuring count
* times, represents a numeric field.
*/
static UBool isNumeric(UChar formatChar, int32_t count);
static UBool isNumeric(char16_t formatChar, int32_t count);
/**
* Returns TRUE if the patternOffset is at the start of a numeric field.
@ -1412,27 +1415,37 @@ private:
* @return the new start position if matching succeeded; a negative number
* indicating matching failure, otherwise.
*/
int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count,
int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count,
UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs,
int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType,
int32_t *dayPeriod=NULL) const;
void parseInt(const UnicodeString& text,
Formattable& number,
ParsePosition& pos,
UBool allowNegative,
NumberFormat *fmt) const;
const NumberFormat *fmt) const;
void parseInt(const UnicodeString& text,
Formattable& number,
int32_t maxDigits,
ParsePosition& pos,
UBool allowNegative,
NumberFormat *fmt) const;
const NumberFormat *fmt) const;
int32_t checkIntSuffix(const UnicodeString& text, int32_t start,
int32_t patLoc, UBool isNegative) const;
/**
* Counts number of digit code points in the specified text.
*
* @param text input text
* @param start start index, inclusive
* @param end end index, exclusive
* @return number of digits found in the text in the specified range.
*/
int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const;
/**
* Translate a pattern, mapping each character in the from string to the
* corresponding character in the to string. Return an error if the original
@ -1485,6 +1498,16 @@ private:
*/
int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const;
/**
* Initialize LocalizedNumberFormatter instances used for speedup.
*/
void initFastNumberFormatters(UErrorCode& status);
/**
* Delete the LocalizedNumberFormatter instances used for speedup.
*/
void freeFastNumberFormatters();
/**
* Initialize NumberFormat instances used for numbering system overrides.
*/
@ -1508,7 +1531,7 @@ private:
/**
* Lazy TimeZoneFormat instantiation, semantically const
*/
TimeZoneFormat *tzFormat() const;
TimeZoneFormat *tzFormat(UErrorCode &status) const;
const NumberFormat* getNumberFormatByIndex(UDateFormatField index) const;
@ -1523,12 +1546,12 @@ private:
/**
* Map calendar field letter into calendar field level.
*/
static int32_t getLevelFromChar(UChar ch);
static int32_t getLevelFromChar(char16_t ch);
/**
* Tell if a character can be used to define a field in a format string.
*/
static UBool isSyntaxChar(UChar ch);
static UBool isSyntaxChar(char16_t ch);
/**
* The formatting pattern for this formatter.
@ -1601,6 +1624,20 @@ private:
*/
const SharedNumberFormat **fSharedNumberFormatters;
enum NumberFormatterKey {
SMPDTFMT_NF_1x10,
SMPDTFMT_NF_2x10,
SMPDTFMT_NF_3x10,
SMPDTFMT_NF_4x10,
SMPDTFMT_NF_2x2,
SMPDTFMT_NF_COUNT
};
/**
* Number formatters pre-allocated for fast performance on the most common integer lengths.
*/
const number::LocalizedNumberFormatter* fFastNumberFormatters[SMPDTFMT_NF_COUNT] = {};
UBool fHaveDefaultCentury;
BreakIterator* fCapitalizationBrkIter;