virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType) { if (formatType == UNUM_CURRENCY) { return (NumberFormat*)currencyStyle->clone(); } return NULL; }
void TimeUnitFormat::setNumberFormat(const NumberFormat& format, UErrorCode& status){ if (U_FAILURE(status)) { return; } adoptNumberFormat((NumberFormat *)format.clone(), status); }
void DateFormat::setNumberFormat(const NumberFormat& newNumberFormat) { NumberFormat* newNumFmtClone = (NumberFormat*)newNumberFormat.clone(); if (newNumFmtClone != NULL) { adoptNumberFormat(newNumFmtClone); } }
void TimeUnitFormat::setNumberFormat(const NumberFormat& format, UErrorCode& status){ if (U_FAILURE(status) || (fNumberFormat && format == *fNumberFormat)) { return; } delete fNumberFormat; fNumberFormat = (NumberFormat*)format.clone(); // reset the number formatter in the fTimeUnitToCountToPatterns map for (TimeUnit::UTimeUnitFields i = TimeUnit::UTIMEUNIT_YEAR; i < TimeUnit::UTIMEUNIT_FIELD_COUNT; i = (TimeUnit::UTimeUnitFields)(i+1)) { int32_t pos = -1; const UHashElement* elem = NULL; while ((elem = fTimeUnitToCountToPatterns[i]->nextElement(pos)) != NULL){ const UHashTok keyTok = elem->value; MessageFormat** pattern = (MessageFormat**)keyTok.pointer; pattern[kFull]->setFormat(0, format); pattern[kAbbreviate]->setFormat(0, format); } } }
void DateFormat::setNumberFormat(const NumberFormat& newNumberFormat) { adoptNumberFormat((NumberFormat*)newNumberFormat.clone()); }