+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
-* Copyright (C) 1997-2014, International Business Machines Corporation and
+* Copyright (C) 1997-2015, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
gLastResortCurrencyPat, // UNUM_CASH_CURRENCY
NULL, // UNUM_DECIMAL_COMPACT_SHORT
NULL, // UNUM_DECIMAL_COMPACT_LONG
+ gLastResortCurrencyPat, // UNUM_CURRENCY_STANDARD
};
// Keys used for accessing resource bundles
"currencyFormat", // UNUM_CASH_CURRENCY
NULL, // UNUM_DECIMAL_COMPACT_SHORT
NULL, // UNUM_DECIMAL_COMPACT_LONG
+ "currencyFormat", // UNUM_CURRENCY_STANDARD
};
// Static hashtable cache of NumberingSystem objects used by NumberFormat
fMaxFractionDigits = rhs.fMaxFractionDigits;
fMinFractionDigits = rhs.fMinFractionDigits;
fParseIntegerOnly = rhs.fParseIntegerOnly;
- u_strncpy(fCurrency, rhs.fCurrency, 4);
+ u_strncpy(fCurrency, rhs.fCurrency, 3);
+ fCurrency[3] = 0;
fLenient = rhs.fLenient;
fCapitalizationContext = rhs.fCapitalizationContext;
}
// XXXFormat::format(double
UnicodeString&
-NumberFormat::format(const StringPiece &decimalNum,
+NumberFormat::format(StringPiece decimalNum,
UnicodeString& toAppendTo,
FieldPositionIterator* fpi,
UErrorCode& status) const
FieldPositionIterator* posIter,
UErrorCode& status) const {
// DecimalFormat overrides this function, and handles DigitList based big decimals.
- // Other subclasses (ChoiceFormat, RuleBasedNumberFormat) do not (yet) handle DigitLists,
+ // Other subclasses (ChoiceFormat) do not (yet) handle DigitLists,
// so this default implementation falls back to formatting decimal numbers as doubles.
if (U_FAILURE(status)) {
return appendTo;
FieldPosition& pos,
UErrorCode &status) const {
// DecimalFormat overrides this function, and handles DigitList based big decimals.
- // Other subclasses (ChoiceFormat, RuleBasedNumberFormat) do not (yet) handle DigitLists,
+ // Other subclasses (ChoiceFormat) do not (yet) handle DigitLists,
// so this default implementation falls back to formatting decimal numbers as doubles.
if (U_FAILURE(status)) {
return appendTo;
UnicodeString&
NumberFormat::format(double number, UnicodeString& appendTo) const
{
- FieldPosition pos(0);
+ FieldPosition pos(FieldPosition::DONT_CARE);
return format(number, appendTo, pos);
}
UnicodeString&
NumberFormat::format(int32_t number, UnicodeString& appendTo) const
{
- FieldPosition pos(0);
+ FieldPosition pos(FieldPosition::DONT_CARE);
return format(number, appendTo, pos);
}
UnicodeString&
NumberFormat::format(int64_t number, UnicodeString& appendTo) const
{
- FieldPosition pos(0);
+ FieldPosition pos(FieldPosition::DONT_CARE);
return format(number, appendTo, pos);
}
}
}
-const UChar* NumberFormat::getCurrency() const {
+const char16_t* NumberFormat::getCurrency() const {
return fCurrency;
}
case UNUM_CURRENCY_PLURAL:
case UNUM_CURRENCY_ACCOUNTING:
case UNUM_CASH_CURRENCY:
+ case UNUM_CURRENCY_STANDARD:
f = new Win32NumberFormat(desiredLocale, curr, status);
if (U_SUCCESS(status)) {
return NULL;
}
if(style==UNUM_CURRENCY || style == UNUM_CURRENCY_ISO || style == UNUM_CURRENCY_ACCOUNTING
- || style == UNUM_CASH_CURRENCY){
+ || style == UNUM_CASH_CURRENCY || style == UNUM_CURRENCY_STANDARD){
const UChar* currPattern = symbolsToAdopt->getCurrencyPattern();
if(currPattern!=NULL){
pattern.setTo(currPattern, u_strlen(currPattern));
return f;
}
+/**
+ * Get the rounding mode.
+ * @return A rounding mode
+ */
+NumberFormat::ERoundingMode NumberFormat::getRoundingMode() const {
+ // Default value. ICU4J throws an exception and we can't change this API.
+ return NumberFormat::ERoundingMode::kRoundUnnecessary;
+}
+
+/**
+ * Set the rounding mode. This has no effect unless the rounding
+ * increment is greater than zero.
+ * @param roundingMode A rounding mode
+ */
+void NumberFormat::setRoundingMode(NumberFormat::ERoundingMode /*roundingMode*/) {
+ // No-op ICU4J throws an exception, and we can't change this API.
+}
+
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */