From: Peter Edberg Date: Wed, 12 Mar 2014 02:44:16 +0000 (+0000) Subject: ICU-5186 to address review comments, reformat & delete commented-out line X-Git-Tag: milestone-59-0-1~2025 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1def0575b8cc31afacff2d20c685a887a583793b;p=icu ICU-5186 to address review comments, reformat & delete commented-out line X-SVN-Rev: 35425 --- diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index 12f5e70548c..919f659fb02 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -814,7 +814,6 @@ DecimalFormat::operator=(const DecimalFormat& rhs) fUseSignificantDigits = rhs.fUseSignificantDigits; fFormatPattern = rhs.fFormatPattern; fStyle = rhs.fStyle; - //fCurrencySignCount = rhs.fCurrencySignCount; // duplicates line above _clone_ptr(&fCurrencyPluralInfo, rhs.fCurrencyPluralInfo); deleteHashForAffixPattern(); if (rhs.fAffixPatternsForCurrency) { @@ -1032,55 +1031,68 @@ DecimalFormat::operator==(const Format& that) const } #endif - return (NumberFormat::operator==(that) && - ((fCurrencySignCount == fgCurrencySignCountInPluralFormat) ? - (fAffixPatternsForCurrency->equals(*other->fAffixPatternsForCurrency)) : - (((fPosPrefixPattern == other->fPosPrefixPattern && // both null - fPositivePrefix == other->fPositivePrefix) - || (fPosPrefixPattern != 0 && other->fPosPrefixPattern != 0 && - *fPosPrefixPattern == *other->fPosPrefixPattern)) && - ((fPosSuffixPattern == other->fPosSuffixPattern && // both null - fPositiveSuffix == other->fPositiveSuffix) - || (fPosSuffixPattern != 0 && other->fPosSuffixPattern != 0 && - *fPosSuffixPattern == *other->fPosSuffixPattern)) && - ((fNegPrefixPattern == other->fNegPrefixPattern && // both null - fNegativePrefix == other->fNegativePrefix) - || (fNegPrefixPattern != 0 && other->fNegPrefixPattern != 0 && - *fNegPrefixPattern == *other->fNegPrefixPattern)) && - ((fNegSuffixPattern == other->fNegSuffixPattern && // both null - fNegativeSuffix == other->fNegativeSuffix) - || (fNegSuffixPattern != 0 && other->fNegSuffixPattern != 0 && - *fNegSuffixPattern == *other->fNegSuffixPattern)))) && - ((fRoundingIncrement == other->fRoundingIncrement) // both null - || (fRoundingIncrement != NULL && - other->fRoundingIncrement != NULL && - *fRoundingIncrement == *other->fRoundingIncrement)) && + return ( + NumberFormat::operator==(that) && + + ((fCurrencySignCount == fgCurrencySignCountInPluralFormat) ? + (fAffixPatternsForCurrency->equals(*other->fAffixPatternsForCurrency)) : + (((fPosPrefixPattern == other->fPosPrefixPattern && // both null + fPositivePrefix == other->fPositivePrefix) + || (fPosPrefixPattern != 0 && other->fPosPrefixPattern != 0 && + *fPosPrefixPattern == *other->fPosPrefixPattern)) && + ((fPosSuffixPattern == other->fPosSuffixPattern && // both null + fPositiveSuffix == other->fPositiveSuffix) + || (fPosSuffixPattern != 0 && other->fPosSuffixPattern != 0 && + *fPosSuffixPattern == *other->fPosSuffixPattern)) && + ((fNegPrefixPattern == other->fNegPrefixPattern && // both null + fNegativePrefix == other->fNegativePrefix) + || (fNegPrefixPattern != 0 && other->fNegPrefixPattern != 0 && + *fNegPrefixPattern == *other->fNegPrefixPattern)) && + ((fNegSuffixPattern == other->fNegSuffixPattern && // both null + fNegativeSuffix == other->fNegativeSuffix) + || (fNegSuffixPattern != 0 && other->fNegSuffixPattern != 0 && + *fNegSuffixPattern == *other->fNegSuffixPattern)))) && + + ((fRoundingIncrement == other->fRoundingIncrement) // both null + || (fRoundingIncrement != NULL && + other->fRoundingIncrement != NULL && + *fRoundingIncrement == *other->fRoundingIncrement)) && + fRoundingMode == other->fRoundingMode && getMultiplier() == other->getMultiplier() && fGroupingSize == other->fGroupingSize && fGroupingSize2 == other->fGroupingSize2 && fDecimalSeparatorAlwaysShown == other->fDecimalSeparatorAlwaysShown && fUseExponentialNotation == other->fUseExponentialNotation && + (!fUseExponentialNotation || (fMinExponentDigits == other->fMinExponentDigits && fExponentSignAlwaysShown == other->fExponentSignAlwaysShown)) && + fBoolFlags.getAll() == other->fBoolFlags.getAll() && *fSymbols == *(other->fSymbols) && fUseSignificantDigits == other->fUseSignificantDigits && + (!fUseSignificantDigits || (fMinSignificantDigits == other->fMinSignificantDigits && fMaxSignificantDigits == other->fMaxSignificantDigits)) && + fFormatWidth == other->fFormatWidth && fPad == other->fPad && fPadPosition == other->fPadPosition && + (fStyle != UNUM_CURRENCY_PLURAL || (fStyle == other->fStyle && fFormatPattern == other->fFormatPattern)) && + fCurrencySignCount == other->fCurrencySignCount && + ((fCurrencyPluralInfo == other->fCurrencyPluralInfo && fCurrencyPluralInfo == NULL) || (fCurrencyPluralInfo != NULL && other->fCurrencyPluralInfo != NULL && - *fCurrencyPluralInfo == *(other->fCurrencyPluralInfo)))); + *fCurrencyPluralInfo == *(other->fCurrencyPluralInfo))) + // depending on other settings we may also need to compare // fCurrencyChoice (mostly deprecated?), // fAffixesForCurrency & fPluralAffixesForCurrency (only relevant in some cases) + ); } //------------------------------------------------------------------------------