ICU-3399 add UErrorCode to setCurrency

X-SVN-Rev: 14511
This commit is contained in:
Alan Liu 2004-02-13 01:56:38 +00:00
parent d4260bd778
commit 62b974ace2
4 changed files with 13 additions and 12 deletions

View file

@ -1096,10 +1096,12 @@ public:
* the currency is used if and when this object becomes a
* currency format through the application of a new pattern.
* @param theCurrency a 3-letter ISO code indicating new currency
* to use. It need not be null-terminated.
* @stable ICU 2.2
* to use. It need not be null-terminated. May be the empty
* string or NULL to indicate no currency.
* @param ec input-output error code
* @draft ICU 3.0
*/
virtual void setCurrency(const UChar* theCurrency);
virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
/**
* The resource tags we use to retrieve decimal format data from

View file

@ -603,9 +603,10 @@ public:
* @param theCurrency a 3-letter ISO code indicating new currency
* to use. It need not be null-terminated. May be the empty
* string or NULL to indicate no currency.
* @draft ICU 2.6
* @param ec input-output error code
* @draft ICU 3.0
*/
virtual void setCurrency(const UChar* theCurrency);
virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
/**
* Gets the currency used to display currency
@ -695,7 +696,7 @@ private:
UBool fParseIntegerOnly;
// ISO currency code
UChar currency[4];
UChar fCurrency[4];
friend class ICUNumberFormatFactory; // access to makeInstance, EStyles
friend class ICUNumberFormatService;

View file

@ -544,7 +544,7 @@ unum_setTextAttribute( UNumberFormat* fmt,
break;
case UNUM_CURRENCY_CODE:
((DecimalFormat*)fmt)->setCurrency(newValue);
((DecimalFormat*)fmt)->setCurrency(newValue, *status);
break;
default:

View file

@ -1617,11 +1617,9 @@ void NumberFormatTest::expectCurrency(NumberFormat& nf, const Locale& locale,
u_strcpy(curr, DEFAULT_CURR);
if (*locale.getLanguage() != 0) {
ucurr_forLocale(locale.getName(), curr, 4, &ec);
if (U_FAILURE(ec)) {
errln("FAIL: UCurrency::forLocale");
return;
}
fmt.setCurrency(curr);
assertSuccess("ucurr_forLocale", ec);
fmt.setCurrency(curr, ec);
assertSuccess("DecimalFormat::setCurrency", ec);
}
UnicodeString s;
fmt.format(value, s);