ICU-13177 Cleanup before merge to trunk.

X-SVN-Rev: 40471
This commit is contained in:
Shane Carr 2017-09-27 05:31:57 +00:00
parent 93d9dc3fe2
commit 2d49e73b8a
42 changed files with 271 additions and 139 deletions

View file

@ -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<typename T>
class CopyableLocalPointer : public LocalPointer<T> {
public:
// Inherit constructors
using LocalPointer<T>::LocalPointer;
// Inherited constructors don't include default arguments. Define a default constructor.
CopyableLocalPointer() : LocalPointer<T>(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<T>& other) {
if (other.ptr == NULL) {
LocalPointerBase<T>::ptr = NULL;
} else {
LocalPointerBase<T>::ptr = new T(*other.ptr);
}
}
};
/**
* "Smart pointer" class, deletes objects via the C++ array delete[] operator.
* For most methods see the LocalPointerBase base class.

View file

@ -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 */

View file

@ -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 <cstdint>
#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 */

View file

@ -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 <cstring>
#include <charstr.h>
#include <uresimp.h>
#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 */

View file

@ -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 <standardplural.h>
#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 */

View file

@ -1,10 +1,12 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <uassert.h>
#if !UCONFIG_NO_FORMATTING
#include "uassert.h"
#include <cmath>
#include <cmemory.h>
#include <decNumber.h>
#include "cmemory.h"
#include "decNumber.h"
#include <limits>
#include "number_decimalquantity.h"
#include "decContext.h"
@ -997,3 +999,5 @@ UnicodeString DecimalQuantity::toNumberString() const {
delete[] digits;
return ret;
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -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 <cstdint>
#include <unicode/umachine.h>
#include <decNumber.h>
#include <standardplural.h>
#include <plurrule_impl.h>
#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 */

View file

@ -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 */

View file

@ -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 <cstdint>
#include <unicode/plurrule.h>
#include <unicode/currpinf.h>
#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<CurrencyPluralInfo> fPtr;
CurrencyPluralInfoWrapper() {}
CurrencyPluralInfoWrapper(const CurrencyPluralInfoWrapper& other) {
if (!other.fPtr.isNull()) {
fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr));
}
}
};
struct DecimalFormatProperties {
public:
NullableValue<UNumberCompactStyle> compactStyle;
NullableValue<CurrencyUnit> currency;
CopyableLocalPointer <CurrencyPluralInfo> currencyPluralInfo;
CurrencyPluralInfoWrapper currencyPluralInfo;
NullableValue<UCurrencyUsage> 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 */

View file

@ -1,7 +1,9 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <uassert.h>
#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 */

View file

@ -1,10 +1,12 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <cstring.h>
#include <unicode/ures.h>
#include <uresimp.h>
#include <charstr.h>
#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 &micros, Decim
}
return length;
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -1,13 +1,15 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <unicode/ures.h>
#include <ureslocs.h>
#include <charstr.h>
#include <uresimp.h>
#if !UCONFIG_NO_FORMATTING
#include "unicode/ures.h"
#include "ureslocs.h"
#include "charstr.h"
#include "uresimp.h"
#include "number_longnames.h"
#include <algorithm>
#include <cstring.h>
#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 */

View file

@ -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 */

View file

@ -1,9 +1,11 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <umutex.h>
#include <ucln_cmn.h>
#include <ucln_in.h>
#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 */

View file

@ -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 <algorithm>
#include <cstdint>
#include <unicode/uniset.h>
#include <unicode/simpleformatter.h>
#include <standardplural.h>
#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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -1,7 +1,9 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <cstring.h>
#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 */

View file

@ -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 <standardplural.h>
#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 */

View file

@ -1,7 +1,9 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <uassert.h>
#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 */

View file

@ -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 <cstdint>
#include <unicode/unum.h>
#include <unicode/unistr.h>
#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 */

View file

@ -1,7 +1,9 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <uassert.h>
#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 */

View file

@ -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 */

View file

@ -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 <cstdlib>
#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 */

View file

@ -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 */

View file

@ -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 <unicode/utf16.h>
#include <uvectr32.h>
#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 */

View file

@ -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 <cstdint>
#include <unicode/numfmt.h>
#include <unicode/ustring.h>
#include <cstring>
#include <uassert.h>
#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 */

View file

@ -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 <cstdint>
#include <unicode/decimfmt.h>
#include <unicode/unum.h>
#include <unicode/numsys.h>
#include "unicode/decimfmt.h"
#include "unicode/unum.h"
#include "unicode/numsys.h"
#include "unicode/numberformatter.h"
#include <unicode/utf16.h>
#include <uassert.h>
#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 */

View file

@ -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 */

View file

@ -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;

View file

@ -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
#if !UCONFIG_NO_FORMATTING
#ifndef __NUMBERFORMATTER_H__
#define __NUMBERFORMATTER_H__
#include <unicode/decimfmt.h>
#include <unicode/measunit.h>
#include <unicode/measfmt.h>
#include <unicode/ucurr.h>
#include <unicode/appendable.h>
#include <unicode/nounit.h>
#include <atomic>
#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 <em>en-CA</em>:
@ -1821,4 +1827,6 @@ class NumberFormatter final {
} // namespace number
U_NAMESPACE_END
#endif //NUMBERFORMAT_HEADERS_H
#endif // __NUMBERFORMATTER_H__
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 <charstr.h>
#include "charstr.h"
#include <cstdarg>
#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 */

View file

@ -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 <cmath>
@ -253,3 +255,5 @@ void DecimalQuantityTest::testUseApproximateDoubleWhenAble() {
}
}
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -1,7 +1,9 @@
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <putilimp.h>
#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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */