/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1999-2003, International Business Machines Corporation and
+ * Copyright (c) 1999-2010, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
// check that the formatter is a DecimalFormat instance
// necessary because we will cast to the DecimalFormat subclass to set
// the currency symbol
- if(nf.getDynamicClassID()!=DecimalFormat::getStaticClassID()) {
+ DecimalFormat *dnf=dynamic_cast<DecimalFormat *>(&nf);
+ if(dnf==NULL) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
nf.setMinimumFractionDigits(currencyMap[i].fractionDigits);
nf.setMaximumFractionDigits(currencyMap[i].fractionDigits);
- DecimalFormat &dnf=(DecimalFormat &)nf;
- dnf.setRoundingIncrement(currencyMap[i].roundingIncrement);
+ dnf->setRoundingIncrement(currencyMap[i].roundingIncrement);
- DecimalFormatSymbols symbols(*dnf.getDecimalFormatSymbols());
+ DecimalFormatSymbols symbols(*dnf->getDecimalFormatSymbols());
symbols.setSymbol(DecimalFormatSymbols::kCurrencySymbol, currencyMap[i].symbol);
- dnf.setDecimalFormatSymbols(symbols); // do not adopt symbols: Jitterbug 2889
+ dnf->setDecimalFormatSymbols(symbols); // do not adopt symbols: Jitterbug 2889
}
/*
u_charsToUChars(currency, uCurrency, 4);
// set the currency
+ // in ICU 3.0 this API (which was @draft ICU 2.6) gained a UErrorCode& argument
+#if (U_ICU_VERSION_MAJOR_NUM < 3)
nf.setCurrency(uCurrency);
+#else
+ nf.setCurrency(uCurrency, errorCode);
+#endif
}
static const char *const