"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "source/i18n/number_formatimpl.cpp" between
icu4c-67rc-src.tgz and icu4c-67_1-src.tgz

About: ICU (International Components for Unicode) is a set of C/C++ and Java libraries providing Unicode and Globalization support for software applications on a wide variety of platforms.

number_formatimpl.cpp  (icu4c-67rc-src.tgz):number_formatimpl.cpp  (icu4c-67_1-src.tgz)
skipping to change at line 204 skipping to change at line 204
} else if (!isCurrency || unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) { } else if (!isCurrency || unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) {
patternStyle = CLDR_PATTERN_STYLE_DECIMAL; patternStyle = CLDR_PATTERN_STYLE_DECIMAL;
} else if (isAccounting) { } else if (isAccounting) {
// NOTE: Although ACCOUNTING and ACCOUNTING_ALWAYS are only supporte d in currencies right now, // NOTE: Although ACCOUNTING and ACCOUNTING_ALWAYS are only supporte d in currencies right now,
// the API contract allows us to add support to other units in the f uture. // the API contract allows us to add support to other units in the f uture.
patternStyle = CLDR_PATTERN_STYLE_ACCOUNTING; patternStyle = CLDR_PATTERN_STYLE_ACCOUNTING;
} else { } else {
patternStyle = CLDR_PATTERN_STYLE_CURRENCY; patternStyle = CLDR_PATTERN_STYLE_CURRENCY;
} }
pattern = utils::getPatternForStyle(macros.locale, nsName, patternStyle, status); pattern = utils::getPatternForStyle(macros.locale, nsName, patternStyle, status);
if (U_FAILURE(status)) {
return nullptr;
}
} }
auto patternInfo = new ParsedPatternInfo(); auto patternInfo = new ParsedPatternInfo();
if (patternInfo == nullptr) { if (patternInfo == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR; status = U_MEMORY_ALLOCATION_ERROR;
return nullptr; return nullptr;
} }
fPatternInfo.adoptInstead(patternInfo); fPatternInfo.adoptInstead(patternInfo);
PatternParser::parseToPatternInfo(UnicodeString(pattern), *patternInfo, stat us); PatternParser::parseToPatternInfo(UnicodeString(pattern), *patternInfo, stat us);
if (U_FAILURE(status)) {
return nullptr;
}
//////////////////////////////////////////////////////////////////////////// ///////// //////////////////////////////////////////////////////////////////////////// /////////
/// START POPULATING THE DEFAULT MICROPROPS AND BUILDING THE MICROPROPS GENE RATOR /// /// START POPULATING THE DEFAULT MICROPROPS AND BUILDING THE MICROPROPS GENE RATOR ///
//////////////////////////////////////////////////////////////////////////// ///////// //////////////////////////////////////////////////////////////////////////// /////////
// Multiplier // Multiplier
if (macros.scale.isValid()) { if (macros.scale.isValid()) {
fMicros.helpers.multiplier.setAndChain(macros.scale, chain); fMicros.helpers.multiplier.setAndChain(macros.scale, chain);
chain = &fMicros.helpers.multiplier; chain = &fMicros.helpers.multiplier;
} }
skipping to change at line 242 skipping to change at line 248
precision = Precision::maxFraction(6); precision = Precision::maxFraction(6);
} }
UNumberFormatRoundingMode roundingMode; UNumberFormatRoundingMode roundingMode;
if (macros.roundingMode != kDefaultMode) { if (macros.roundingMode != kDefaultMode) {
roundingMode = macros.roundingMode; roundingMode = macros.roundingMode;
} else { } else {
// Temporary until ICU 64 // Temporary until ICU 64
roundingMode = precision.fRoundingMode; roundingMode = precision.fRoundingMode;
} }
fMicros.rounder = {precision, roundingMode, currency, status}; fMicros.rounder = {precision, roundingMode, currency, status};
if (U_FAILURE(status)) {
return nullptr;
}
// Grouping strategy // Grouping strategy
if (!macros.grouper.isBogus()) { if (!macros.grouper.isBogus()) {
fMicros.grouping = macros.grouper; fMicros.grouping = macros.grouper;
} else if (macros.notation.fType == Notation::NTN_COMPACT) { } else if (macros.notation.fType == Notation::NTN_COMPACT) {
// Compact notation uses minGrouping by default since ICU 59 // Compact notation uses minGrouping by default since ICU 59
fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_MIN2); fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_MIN2);
} else { } else {
fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_AUTO); fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_AUTO);
} }
skipping to change at line 324 skipping to change at line 333
currency, currency,
unitWidth, unitWidth,
resolvePluralRules(macros.rules, macros.locale, status), resolvePluralRules(macros.rules, macros.locale, status),
status); status);
} else { } else {
patternModifier->setSymbols(fMicros.symbols, currency, unitWidth, nullpt r, status); patternModifier->setSymbols(fMicros.symbols, currency, unitWidth, nullpt r, status);
} }
if (safe) { if (safe) {
fImmutablePatternModifier.adoptInstead(patternModifier->createImmutable( status)); fImmutablePatternModifier.adoptInstead(patternModifier->createImmutable( status));
} }
if (U_FAILURE(status)) {
return nullptr;
}
// Outer modifier (CLDR units and currency long names) // Outer modifier (CLDR units and currency long names)
if (isCldrUnit) { if (isCldrUnit) {
fLongNameHandler.adoptInstead( fLongNameHandler.adoptInstead(
LongNameHandler::forMeasureUnit( LongNameHandler::forMeasureUnit(
macros.locale, macros.locale,
macros.unit, macros.unit,
macros.perUnit, macros.perUnit,
unitWidth, unitWidth,
resolvePluralRules(macros.rules, macros.locale, status), resolvePluralRules(macros.rules, macros.locale, status),
skipping to change at line 350 skipping to change at line 362
macros.locale, macros.locale,
currency, currency,
resolvePluralRules(macros.rules, macros.locale, status), resolvePluralRules(macros.rules, macros.locale, status),
chain, chain,
status)); status));
chain = fLongNameHandler.getAlias(); chain = fLongNameHandler.getAlias();
} else { } else {
// No outer modifier required // No outer modifier required
fMicros.modOuter = &fMicros.helpers.emptyWeakModifier; fMicros.modOuter = &fMicros.helpers.emptyWeakModifier;
} }
if (U_FAILURE(status)) {
return nullptr;
}
// Compact notation // Compact notation
if (macros.notation.fType == Notation::NTN_COMPACT) { if (macros.notation.fType == Notation::NTN_COMPACT) {
CompactType compactType = (isCurrency && unitWidth != UNUM_UNIT_WIDTH_FU LL_NAME) CompactType compactType = (isCurrency && unitWidth != UNUM_UNIT_WIDTH_FU LL_NAME)
? CompactType::TYPE_CURRENCY : CompactType::TY PE_DECIMAL; ? CompactType::TYPE_CURRENCY : CompactType::TY PE_DECIMAL;
auto newCompactHandler = new CompactHandler( auto newCompactHandler = new CompactHandler(
macros.notation.fUnion.compactStyle, macros.notation.fUnion.compactStyle,
macros.locale, macros.locale,
nsName, nsName,
compactType, compactType,
skipping to change at line 372 skipping to change at line 387
safe, safe,
chain, chain,
status); status);
if (newCompactHandler == nullptr) { if (newCompactHandler == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR; status = U_MEMORY_ALLOCATION_ERROR;
return nullptr; return nullptr;
} }
fCompactHandler.adoptInstead(newCompactHandler); fCompactHandler.adoptInstead(newCompactHandler);
chain = fCompactHandler.getAlias(); chain = fCompactHandler.getAlias();
} }
if (U_FAILURE(status)) {
return nullptr;
}
// Always add the pattern modifier as the last element of the chain. // Always add the pattern modifier as the last element of the chain.
if (safe) { if (safe) {
fImmutablePatternModifier->addToChain(chain); fImmutablePatternModifier->addToChain(chain);
chain = fImmutablePatternModifier.getAlias(); chain = fImmutablePatternModifier.getAlias();
} else { } else {
patternModifier->addToChain(chain); patternModifier->addToChain(chain);
chain = patternModifier; chain = patternModifier;
} }
 End of changes. 6 change blocks. 
0 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)