From: Shane Carr Date: Wed, 27 Sep 2017 05:31:57 +0000 (+0000) Subject: ICU-13177 Cleanup before merge to trunk. X-Git-Tag: release-60-rc~98^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d49e73b8a03d12a198384ed031427b46cc7229a;p=icu ICU-13177 Cleanup before merge to trunk. X-SVN-Rev: 40471 --- diff --git a/icu4c/source/common/unicode/localpointer.h b/icu4c/source/common/unicode/localpointer.h index 741f9333bd8..e17ee3d886e 100644 --- a/icu4c/source/common/unicode/localpointer.h +++ b/icu4c/source/common/unicode/localpointer.h @@ -311,41 +311,6 @@ public: } }; -/** - * A version of LocalPointer that allows for implicit copying. - * - * Inside the copy constructor, the pointer is new'd, and the resulting LocalPointer - * adopts the new object. The original LocalPointer is unchanged and continues to own - * its copy of the object. - * - * @see LocalPointer - * @internal - * @deprecated ICU 60 This API is a technical preview. It may change in an upcoming release. - */ -template -class CopyableLocalPointer : public LocalPointer { - public: - // Inherit constructors - using LocalPointer::LocalPointer; - - // Inherited constructors don't include default arguments. Define a default constructor. - CopyableLocalPointer() : LocalPointer(NULL) {}; - - /** - * Creates a new local pointer. This constructor calls T's copy constructor - * and takes ownership of the new object. - * - * If memory allocation fails, the resulting pointer will be null. - */ - CopyableLocalPointer(const CopyableLocalPointer& other) { - if (other.ptr == NULL) { - LocalPointerBase::ptr = NULL; - } else { - LocalPointerBase::ptr = new T(*other.ptr); - } - } -}; - /** * "Smart pointer" class, deletes objects via the C++ array delete[] operator. * For most methods see the LocalPointerBase base class. diff --git a/icu4c/source/i18n/number_affixutils.cpp b/icu4c/source/i18n/number_affixutils.cpp index a412dcc8b7f..48f7c4a7e7b 100644 --- a/icu4c/source/i18n/number_affixutils.cpp +++ b/icu4c/source/i18n/number_affixutils.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "number_affixutils.h" #include "unicode/utf16.h" @@ -393,3 +395,5 @@ bool AffixUtils::hasNext(const AffixTag &tag, const CharSequence &string) { return tag.offset < string.length(); } } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_affixutils.h b/icu4c/source/i18n/number_affixutils.h index 5ff331420ae..9f169fe3a1f 100644 --- a/icu4c/source/i18n/number_affixutils.h +++ b/icu4c/source/i18n/number_affixutils.h @@ -1,8 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_AFFIXPATTERNUTILS_H -#define NUMBERFORMAT_AFFIXPATTERNUTILS_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_AFFIXUTILS_H__ +#define __NUMBER_AFFIXUTILS_H__ #include #include "number_types.h" @@ -213,4 +214,6 @@ class AffixUtils { U_NAMESPACE_END -#endif //NUMBERFORMAT_AFFIXPATTERNUTILS_H +#endif //__NUMBER_AFFIXUTILS_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_compact.cpp b/icu4c/source/i18n/number_compact.cpp index be3abca7013..de01070725a 100644 --- a/icu4c/source/i18n/number_compact.cpp +++ b/icu4c/source/i18n/number_compact.cpp @@ -1,13 +1,15 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "resource.h" #include "number_compact.h" #include "unicode/ustring.h" #include "unicode/ures.h" -#include -#include -#include +#include "cstring.h" +#include "charstr.h" +#include "uresimp.h" using namespace icu::number::impl; @@ -313,3 +315,5 @@ void CompactHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micr // We already performed rounding. Do not perform it again. micros.rounding = Rounder::constructPassThrough(); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_compact.h b/icu4c/source/i18n/number_compact.h index a0de81ffa6c..0810a38e4de 100644 --- a/icu4c/source/i18n/number_compact.h +++ b/icu4c/source/i18n/number_compact.h @@ -1,10 +1,11 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_NUMFMTTER_COMPACT_H -#define NUMBERFORMAT_NUMFMTTER_COMPACT_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_COMPACT_H__ +#define __NUMBER_COMPACT_H__ -#include +#include "standardplural.h" #include "number_types.h" #include "unicode/unum.h" #include "uvector.h" @@ -83,4 +84,6 @@ class CompactHandler : public MicroPropsGenerator, public UMemory { } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_NUMFMTTER_COMPACT_H +#endif //__NUMBER_COMPACT_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_decimalquantity.cpp b/icu4c/source/i18n/number_decimalquantity.cpp index b9ede4117c5..adc5186ba16 100644 --- a/icu4c/source/i18n/number_decimalquantity.cpp +++ b/icu4c/source/i18n/number_decimalquantity.cpp @@ -1,10 +1,12 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include +#if !UCONFIG_NO_FORMATTING + +#include "uassert.h" #include -#include -#include +#include "cmemory.h" +#include "decNumber.h" #include #include "number_decimalquantity.h" #include "decContext.h" @@ -997,3 +999,5 @@ UnicodeString DecimalQuantity::toNumberString() const { delete[] digits; return ret; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_decimalquantity.h b/icu4c/source/i18n/number_decimalquantity.h index e2a6e92022b..dbba35bf8e7 100644 --- a/icu4c/source/i18n/number_decimalquantity.h +++ b/icu4c/source/i18n/number_decimalquantity.h @@ -1,14 +1,15 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_DECIMALQUANTITY_H -#define NUMBERFORMAT_DECIMALQUANTITY_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_DECIMALQUANTITY_H__ +#define __NUMBER_DECIMALQUANTITY_H__ #include -#include -#include -#include -#include +#include "unicode/umachine.h" +#include "decNumber.h" +#include "standardplural.h" +#include "plurrule_impl.h" #include "number_types.h" U_NAMESPACE_BEGIN namespace number { @@ -430,4 +431,6 @@ class DecimalQuantity : public IFixedDecimal, public UMemory { U_NAMESPACE_END -#endif //NUMBERFORMAT_DECIMALQUANTITY_H +#endif //__NUMBER_DECIMALQUANTITY_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_decimfmtprops.cpp b/icu4c/source/i18n/number_decimfmtprops.cpp index f4009024c6f..c5c037c0900 100644 --- a/icu4c/source/i18n/number_decimfmtprops.cpp +++ b/icu4c/source/i18n/number_decimfmtprops.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "number_decimfmtprops.h" using namespace icu::number::impl; @@ -12,7 +14,7 @@ DecimalFormatProperties::DecimalFormatProperties() { void DecimalFormatProperties::clear() { compactStyle.nullify(); currency.nullify(); - currencyPluralInfo.adoptInstead(nullptr); + currencyPluralInfo.fPtr.adoptInstead(nullptr); currencyUsage.nullify(); decimalPatternMatchRequired = false; decimalSeparatorAlwaysShown = false; @@ -54,7 +56,7 @@ bool DecimalFormatProperties::operator==(const DecimalFormatProperties &other) c bool eq = true; eq = eq && compactStyle == other.compactStyle; eq = eq && currency == other.currency; - eq = eq && currencyPluralInfo.getAlias() == other.currencyPluralInfo.getAlias(); + eq = eq && currencyPluralInfo.fPtr.getAlias() == other.currencyPluralInfo.fPtr.getAlias(); eq = eq && currencyUsage == other.currencyUsage; eq = eq && decimalPatternMatchRequired == other.decimalPatternMatchRequired; eq = eq && decimalSeparatorAlwaysShown == other.decimalSeparatorAlwaysShown; @@ -92,3 +94,5 @@ bool DecimalFormatProperties::operator==(const DecimalFormatProperties &other) c eq = eq && signAlwaysShown == other.signAlwaysShown; return eq; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_decimfmtprops.h b/icu4c/source/i18n/number_decimfmtprops.h index 8d8127875dc..e5f405aa0a1 100644 --- a/icu4c/source/i18n/number_decimfmtprops.h +++ b/icu4c/source/i18n/number_decimfmtprops.h @@ -1,13 +1,14 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_PROPERTIES_H -#define NUMBERFORMAT_PROPERTIES_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_DECIMFMTPROPS_H__ +#define __NUMBER_DECIMFMTPROPS_H__ #include "unicode/unistr.h" #include -#include -#include +#include "unicode/plurrule.h" +#include "unicode/currpinf.h" #include "unicode/unum.h" #include "number_types.h" @@ -15,12 +16,24 @@ U_NAMESPACE_BEGIN namespace number { namespace impl { +// TODO: Figure out a nicer way to deal with CurrencyPluralInfo. +struct CurrencyPluralInfoWrapper { + LocalPointer fPtr; + + CurrencyPluralInfoWrapper() {} + CurrencyPluralInfoWrapper(const CurrencyPluralInfoWrapper& other) { + if (!other.fPtr.isNull()) { + fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr)); + } + } +}; + struct DecimalFormatProperties { public: NullableValue compactStyle; NullableValue currency; - CopyableLocalPointer currencyPluralInfo; + CurrencyPluralInfoWrapper currencyPluralInfo; NullableValue currencyUsage; bool decimalPatternMatchRequired; bool decimalSeparatorAlwaysShown; @@ -74,4 +87,6 @@ struct DecimalFormatProperties { U_NAMESPACE_END -#endif //NUMBERFORMAT_PROPERTIES_H +#endif //__NUMBER_DECIMFMTPROPS_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_fluent.cpp b/icu4c/source/i18n/number_fluent.cpp index a486555ff14..3c89153d550 100644 --- a/icu4c/source/i18n/number_fluent.cpp +++ b/icu4c/source/i18n/number_fluent.cpp @@ -1,7 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include +#if !UCONFIG_NO_FORMATTING + +#include "uassert.h" #include "unicode/numberformatter.h" #include "number_decimalquantity.h" #include "number_formatimpl.h" @@ -315,3 +317,5 @@ FormattedNumber::populateFieldPositionIterator(FieldPositionIterator &iterator, FormattedNumber::~FormattedNumber() { delete fResults; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_formatimpl.cpp b/icu4c/source/i18n/number_formatimpl.cpp index 6d337a19ab1..9c1d927d029 100644 --- a/icu4c/source/i18n/number_formatimpl.cpp +++ b/icu4c/source/i18n/number_formatimpl.cpp @@ -1,10 +1,12 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include -#include -#include -#include +#if !UCONFIG_NO_FORMATTING + +#include "cstring.h" +#include "unicode/ures.h" +#include "uresimp.h" +#include "charstr.h" #include "number_formatimpl.h" #include "unicode/numfmt.h" #include "number_patternstring.h" @@ -453,3 +455,5 @@ int32_t NumberFormatterImpl::writeFractionDigits(const MicroProps µs, Decim } return length; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_formatimpl.h b/icu4c/source/i18n/number_formatimpl.h index 59413847be0..0970d4ce486 100644 --- a/icu4c/source/i18n/number_formatimpl.h +++ b/icu4c/source/i18n/number_formatimpl.h @@ -1,8 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_NUMBERFORMATTERIMPL_H -#define NUMBERFORMAT_NUMBERFORMATTERIMPL_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_FORMATIMPL_H__ +#define __NUMBER_FORMATIMPL_H__ #include "number_types.h" #include "number_stringbuilder.h" @@ -117,4 +118,6 @@ class NumberFormatterImpl { U_NAMESPACE_END -#endif //NUMBERFORMAT_NUMBERFORMATTERIMPL_H +#endif //__NUMBER_FORMATIMPL_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_grouping.cpp b/icu4c/source/i18n/number_grouping.cpp index cdab741a084..be24ec9fc7f 100644 --- a/icu4c/source/i18n/number_grouping.cpp +++ b/icu4c/source/i18n/number_grouping.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "unicode/numberformatter.h" #include "number_patternstring.h" @@ -45,3 +47,5 @@ bool Grouper::groupAtPosition(int32_t position, const impl::DecimalQuantity &val return position >= 0 && (position % fGrouping2) == 0 && value.getUpperDisplayMagnitude() - fGrouping1 + 1 >= (fMin2 ? 2 : 1); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_integerwidth.cpp b/icu4c/source/i18n/number_integerwidth.cpp index d5a22ac6807..c5673e3a8f0 100644 --- a/icu4c/source/i18n/number_integerwidth.cpp +++ b/icu4c/source/i18n/number_integerwidth.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "unicode/numberformatter.h" #include "number_types.h" #include "number_decimalquantity.h" @@ -39,3 +41,5 @@ void IntegerWidth::apply(impl::DecimalQuantity &quantity, UErrorCode &status) co quantity.setIntegerLength(fUnion.minMaxInt.fMinInt, fUnion.minMaxInt.fMaxInt); } } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_longnames.cpp b/icu4c/source/i18n/number_longnames.cpp index 458c6fdbcf5..7097df1109a 100644 --- a/icu4c/source/i18n/number_longnames.cpp +++ b/icu4c/source/i18n/number_longnames.cpp @@ -1,13 +1,15 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include -#include -#include -#include +#if !UCONFIG_NO_FORMATTING + +#include "unicode/ures.h" +#include "ureslocs.h" +#include "charstr.h" +#include "uresimp.h" #include "number_longnames.h" #include -#include +#include "cstring.h" using namespace icu::number::impl; @@ -155,3 +157,5 @@ void LongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps &mic micros.rounding.apply(copy, status); micros.modOuter = &fModifiers[copy.getStandardPlural(rules)]; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_longnames.h b/icu4c/source/i18n/number_longnames.h index bda07448a17..67695d00393 100644 --- a/icu4c/source/i18n/number_longnames.h +++ b/icu4c/source/i18n/number_longnames.h @@ -1,8 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_LONGNAMEHANDLER_H -#define NUMBERFORMAT_LONGNAMEHANDLER_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_LONGNAMES_H__ +#define __NUMBER_LONGNAMES_H__ #include "unicode/uversion.h" #include "number_utils.h" @@ -40,4 +41,6 @@ class LongNameHandler : public MicroPropsGenerator, public UObject { } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_LONGNAMEHANDLER_H +#endif //__NUMBER_LONGNAMES_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_modifiers.cpp b/icu4c/source/i18n/number_modifiers.cpp index 98cc894da66..26b87fcdf42 100644 --- a/icu4c/source/i18n/number_modifiers.cpp +++ b/icu4c/source/i18n/number_modifiers.cpp @@ -1,9 +1,11 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include -#include -#include +#if !UCONFIG_NO_FORMATTING + +#include "umutex.h" +#include "ucln_cmn.h" +#include "ucln_in.h" #include "number_modifiers.h" using namespace icu::number::impl; @@ -292,3 +294,5 @@ CurrencySpacingEnabledModifier::getInsertString(const DecimalFormatSymbols &symb UErrorCode &status) { return symbols.getPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, affix == SUFFIX, status); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_modifiers.h b/icu4c/source/i18n/number_modifiers.h index 41637735fe6..2701f1cf2d7 100644 --- a/icu4c/source/i18n/number_modifiers.h +++ b/icu4c/source/i18n/number_modifiers.h @@ -1,14 +1,15 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_MODIFIERS_H -#define NUMBERFORMAT_MODIFIERS_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_MODIFIERS_H__ +#define __NUMBER_MODIFIERS_H__ #include #include -#include -#include -#include +#include "unicode/uniset.h" +#include "unicode/simpleformatter.h" +#include "standardplural.h" #include "number_stringbuilder.h" #include "number_types.h" @@ -246,4 +247,6 @@ class ParameterizedModifier : public UMemory { U_NAMESPACE_END -#endif //NUMBERFORMAT_MODIFIERS_H +#endif //__NUMBER_MODIFIERS_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_notation.cpp b/icu4c/source/i18n/number_notation.cpp index e459742ee9a..6b1d600bfeb 100644 --- a/icu4c/source/i18n/number_notation.cpp +++ b/icu4c/source/i18n/number_notation.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "unicode/numberformatter.h" #include "number_types.h" @@ -66,3 +68,5 @@ ScientificNotation::withExponentSignDisplay(UNumberSignDisplay exponentSignDispl NotationUnion union_ = {settings}; return {NTN_SCIENTIFIC, union_}; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_padding.cpp b/icu4c/source/i18n/number_padding.cpp index 40957950e37..641fc5d00f2 100644 --- a/icu4c/source/i18n/number_padding.cpp +++ b/icu4c/source/i18n/number_padding.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "unicode/numberformatter.h" #include "number_types.h" #include "number_stringbuilder.h" @@ -74,3 +76,5 @@ int32_t Padder::padAndApply(const impl::Modifier &mod1, const impl::Modifier &mo return length; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_patternmodifier.cpp b/icu4c/source/i18n/number_patternmodifier.cpp index 80121d84a75..e4c5fa1ca9f 100644 --- a/icu4c/source/i18n/number_patternmodifier.cpp +++ b/icu4c/source/i18n/number_patternmodifier.cpp @@ -1,7 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include +#if !UCONFIG_NO_FORMATTING + +#include "cstring.h" #include "number_patternmodifier.h" #include "unicode/dcfmtsym.h" #include "unicode/ucurr.h" @@ -340,3 +342,5 @@ UnicodeString MutablePatternModifier::toUnicodeString() const { U_ASSERT(false); return UnicodeString(); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_patternmodifier.h b/icu4c/source/i18n/number_patternmodifier.h index 475b427e12e..0dd26b94c26 100644 --- a/icu4c/source/i18n/number_patternmodifier.h +++ b/icu4c/source/i18n/number_patternmodifier.h @@ -1,10 +1,11 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_MUTABLEPATTERNMODIFIER_H -#define NUMBERFORMAT_MUTABLEPATTERNMODIFIER_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_PATTERNMODIFIER_H__ +#define __NUMBER_PATTERNMODIFIER_H__ -#include +#include "standardplural.h" #include "unicode/numberformatter.h" #include "number_patternstring.h" #include "number_types.h" @@ -231,4 +232,6 @@ class MutablePatternModifier } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_MUTABLEPATTERNMODIFIER_H +#endif //__NUMBER_PATTERNMODIFIER_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_patternstring.cpp b/icu4c/source/i18n/number_patternstring.cpp index 4de385cc94b..e338199afec 100644 --- a/icu4c/source/i18n/number_patternstring.cpp +++ b/icu4c/source/i18n/number_patternstring.cpp @@ -1,7 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include +#if !UCONFIG_NO_FORMATTING + +#include "uassert.h" #include "number_patternstring.h" #include "unicode/utf16.h" #include "number_utils.h" @@ -829,3 +831,5 @@ int PatternStringUtils::escapePaddingString(UnicodeString input, UnicodeString& } return output.length() - startLength; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_patternstring.h b/icu4c/source/i18n/number_patternstring.h index 921f68b7d95..29fd2d6edd7 100644 --- a/icu4c/source/i18n/number_patternstring.h +++ b/icu4c/source/i18n/number_patternstring.h @@ -1,13 +1,14 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_PATTERNPARSER_H -#define NUMBERFORMAT_PATTERNPARSER_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_PATTERNSTRING_H__ +#define __NUMBER_PATTERNSTRING_H__ #include -#include -#include +#include "unicode/unum.h" +#include "unicode/unistr.h" #include "number_types.h" #include "number_decimalquantity.h" #include "number_decimfmtprops.h" @@ -254,4 +255,6 @@ class PatternStringUtils { U_NAMESPACE_END -#endif //NUMBERFORMAT_PATTERNPARSER_H +#endif //__NUMBER_PATTERNSTRING_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_rounding.cpp b/icu4c/source/i18n/number_rounding.cpp index e51158acb19..9aa0378aa8c 100644 --- a/icu4c/source/i18n/number_rounding.cpp +++ b/icu4c/source/i18n/number_rounding.cpp @@ -1,7 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include +#if !UCONFIG_NO_FORMATTING + +#include "uassert.h" #include "unicode/numberformatter.h" #include "number_types.h" #include "number_decimalquantity.h" @@ -338,3 +340,5 @@ void Rounder::apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode /*s U_ASSERT(value.isZero()); value.setFractionLength(fUnion.fracSig.fMinSig - minInt, INT32_MAX); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_roundingutils.h b/icu4c/source/i18n/number_roundingutils.h index 6f68b1ac485..f26dbee835d 100644 --- a/icu4c/source/i18n/number_roundingutils.h +++ b/icu4c/source/i18n/number_roundingutils.h @@ -1,8 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_ROUNDINGUTILS_H -#define NUMBERFORMAT_ROUNDINGUTILS_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_ROUNDINGUTILS_H__ +#define __NUMBER_ROUNDINGUTILS_H__ #include "number_types.h" @@ -133,4 +134,6 @@ inline bool roundsAtMidpoint(int roundingMode) { } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_ROUNDINGUTILS_H +#endif //__NUMBER_ROUNDINGUTILS_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_scientific.cpp b/icu4c/source/i18n/number_scientific.cpp index 8482347417a..db63f854b75 100644 --- a/icu4c/source/i18n/number_scientific.cpp +++ b/icu4c/source/i18n/number_scientific.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include #include "number_scientific.h" #include "number_utils.h" @@ -127,3 +129,5 @@ int32_t ScientificHandler::getMultiplier(int32_t magnitude) const { } return digitsShown - magnitude - 1; } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_scientific.h b/icu4c/source/i18n/number_scientific.h index 77737fe3d2a..6b43a484a83 100644 --- a/icu4c/source/i18n/number_scientific.h +++ b/icu4c/source/i18n/number_scientific.h @@ -1,8 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_NUMFMTTER_SCIENTIFIC_H -#define NUMBERFORMAT_NUMFMTTER_SCIENTIFIC_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_SCIENTIFIC_H__ +#define __NUMBER_SCIENTIFIC_H__ #include "number_types.h" @@ -54,4 +55,6 @@ class ScientificHandler : public UMemory, public MicroPropsGenerator, public Mul } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_NUMFMTTER_SCIENTIFIC_H +#endif //__NUMBER_SCIENTIFIC_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_stringbuilder.cpp b/icu4c/source/i18n/number_stringbuilder.cpp index 32be6a59002..a7ba7e95359 100644 --- a/icu4c/source/i18n/number_stringbuilder.cpp +++ b/icu4c/source/i18n/number_stringbuilder.cpp @@ -1,9 +1,11 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "number_stringbuilder.h" -#include -#include +#include "unicode/utf16.h" +#include "uvectr32.h" using namespace icu::number::impl; @@ -450,3 +452,5 @@ void NumberStringBuilder::populateFieldPositionIterator(FieldPositionIterator &f // Give uvec to the FieldPositionIterator, which adopts it. fpi.setData(uvec.orphan(), status); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_stringbuilder.h b/icu4c/source/i18n/number_stringbuilder.h index aab11ce78cd..ea5da12ab3c 100644 --- a/icu4c/source/i18n/number_stringbuilder.h +++ b/icu4c/source/i18n/number_stringbuilder.h @@ -1,15 +1,16 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_NUMBERSTRINGBUILDER_H -#define NUMBERFORMAT_NUMBERSTRINGBUILDER_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_STRINGBUILDER_H__ +#define __NUMBER_STRINGBUILDER_H__ #include -#include -#include -#include -#include +#include "unicode/numfmt.h" +#include "unicode/ustring.h" +#include "cstring.h" +#include "uassert.h" #include "number_types.h" U_NAMESPACE_BEGIN namespace number { @@ -127,4 +128,6 @@ class NumberStringBuilder : public UMemory { U_NAMESPACE_END -#endif //NUMBERFORMAT_NUMBERSTRINGBUILDER_H +#endif //__NUMBER_STRINGBUILDER_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_types.h b/icu4c/source/i18n/number_types.h index a9d3cab8ab2..eaedb00ad0e 100644 --- a/icu4c/source/i18n/number_types.h +++ b/icu4c/source/i18n/number_types.h @@ -1,16 +1,17 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_INTERNALS_H -#define NUMBERFORMAT_INTERNALS_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_TYPES_H__ +#define __NUMBER_TYPES_H__ #include -#include -#include -#include +#include "unicode/decimfmt.h" +#include "unicode/unum.h" +#include "unicode/numsys.h" #include "unicode/numberformatter.h" -#include -#include +#include "unicode/utf16.h" +#include "uassert.h" U_NAMESPACE_BEGIN namespace number { @@ -279,4 +280,6 @@ class NullableValue { } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_INTERNALS_H +#endif //__NUMBER_TYPES_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/number_utils.h b/icu4c/source/i18n/number_utils.h index 608363628f2..90a8b8ec832 100644 --- a/icu4c/source/i18n/number_utils.h +++ b/icu4c/source/i18n/number_utils.h @@ -1,8 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_NUMFMTTER_UTILS_H -#define NUMBERFORMAT_NUMFMTTER_UTILS_H +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_UTILS_H__ +#define __NUMBER_UTILS_H__ #include "unicode/numberformatter.h" #include "number_types.h" @@ -122,4 +123,6 @@ inline const UnicodeString getDigitFromSymbols(int8_t digit, const DecimalFormat } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_NUMFMTTER_UTILS_H +#endif //__NUMBER_UTILS_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/unicode/fpositer.h b/icu4c/source/i18n/unicode/fpositer.h index 20b7093a290..38ccd8feb30 100644 --- a/icu4c/source/i18n/unicode/fpositer.h +++ b/icu4c/source/i18n/unicode/fpositer.h @@ -47,6 +47,13 @@ U_NAMESPACE_BEGIN class UVector32; +// Forward declaration for number formatting: +namespace number { +namespace impl { +class NumberStringBuilder; +} +} + /** * FieldPositionIterator returns the field ids and their start/limit positions generated * by a call to Format::format. See Format, NumberFormat, DecimalFormat. @@ -98,6 +105,7 @@ public: */ UBool next(FieldPosition& fp); +private: /** * Sets the data used by the iterator, and resets the position. * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid @@ -105,8 +113,8 @@ public: */ void setData(UVector32 *adopt, UErrorCode& status); -private: friend class FieldPositionIteratorHandler; + friend class number::impl::NumberStringBuilder; UVector32 *data; int32_t pos; diff --git a/icu4c/source/i18n/unicode/numberformatter.h b/icu4c/source/i18n/unicode/numberformatter.h index b86bc89fc5b..24dabbee31b 100644 --- a/icu4c/source/i18n/unicode/numberformatter.h +++ b/icu4c/source/i18n/unicode/numberformatter.h @@ -1,17 +1,23 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef NUMBERFORMAT_HEADERS_H -#define NUMBERFORMAT_HEADERS_H - -#include -#include -#include -#include -#include -#include +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBERFORMATTER_H__ +#define __NUMBERFORMATTER_H__ + #include +#include "unicode/appendable.h" +#include "unicode/dcfmtsym.h" +#include "unicode/currunit.h" +#include "unicode/fieldpos.h" +#include "unicode/fpositer.h" +#include "unicode/measunit.h" +#include "unicode/nounit.h" +#include "unicode/plurrule.h" +#include "unicode/ucurr.h" +#include "unicode/unum.h" + /** * An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123 * meters in en-CA: @@ -1821,4 +1827,6 @@ class NumberFormatter final { } // namespace number U_NAMESPACE_END -#endif //NUMBERFORMAT_HEADERS_H +#endif // __NUMBERFORMATTER_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest.h b/icu4c/source/test/intltest/numbertest.h index 39f07ec2b3a..ec07d9784fd 100644 --- a/icu4c/source/test/intltest/numbertest.h +++ b/icu4c/source/test/intltest/numbertest.h @@ -1,6 +1,7 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING #pragma once #include "number_stringbuilder.h" @@ -195,3 +196,5 @@ class NumberTest : public IntlTest { } } }; + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest_affixutils.cpp b/icu4c/source/test/intltest/numbertest_affixutils.cpp index aefa3513010..c0337a67af5 100644 --- a/icu4c/source/test/intltest/numbertest_affixutils.cpp +++ b/icu4c/source/test/intltest/numbertest_affixutils.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "putilimp.h" #include "unicode/dcfmtsym.h" #include "numbertest.h" @@ -240,3 +242,5 @@ UnicodeString AffixUtilsTest::unescapeWithDefaults(const SymbolProvider &default assertEquals("Return value of unescape", nsb.length(), length); return nsb.toUnicodeString(); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest_api.cpp b/icu4c/source/test/intltest/numbertest_api.cpp index 905867afab4..7ada621824e 100644 --- a/icu4c/source/test/intltest/numbertest_api.cpp +++ b/icu4c/source/test/intltest/numbertest_api.cpp @@ -1,9 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#define TEMP_TEST_HELPERS_NO_PRINT_PASS 1 +#if !UCONFIG_NO_FORMATTING -#include +#include "charstr.h" #include #include "unicode/unum.h" #include "unicode/numberformatter.h" @@ -1484,3 +1484,5 @@ void NumberFormatterApiTest::assertFormatSingle(const UnicodeString &message, assertSuccess(message + u": Safe Path", status); assertEquals(message + u": Safe Path", expected, actual2); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest_decimalquantity.cpp b/icu4c/source/test/intltest/numbertest_decimalquantity.cpp index 61290b067b1..d863c587489 100644 --- a/icu4c/source/test/intltest/numbertest_decimalquantity.cpp +++ b/icu4c/source/test/intltest/numbertest_decimalquantity.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "number_decimalquantity.h" #include "math.h" #include @@ -253,3 +255,5 @@ void DecimalQuantityTest::testUseApproximateDoubleWhenAble() { } } } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest_modifiers.cpp b/icu4c/source/test/intltest/numbertest_modifiers.cpp index 8df30565454..3605fc60df8 100644 --- a/icu4c/source/test/intltest/numbertest_modifiers.cpp +++ b/icu4c/source/test/intltest/numbertest_modifiers.cpp @@ -1,7 +1,9 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include +#if !UCONFIG_NO_FORMATTING + +#include "putilimp.h" #include "intltest.h" #include "number_stringbuilder.h" #include "number_modifiers.h" @@ -172,3 +174,5 @@ void ModifiersTest::assertModifierEquals(const Modifier &mod, NumberStringBuilde debugString.append(u"]>"); assertEquals("Debug string", debugString, sb.toDebugString()); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest_patternmodifier.cpp b/icu4c/source/test/intltest/numbertest_patternmodifier.cpp index 4e34597ffe1..32eaba901f3 100644 --- a/icu4c/source/test/intltest/numbertest_patternmodifier.cpp +++ b/icu4c/source/test/intltest/numbertest_patternmodifier.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "numbertest.h" #include "number_patternmodifier.h" @@ -118,3 +120,5 @@ UnicodeString PatternModifierTest::getSuffix(const MutablePatternModifier &mod, int32_t prefixLength = mod.getPrefixLength(status); return UnicodeString(nsb.toUnicodeString(), prefixLength, nsb.length() - prefixLength); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest_patternstring.cpp b/icu4c/source/test/intltest/numbertest_patternstring.cpp index 7efd938094f..12cb3bd68ae 100644 --- a/icu4c/source/test/intltest/numbertest_patternstring.cpp +++ b/icu4c/source/test/intltest/numbertest_patternstring.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "numbertest.h" #include "number_patternstring.h" @@ -86,3 +88,5 @@ void PatternStringTest::testBug13117() { assertSuccess("Spot 1", status); assertTrue("Should not consume negative subpattern", expected == actual); } + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numbertest_stringbuilder.cpp b/icu4c/source/test/intltest/numbertest_stringbuilder.cpp index d6a87152af6..d389dab66e0 100644 --- a/icu4c/source/test/intltest/numbertest_stringbuilder.cpp +++ b/icu4c/source/test/intltest/numbertest_stringbuilder.cpp @@ -1,6 +1,8 @@ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#if !UCONFIG_NO_FORMATTING + #include "putilimp.h" #include "numbertest.h" @@ -229,3 +231,5 @@ void NumberStringBuilderTest::assertEqualsImpl(const UnicodeString &a, const Num UnicodeString(" in string ") + a, a.charAt(i), b.charAt(i)); } } + +#endif /* #if !UCONFIG_NO_FORMATTING */