/*
*******************************************************************************
-* Copyright (C) 1996-2014, International Business Machines
+* Copyright (C) 1996-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* Modification History:
#include "unicode/numfmt.h"
#include "unicode/decimfmt.h"
#include "unicode/rbnf.h"
+#include "unicode/compactdecimalformat.h"
#include "unicode/ustring.h"
#include "unicode/fmtable.h"
#include "unicode/dcfmtsym.h"
case UNUM_CURRENCY_ISO:
case UNUM_CURRENCY_PLURAL:
case UNUM_CURRENCY_ACCOUNTING:
+ case UNUM_CASH_CURRENCY:
+ case UNUM_CURRENCY_STANDARD:
retVal = NumberFormat::createInstance(Locale(locale), style, *status);
break;
break;
#endif
+ case UNUM_DECIMAL_COMPACT_SHORT:
+ retVal = CompactDecimalFormat::createInstance(Locale(locale), UNUM_SHORT, *status);
+ break;
+
+ case UNUM_DECIMAL_COMPACT_LONG:
+ retVal = CompactDecimalFormat::createInstance(Locale(locale), UNUM_LONG, *status);
+ break;
+
default:
*status = U_UNSUPPORTED_ERROR;
return NULL;
if(pos != 0)
fp.setField(pos->field);
- ((const NumberFormat*)fmt)->format(number, res, fp, *status);
+ const CompactDecimalFormat* cdf = dynamic_cast<const CompactDecimalFormat*>((const NumberFormat*)fmt);
+ if (cdf != NULL) {
+ cdf->format(number, res, fp); // CompactDecimalFormat does not override the version with UErrorCode& !!
+ } else {
+ ((const NumberFormat*)fmt)->format(number, res, fp, *status);
+ }
if(pos != 0) {
pos->beginIndex = fp.getBeginIndex();
if(pos != 0)
fp.setField(pos->field);
- ((const NumberFormat*)fmt)->format(number, res, fp, *status);
+ const CompactDecimalFormat* cdf = dynamic_cast<const CompactDecimalFormat*>((const NumberFormat*)fmt);
+ if (cdf != NULL) {
+ cdf->format(number, res, fp); // CompactDecimalFormat does not override the version with UErrorCode& !!
+ } else {
+ ((const NumberFormat*)fmt)->format(number, res, fp, *status);
+ }
if(pos != 0) {
pos->beginIndex = fp.getBeginIndex();