ICU-1097 unum currency support

X-SVN-Rev: 8638
This commit is contained in:
Alan Liu 2002-05-16 18:25:36 +00:00
parent dc028412eb
commit 98d23f8592
2 changed files with 14 additions and 1 deletions

View file

@ -493,7 +493,9 @@ enum UNumberFormatTextAttribute{
/** Negative suffix */
UNUM_NEGATIVE_SUFFIX,
/** The character used to pad to the format width. */
UNUM_PADDING_CHARACTER
UNUM_PADDING_CHARACTER,
/** The ISO currency code */
UNUM_CURRENCY_CODE
};
typedef enum UNumberFormatTextAttribute UNumberFormatTextAttribute;

View file

@ -540,6 +540,10 @@ unum_getTextAttribute(const UNumberFormat* fmt,
*result = ((DecimalFormat*)fmt)->getPadCharacter();
return 1;
case UNUM_CURRENCY_CODE:
res = UnicodeString(((DecimalFormat*)fmt)->getCurrency(), "");
break;
default:
*status = U_UNSUPPORTED_ERROR;
return -1;
@ -582,6 +586,13 @@ unum_setTextAttribute( UNumberFormat* fmt,
((DecimalFormat*)fmt)->setPadCharacter(*newValue);
break;
case UNUM_CURRENCY_CODE: {
char currency[4];
val.extract(0, 3, currency, "");
currency[3] = 0;
((DecimalFormat*)fmt)->setCurrency(currency); }
break;
default:
*status = U_UNSUPPORTED_ERROR;
break;