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 MeasureFormat::initMeasureFormat( const Locale &locale, UMeasureFormatWidth w, NumberFormat *nfToAdopt, UErrorCode &status) { static const char *listStyles[] = {"unit", "unit-short", "unit-narrow"}; LocalPointer<NumberFormat> nf(nfToAdopt); if (U_FAILURE(status)) { return; } const char *name = locale.getName(); setLocaleIDs(name, name); UnifiedCache::getByLocale(locale, cache, status); if (U_FAILURE(status)) { return; } const SharedPluralRules *pr = PluralRules::createSharedInstance( locale, UPLURAL_TYPE_CARDINAL, status); if (U_FAILURE(status)) { return; } SharedObject::copyPtr(pr, pluralRules); pr->removeRef(); if (nf.isNull()) { const SharedNumberFormat *shared = NumberFormat::createSharedInstance( locale, UNUM_DECIMAL, status); if (U_FAILURE(status)) { return; } SharedObject::copyPtr(shared, numberFormat); shared->removeRef(); } else { adoptNumberFormat(nf.orphan(), status); if (U_FAILURE(status)) { return; } } fWidth = w; delete listFormatter; listFormatter = ListFormatter::createInstance( locale, listStyles[getRegularWidth(fWidth)], status); }
void DateFormat::setNumberFormat(const NumberFormat& newNumberFormat) { adoptNumberFormat((NumberFormat*)newNumberFormat.clone()); }