class TimeZoneFormat;
class SharedNumberFormat;
class SimpleDateFormatMutableNFs;
+class DateIntervalFormat;
+
+namespace number {
+class LocalizedNumberFormatter;
+}
/**
*
* 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);
* 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
private:
friend class DateFormat;
+ friend class DateIntervalFormat;
void initializeDefaultCentury(void);
int32_t fieldNum,
FieldPositionHandler& handler,
Calendar& cal,
- SimpleDateFormatMutableNFs &mutableNFs,
UErrorCode& status) const; // in case of illegal argument
/**
* @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,
*/
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;
*/
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.
*/
/**
* Lazy TimeZoneFormat instantiation, semantically const
*/
- TimeZoneFormat *tzFormat() const;
+ TimeZoneFormat *tzFormat(UErrorCode &status) const;
const NumberFormat* getNumberFormatByIndex(UDateFormatField index) const;
*/
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;