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
/*
*******************************************************************************
@ -18,6 +18,7 @@
#include "unicode/locid.h"
#include "unicode/udat.h"
#include "unicode/udatpg.h"
#include "unicode/unistr.h"
U_NAMESPACE_BEGIN
@ -27,6 +28,7 @@ U_NAMESPACE_BEGIN
*/
class CharString;
class Hashtable;
class FormatParser;
class DateTimeMatcher;
@ -205,11 +207,11 @@ public:
* @return conflicting status. The value could be UDATPG_NO_CONFLICT,
* UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
* @stable ICU 3.8
* <p>
* <h4>Sample code</h4>
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
* \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample
* <p>
* <p>
* <h4>Sample code</h4>
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
* \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample
* <p>
*/
UDateTimePatternConflict addPattern(const UnicodeString& pattern,
UBool override,
@ -261,14 +263,29 @@ public:
/**
* Getter corresponding to setAppendItemNames. Values below 0 or at or above
* UDATPG_FIELD_COUNT are illegal arguments.
* UDATPG_FIELD_COUNT are illegal arguments. Note: The more general method
* for getting date/time field display names is getFieldDisplayName.
*
* @param field such as UDATPG_ERA_FIELD.
* @return name for field
* @see getFieldDisplayName
* @stable ICU 3.8
*/
const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
#ifndef U_HIDE_DRAFT_API
/**
* The general interface to get a display name for a particular date/time field,
* in one of several possible display widths.
*
* @param field The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
* @param width The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
* @return. The display name for field
* @draft ICU 61
*/
UnicodeString getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const;
#endif // U_HIDE_DRAFT_API
/**
* The DateTimeFormat is a message format pattern used to compose date and
* time patterns. The default pattern in the root locale is "{1} {0}", where
@ -311,11 +328,11 @@ public:
* @return bestPattern
* The best pattern found from the given skeleton.
* @stable ICU 3.8
* <p>
* <h4>Sample code</h4>
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample
* <p>
* <p>
* <h4>Sample code</h4>
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample
* <p>
*/
UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
@ -359,11 +376,11 @@ public:
* which must not indicate a failure before the function call.
* @return pattern adjusted to match the skeleton fields widths and subtypes.
* @stable ICU 3.8
* <p>
* <h4>Sample code</h4>
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
* \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample
* <p>
* <p>
* <h4>Sample code</h4>
* \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
* \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample
* <p>
*/
UnicodeString replaceFieldTypes(const UnicodeString& pattern,
const UnicodeString& skeleton,
@ -481,53 +498,57 @@ public:
private:
/**
* Constructor.
* @stable ICU 3.8
*/
DateTimePatternGenerator(UErrorCode & status);
/**
* Constructor.
* @stable ICU 3.8
*/
DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
/**
* Copy constructor.
* @param other DateTimePatternGenerator to copy
* @stable ICU 3.8
*/
DateTimePatternGenerator(const DateTimePatternGenerator& other);
/**
* Default assignment operator.
* @param other DateTimePatternGenerator to copy
* @stable ICU 3.8
*/
DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
// TODO(ticket:13619): re-enable when UDATPG_NARROW no longer in draft mode.
// static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1;
Locale pLocale; // pattern locale
FormatParser *fp;
DateTimeMatcher* dtMatcher;
DistanceInfo *distanceInfo;
PatternMap *patternMap;
UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
UnicodeString appendItemNames[UDATPG_FIELD_COUNT];
// TODO(ticket:13619): [3] -> UDATPG_WIDTH_COUNT
UnicodeString fieldDisplayNames[UDATPG_FIELD_COUNT][3];
UnicodeString dateTimeFormat;
UnicodeString decimal;
DateTimeMatcher *skipMatcher;
Hashtable *fAvailableFormatKeyHash;
UnicodeString emptyString;
UChar fDefaultHourFormatChar;
char16_t fDefaultHourFormatChar;
int32_t fAllowedHourFormats[7]; // Actually an array of AllowedHourFormat enum type, ending with UNKNOWN.
// Internal error code used for recording/reporting errors that occur during methods that do not
// have a UErrorCode parameter. For example: the Copy Constructor, or the ::clone() method.
// When this is set to an error the object is in an invalid state.
UErrorCode internalErrorCode;
/* internal flags masks for adjustFieldTypes etc. */
enum {
kDTPGNoFlags = 0,
kDTPGFixFractionalSeconds = 1,
kDTPGSkeletonUsesCapJ = 2,
kDTPGSkeletonUsesLowB = 3,
kDTPGSkeletonUsesCapB = 4
kDTPGSkeletonUsesCapJ = 2
// with #13183, no longer need flags for b, B
};
void initData(const Locale &locale, UErrorCode &status);
@ -542,14 +563,17 @@ private:
void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
void setDecimalSymbols(const Locale& locale, UErrorCode& status);
UDateTimePatternField getAppendFormatNumber(const char* field) const;
UDateTimePatternField getAppendNameNumber(const char* field) const;
UnicodeString& getMutableAppendItemName(UDateTimePatternField field);
#ifndef U_HIDE_DRAFT_API
UDateTimePatternField getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const;
void setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value);
UnicodeString& getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width);
#endif // U_HIDE_DRAFT_API
void getAppendName(UDateTimePatternField field, UnicodeString& value);
int32_t getCanonicalIndex(const UnicodeString& field);
const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status);
const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, UErrorCode& status, const PtnSkeleton** specifiedSkeletonPtr = 0);
UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
int32_t getTopBitNumber(int32_t foundMask);
UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UErrorCode& status, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
int32_t getTopBitNumber(int32_t foundMask) const;
void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
UBool isAvailableFormatSet(const UnicodeString &key) const;
void copyHashtable(Hashtable *other, UErrorCode &status);