| Index: source/i18n/unicode/smpdtfmt.h
|
| diff --git a/source/i18n/unicode/smpdtfmt.h b/source/i18n/unicode/smpdtfmt.h
|
| index d41fb59f713ff9323885fb8c0e2468af1690b53e..e6e96ae30d2cde7b61e6a28bc9aed45066f30625 100644
|
| --- a/source/i18n/unicode/smpdtfmt.h
|
| +++ b/source/i18n/unicode/smpdtfmt.h
|
| @@ -1,5 +1,5 @@
|
| /*
|
| -* Copyright (C) 1997-2014, International Business Machines Corporation and
|
| +* Copyright (C) 1997-2015, International Business Machines Corporation and
|
| * others. All Rights Reserved.
|
| *******************************************************************************
|
| *
|
| @@ -45,6 +45,8 @@ class DateFormat;
|
| class MessageFormat;
|
| class FieldPositionHandler;
|
| class TimeZoneFormat;
|
| +class SharedNumberFormat;
|
| +class SimpleDateFormatMutableNFs;
|
|
|
| /**
|
| *
|
| @@ -1117,7 +1119,6 @@ public:
|
| */
|
| virtual const TimeZoneFormat* getTimeZoneFormat(void) const;
|
|
|
| - /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
|
| /**
|
| * Set a particular UDisplayContext value in the formatter, such as
|
| * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. Note: For getContext, see
|
| @@ -1126,17 +1127,16 @@ public:
|
| * @param status Input/output status. If at entry this indicates a failure
|
| * status, the function will do nothing; otherwise this will be
|
| * updated with any new status from the function.
|
| - * @draft ICU 53
|
| + * @stable ICU 53
|
| */
|
| virtual void setContext(UDisplayContext value, UErrorCode& status);
|
|
|
| -#ifndef U_HIDE_DRAFT_API
|
| /**
|
| * 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
|
| - * @draft ICU 54
|
| + * @stable ICU 54
|
| */
|
| void adoptNumberFormat(NumberFormat *formatToAdopt);
|
|
|
| @@ -1153,17 +1153,16 @@ public:
|
| * @param adoptNF the NumbeferFormat used
|
| * @param status Receives a status code, which will be U_ZERO_ERROR
|
| * if the operation succeeds.
|
| - * @draft ICU 54
|
| + * @stable ICU 54
|
| */
|
| void adoptNumberFormat(const UnicodeString& fields, NumberFormat *formatToAdopt, UErrorCode &status);
|
|
|
| /**
|
| * Get the numbering system to be used for a particular field.
|
| * @param field The UDateFormatField to get
|
| - * @draft ICU 54
|
| + * @stable ICU 54
|
| */
|
| const NumberFormat * getNumberFormatForField(UChar field) const;
|
| -#endif /* U_HIDE_DRAFT_API */
|
|
|
| #ifndef U_HIDE_INTERNAL_API
|
| /**
|
| @@ -1261,6 +1260,7 @@ private:
|
| int32_t fieldNum,
|
| FieldPositionHandler& handler,
|
| Calendar& cal,
|
| + SimpleDateFormatMutableNFs &mutableNFs,
|
| UErrorCode& status) const; // in case of illegal argument
|
|
|
| /**
|
| @@ -1308,14 +1308,6 @@ private:
|
| Calendar *initializeCalendar(TimeZone* adoptZone, const Locale& locale, UErrorCode& status);
|
|
|
| /**
|
| - * initializes fSymbols from parameters.
|
| - * @param locale Locale of the symbols
|
| - * @param calendar Alias to Calendar that will be used.
|
| - * @param status Error code
|
| - */
|
| - void initializeSymbols(const Locale& locale, Calendar* calendar, UErrorCode& status);
|
| -
|
| - /**
|
| * Called by several of the constructors to load pattern data and formatting symbols
|
| * out of a resource bundle and initialize the locale based on it.
|
| * @param timeStyle The time style, as passed to DateFormat::createDateInstance().
|
| @@ -1407,7 +1399,7 @@ private:
|
| */
|
| int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count,
|
| UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
|
| - int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType) const;
|
| + int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs) const;
|
|
|
| void parseInt(const UnicodeString& text,
|
| Formattable& number,
|
| @@ -1483,11 +1475,6 @@ private:
|
| void initNumberFormatters(const Locale &locale,UErrorCode &status);
|
|
|
| /**
|
| - * Get the numbering system to be used for a particular field.
|
| - */
|
| - NumberFormat * getNumberFormatByIndex(UDateFormatField index) const;
|
| -
|
| - /**
|
| * Parse the given override string and set up structures for number formats
|
| */
|
| void processOverrideString(const Locale &locale, const UnicodeString &str, int8_t type, UErrorCode &status);
|
| @@ -1507,6 +1494,8 @@ private:
|
| */
|
| TimeZoneFormat *tzFormat() const;
|
|
|
| + const NumberFormat* getNumberFormatByIndex(UDateFormatField index) const;
|
| +
|
| /**
|
| * Used to map Calendar field to field level.
|
| * The larger the level, the smaller the field unit.
|
| @@ -1514,7 +1503,16 @@ private:
|
| * UCAL_MONTH level is 20.
|
| */
|
| static const int32_t fgCalendarFieldToLevel[];
|
| - static const int32_t fgPatternCharToLevel[];
|
| +
|
| + /**
|
| + * Map calendar field letter into calendar field level.
|
| + */
|
| + static int32_t getLevelFromChar(UChar ch);
|
| +
|
| + /**
|
| + * Tell if a character can be used to define a field in a format string.
|
| + */
|
| + static UBool isSyntaxChar(UChar ch);
|
|
|
| /**
|
| * The formatting pattern for this formatter.
|
| @@ -1563,15 +1561,21 @@ private:
|
| */
|
| /*transient*/ int32_t fDefaultCenturyStartYear;
|
|
|
| - typedef struct NSOverride {
|
| - NumberFormat *nf;
|
| + struct NSOverride : public UMemory {
|
| + const SharedNumberFormat *snf;
|
| int32_t hash;
|
| NSOverride *next;
|
| - } NSOverride;
|
| -
|
| - NumberFormat **fNumberFormatters;
|
| + void free();
|
| + NSOverride() : snf(NULL), hash(0), next(NULL) {
|
| + }
|
| + ~NSOverride();
|
| + };
|
|
|
| - NSOverride *fOverrideList;
|
| + /**
|
| + * The number format in use for each date field. NULL means fall back
|
| + * to fNumberFormat in DateFormat.
|
| + */
|
| + const SharedNumberFormat **fSharedNumberFormatters;
|
|
|
| UBool fHaveDefaultCentury;
|
|
|
|
|