From f667e25fdfeaf91c0f4363b594ef4267c81267b9 Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Mon, 12 Apr 2004 23:38:01 +0000 Subject: [PATCH] ICU-2334 add UNUM_SIGNIFICANT_DIGITS_USED X-SVN-Rev: 14942 --- icu4c/source/i18n/unicode/unum.h | 3 +++ icu4c/source/i18n/unum.cpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/icu4c/source/i18n/unicode/unum.h b/icu4c/source/i18n/unicode/unum.h index e69c03a6d21..6a36ea1ce47 100644 --- a/icu4c/source/i18n/unicode/unum.h +++ b/icu4c/source/i18n/unicode/unum.h @@ -494,6 +494,9 @@ typedef enum UNumberFormatAttribute { UNUM_PADDING_POSITION, /** Secondary grouping size */ UNUM_SECONDARY_GROUPING_SIZE, + /** Use significant digits + * @draft ICU 3.0 */ + UNUM_SIGNIFICANT_DIGITS_USED, /** Minimum significant digits * @draft ICU 3.0 */ UNUM_MIN_SIGNIFICANT_DIGITS, diff --git a/icu4c/source/i18n/unum.cpp b/icu4c/source/i18n/unum.cpp index 5404a5d879f..171756962bd 100644 --- a/icu4c/source/i18n/unum.cpp +++ b/icu4c/source/i18n/unum.cpp @@ -363,6 +363,9 @@ unum_getAttribute(const UNumberFormat* fmt, // TBD: what should this return? return df->getMinimumFractionDigits(); + case UNUM_SIGNIFICANT_DIGITS_USED: + return df->areSignificantDigitsUsed(); + case UNUM_MAX_SIGNIFICANT_DIGITS: return df->getMaximumSignificantDigits(); @@ -407,15 +410,15 @@ unum_setAttribute( UNumberFormat* fmt, DecimalFormat* df = (DecimalFormat*) fmt; switch(attr) { case UNUM_PARSE_INT_ONLY: - df->setParseIntegerOnly((UBool)newValue); + df->setParseIntegerOnly(newValue!=0); break; case UNUM_GROUPING_USED: - df->setGroupingUsed((UBool)newValue); + df->setGroupingUsed(newValue!=0); break; case UNUM_DECIMAL_ALWAYS_SHOWN: - df->setDecimalSeparatorAlwaysShown((UBool)newValue); + df->setDecimalSeparatorAlwaysShown(newValue!=0); break; case UNUM_MAX_INTEGER_DIGITS: @@ -444,6 +447,10 @@ unum_setAttribute( UNumberFormat* fmt, df->setMaximumFractionDigits(newValue); break; + case UNUM_SIGNIFICANT_DIGITS_USED: + df->setSignificantDigitsUsed(newValue!=0); + break; + case UNUM_MAX_SIGNIFICANT_DIGITS: df->setMaximumSignificantDigits(newValue); break;