Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DecimalFormatSymbols Class Reference

This class represents the set of symbols needed by DecimalFormat to format numbers. More...

#include <dcfmtsym.h>

List of all members.

Public Types

enum  ENumberFormatSymbol {
  kDecimalSeparatorSymbol, kGroupingSeparatorSymbol, kPatternSeparatorSymbol, kPercentSymbol,
  kZeroDigitSymbol, kDigitSymbol, kMinusSignSymbol, kPlusSignSymbol,
  kCurrencySymbol, kIntlCurrencySymbol, kMonetarySeparatorSymbol, kExponentialSymbol,
  kPermillSymbol, kPadEscapeSymbol, kInfinitySymbol, kNaNSymbol,
  kFormatSymbolCount
}
 Constants for specifying a number format symbol. More...


Public Methods

 DecimalFormatSymbols (const Locale& locale, UErrorCode& status)
 Create a DecimalFormatSymbols object for the given locale. More...

 DecimalFormatSymbols ( UErrorCode& status)
 Create a DecimalFormatSymbols object for the default locale. More...

 DecimalFormatSymbols (const DecimalFormatSymbols&)
 Copy constructor. More...

DecimalFormatSymbols& operator= (const DecimalFormatSymbols&)
 Assignment operator. More...

 ~DecimalFormatSymbols ()
 Destructor. More...

UBool operator== (const DecimalFormatSymbols& other) const
 Return true if another object is semantically equal to this one. More...

UBool operator!= (const DecimalFormatSymbols& other) const
 Return true if another object is semantically unequal to this one. More...

UnicodeString getSymbol (ENumberFormatSymbol symbol) const
 Get one of the format symbols by its enum constant. More...

void setSymbol (ENumberFormatSymbol symbol, UnicodeString value)
 Set one of the format symbols by its enum constant. More...

UChar getZeroDigit (void) const
 character used for zero. More...

void setZeroDigit (UChar zeroDigit)
 character used for zero. More...

UChar getGroupingSeparator (void) const
 character used for thousands separator. More...

void setGroupingSeparator (UChar groupingSeparator)
 character used for thousands separator. More...

UChar getDecimalSeparator (void) const
 character used for decimal sign. More...

void setDecimalSeparator (UChar decimalSeparator)
 character used for decimal sign. More...

UChar getPerMill (void) const
 character used for per mill sign. More...

void setPerMill (UChar permill)
 character used for per mill sign. More...

UChar getPercent (void) const
 character used for percent sign. More...

void setPercent (UChar percent)
 character used for percent sign. More...

UChar getDigit (void) const
 character used for a digit in a pattern. More...

void setDigit (UChar digit)
 character used for a digit in a pattern. More...

UChar getPatternSeparator (void) const
 character used to separate positive and negative subpatterns in a pattern. More...

void setPatternSeparator (UChar patternSeparator)
 character used to separate positive and negative subpatterns in a pattern. More...

UnicodeStringgetInfinity (UnicodeString& result) const
 character used to represent infinity. More...

void setInfinity (const UnicodeString& infinity)
 character used to represent infinity. More...

int32_t compareInfinity (const UnicodeString& text, UTextOffset offset) const
 Checks to see if text at offset represents the inifinity string. More...

UnicodeStringgetNaN (UnicodeString& result) const
 character used to represent NaN (Not A Number). More...

void setNaN (const UnicodeString& NaN)
 character used to represent NaN. More...

int32_t compareNaN (const UnicodeString& text, UTextOffset offset) const
 Checks to see if text at offset represents the NaN string. More...

UChar getPlusSign (void) const
 character used to represent plus sign This function returns only the first code unit of the symbol string, unlike getSymbol(). More...

void setPlusSign (UChar minusSign)
 character used to represent plus sign This function can set only a one-code unit symbol, unlike setSymbol(). More...

UChar getMinusSign (void) const
 character used to represent minus sign. More...

void setMinusSign (UChar minusSign)
 character used to represent minus sign. More...

UChar getExponentialSymbol (void) const
 character used to represent exponential. More...

void setExponentialSymbol (UChar exponential)
 character used to represent exponential. More...

UnicodeStringgetCurrencySymbol (UnicodeString& result) const
 The string denoting the local currency. More...

void setCurrencySymbol (const UnicodeString& currency)
 The string denoting the local currency. More...

int32_t compareCurrencySymbol (const UnicodeString& text, UTextOffset offset) const
 Checks to see if text at offset represents the Currency Symbol string. More...

UnicodeStringgetInternationalCurrencySymbol (UnicodeString& result) const
 The international string denoting the local currency. More...

void setInternationalCurrencySymbol (const UnicodeString& currency)
 The international string denoting the local currency. More...

int32_t compareInternationalCurrencySymbol (const UnicodeString& text, UTextOffset offset) const
 Checks to see if text at offset represents the International Currency Symbol string. More...

UChar getMonetaryDecimalSeparator (void) const
 The monetary decimal separator. More...

void setMonetaryDecimalSeparator (UChar sep)
 The monetary decimal separator. More...

UChar getPadEscape (void) const
 Return the character used to pad numbers out to a specified width. More...

void setPadEscape (UChar c)
 Set the character used to pad numbers out to a specified width. More...


Private Methods

void initialize (const Locale& locale, UErrorCode& success, UBool useLastResortData = FALSE)
 Initializes the symbols from the LocaleElements resource bundle. More...

void initialize (const UnicodeString* numberElements, const UnicodeString* currencyElements)
 Initialize the symbols from the given array of UnicodeStrings. More...

void initialize ()
 Initialize the symbols with default values.


Private Attributes

UnicodeString fSymbols [kFormatSymbolCount]


Detailed Description

This class represents the set of symbols needed by DecimalFormat to format numbers.

DecimalFormat creates for itself an instance of DecimalFormatSymbols from its locale data. If you need to change any of these symbols, you can get the DecimalFormatSymbols object from your DecimalFormat and modify it.

Here are the special characters used in the parts of the subpattern, with notes on their usage.

 
        Symbol   Meaning
          0      a digit
          #      a digit, zero shows as absent
          .      placeholder for decimal separator
          ,      placeholder for grouping separator.
          ;      separates formats.
          -      default negative prefix.
          %      divide by 100 and show as percentage
          X      any other characters can be used in the prefix or suffix
          '      used to quote special characters in a prefix or suffix.
[Notes]

If there is no explicit negative subpattern, - is prefixed to the positive form. That is, "0.00" alone is equivalent to "0.00;-0.00".

The grouping separator is commonly used for thousands, but in some countries for ten-thousands. The interval is a constant number of digits between the grouping characters, such as 100,000,000 or 1,0000,0000. If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. So "#,##,###,####" == "######,####" == "##,####,####".

This class only handles localized digits where the 10 digits are contiguous in Unicode, from 0 to 9. Other digits sets (such as superscripts) would need a different subclass.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 71 of file dcfmtsym.h.


Member Enumeration Documentation

enum DecimalFormatSymbols::ENumberFormatSymbol
 

Constants for specifying a number format symbol.

Draft:
Enumeration values:
kDecimalSeparatorSymbol   The decimal separator.
kGroupingSeparatorSymbol   The grouping separator.
kPatternSeparatorSymbol   The pattern separator.
kPercentSymbol   The percent sign.
kZeroDigitSymbol   Zero.
kDigitSymbol   Character representing a digit in the pattern.
kMinusSignSymbol   The minus sign.
kPlusSignSymbol   The plus sign.
kCurrencySymbol   The currency symbol.
kIntlCurrencySymbol   The international currency symbol.
kMonetarySeparatorSymbol   The monetary separator.
kExponentialSymbol   The exponential symbol.
kPermillSymbol   Per mill symbol.
kPadEscapeSymbol   Escape padding character.
kInfinitySymbol   Infinity symbol.
kNaNSymbol   Nan symbol.
kFormatSymbolCount   count symbol constants.

Definition at line 77 of file dcfmtsym.h.


Constructor & Destructor Documentation

DecimalFormatSymbols::DecimalFormatSymbols ( const Locale & locale,
UErrorCode & status )
 

Create a DecimalFormatSymbols object for the given locale.

Parameters:
locale   The locale to get symbols for.
status   Input/output parameter, set to success or failure code upon return.
Stable:

DecimalFormatSymbols::DecimalFormatSymbols ( UErrorCode & status )
 

Create a DecimalFormatSymbols object for the default locale.

This constructor will not fail. If the resource file data is not available, it will use hard-coded last-resort data and set status to U_USING_FALLBACK_ERROR.

Parameters:
status   Input/output parameter, set to success or failure code upon return.
Stable:

DecimalFormatSymbols::DecimalFormatSymbols ( const DecimalFormatSymbols & )
 

Copy constructor.

Stable:

DecimalFormatSymbols::~DecimalFormatSymbols ( )
 

Destructor.

Stable:


Member Function Documentation

int32_t DecimalFormatSymbols::compareCurrencySymbol ( const UnicodeString & text,
UTextOffset offset ) const [inline]
 

Checks to see if text at offset represents the Currency Symbol string.

Returns:
the number of characters used to represent Currency Symbol when text starts with the Currency Symbol string, otherwise it returns 0.
Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 748 of file dcfmtsym.h.

int32_t DecimalFormatSymbols::compareInfinity ( const UnicodeString & text,
UTextOffset offset ) const [inline]
 

Checks to see if text at offset represents the inifinity string.

Returns:
the number of characters used to represent infinity when text starts with the inifinity string, otherwise it returns 0.
Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 639 of file dcfmtsym.h.

int32_t DecimalFormatSymbols::compareInternationalCurrencySymbol ( const UnicodeString & text,
UTextOffset offset ) const [inline]
 

Checks to see if text at offset represents the International Currency Symbol string.

Returns:
the number of characters used to represent International Currency Symbol when text starts with the International Currency Symbol string, otherwise it returns 0.
Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 779 of file dcfmtsym.h.

int32_t DecimalFormatSymbols::compareNaN ( const UnicodeString & text,
UTextOffset offset ) const [inline]
 

Checks to see if text at offset represents the NaN string.

Returns:
the number of characters used to represent NaN when text starts with the NaN string, otherwise it returns 0.
Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 670 of file dcfmtsym.h.

UnicodeString & DecimalFormatSymbols::getCurrencySymbol ( UnicodeString & result ) const [inline]
 

The string denoting the local currency.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 732 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getDecimalSeparator ( void ) const [inline]
 

character used for decimal sign.

Different for French, etc. This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 543 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getDigit ( void ) const [inline]
 

character used for a digit in a pattern.

This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 591 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getExponentialSymbol ( void ) const [inline]
 

character used to represent exponential.

Almost always left unchanged. This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 716 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getGroupingSeparator ( void ) const [inline]
 

character used for thousands separator.

Different for French, etc. This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 527 of file dcfmtsym.h.

UnicodeString & DecimalFormatSymbols::getInfinity ( UnicodeString & result ) const [inline]
 

character used to represent infinity.

Almost always left unchanged.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 623 of file dcfmtsym.h.

UnicodeString & DecimalFormatSymbols::getInternationalCurrencySymbol ( UnicodeString & result ) const [inline]
 

The international string denoting the local currency.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 763 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getMinusSign ( void ) const [inline]
 

character used to represent minus sign.

If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format. This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 700 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getMonetaryDecimalSeparator ( void ) const [inline]
 

The monetary decimal separator.

This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 794 of file dcfmtsym.h.

UnicodeString & DecimalFormatSymbols::getNaN ( UnicodeString & result ) const [inline]
 

character used to represent NaN (Not A Number).

Almost always left unchanged.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 654 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getPadEscape ( void ) const [inline]
 

Return the character used to pad numbers out to a specified width.

This is not the pad character itself; rather, it is the special pattern character preceding the pad character. In the pattern "*_#,##0", '*' is the pad escape, and '_' is the pad character. This function returns only the first code unit of the symbol string, unlike getSymbol().

Returns:
the character
See also:
setPadEscape , DecimalFormat::getFormatWidth , DecimalFormat::getPadPosition , DecimalFormat::getPadCharacter
Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 807 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getPatternSeparator ( void ) const [inline]
 

character used to separate positive and negative subpatterns in a pattern.

This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 607 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getPerMill ( void ) const [inline]
 

character used for per mill sign.

Different for Arabic, etc. This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 559 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getPercent ( void ) const [inline]
 

character used for percent sign.

Different for Arabic, etc. This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 575 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getPlusSign ( void ) const [inline]
 

character used to represent plus sign This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 684 of file dcfmtsym.h.

UnicodeString DecimalFormatSymbols::getSymbol ( ENumberFormatSymbol symbol ) const [inline]
 

Get one of the format symbols by its enum constant.

Each symbol is stored as a string so that graphemes (characters with modifyer letters) can be used.

Draft:

Definition at line 491 of file dcfmtsym.h.

UChar DecimalFormatSymbols::getZeroDigit ( void ) const [inline]
 

character used for zero.

Different for Arabic, etc. This function returns only the first code unit of the symbol string, unlike getSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 511 of file dcfmtsym.h.

void DecimalFormatSymbols::initialize ( ) [private]
 

Initialize the symbols with default values.

void DecimalFormatSymbols::initialize ( const UnicodeString * numberElements,
const UnicodeString * currencyElements ) [private]
 

Initialize the symbols from the given array of UnicodeStrings.

The array must be of the correct size.

void DecimalFormatSymbols::initialize ( const Locale & locale,
UErrorCode & success,
UBool useLastResortData = FALSE ) [private]
 

Initializes the symbols from the LocaleElements resource bundle.

Note: The organization of LocaleElements badly needs to be cleaned up.

UBool DecimalFormatSymbols::operator!= ( const DecimalFormatSymbols & other ) const [inline]
 

Return true if another object is semantically unequal to this one.

Stable:

Definition at line 164 of file dcfmtsym.h.

DecimalFormatSymbols & DecimalFormatSymbols::operator= ( const DecimalFormatSymbols & )
 

Assignment operator.

Stable:

UBool DecimalFormatSymbols::operator== ( const DecimalFormatSymbols & other ) const
 

Return true if another object is semantically equal to this one.

Stable:

Referenced by operator!=().

void DecimalFormatSymbols::setCurrencySymbol ( const UnicodeString & str ) [inline]
 

The string denoting the local currency.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 740 of file dcfmtsym.h.

void DecimalFormatSymbols::setDecimalSeparator ( UChar decimalSeparator ) [inline]
 

character used for decimal sign.

Different for French, etc. This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 551 of file dcfmtsym.h.

void DecimalFormatSymbols::setDigit ( UChar digit ) [inline]
 

character used for a digit in a pattern.

This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 599 of file dcfmtsym.h.

void DecimalFormatSymbols::setExponentialSymbol ( UChar exponential ) [inline]
 

character used to represent exponential.

Almost always left unchanged. This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 724 of file dcfmtsym.h.

void DecimalFormatSymbols::setGroupingSeparator ( UChar groupingSeparator ) [inline]
 

character used for thousands separator.

Different for French, etc. This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 535 of file dcfmtsym.h.

void DecimalFormatSymbols::setInfinity ( const UnicodeString & infinity ) [inline]
 

character used to represent infinity.

Almost always left unchanged.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 631 of file dcfmtsym.h.

void DecimalFormatSymbols::setInternationalCurrencySymbol ( const UnicodeString & str ) [inline]
 

The international string denoting the local currency.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 771 of file dcfmtsym.h.

void DecimalFormatSymbols::setMinusSign ( UChar minusSign ) [inline]
 

character used to represent minus sign.

If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format. This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 708 of file dcfmtsym.h.

void DecimalFormatSymbols::setMonetaryDecimalSeparator ( UChar sep ) [inline]
 

The monetary decimal separator.

This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 802 of file dcfmtsym.h.

void DecimalFormatSymbols::setNaN ( const UnicodeString & NaN ) [inline]
 

character used to represent NaN.

Almost always left unchanged.

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 662 of file dcfmtsym.h.

void DecimalFormatSymbols::setPadEscape ( UChar c ) [inline]
 

Set the character used to pad numbers out to a specified width.

This is not the pad character itself; rather, it is the special pattern character preceding the pad character. In the pattern "*_#,##0", '*' is the pad escape, and '_' is the pad character. This function can set only a one-code unit symbol, unlike setSymbol().

See also:
getPadEscape , DecimalFormat::setFormatWidth , DecimalFormat::setPadPosition , DecimalFormat::setPadCharacter
Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 811 of file dcfmtsym.h.

void DecimalFormatSymbols::setPatternSeparator ( UChar patternSeparator ) [inline]
 

character used to separate positive and negative subpatterns in a pattern.

This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 615 of file dcfmtsym.h.

void DecimalFormatSymbols::setPerMill ( UChar permill ) [inline]
 

character used for per mill sign.

Different for Arabic, etc. This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 567 of file dcfmtsym.h.

void DecimalFormatSymbols::setPercent ( UChar percent ) [inline]
 

character used for percent sign.

Different for Arabic, etc. This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 583 of file dcfmtsym.h.

void DecimalFormatSymbols::setPlusSign ( UChar plusSign ) [inline]
 

character used to represent plus sign This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 692 of file dcfmtsym.h.

void DecimalFormatSymbols::setSymbol ( ENumberFormatSymbol symbol,
UnicodeString value ) [inline]
 

Set one of the format symbols by its enum constant.

Each symbol is stored as a string so that graphemes (characters with modifyer letters) can be used.

Draft:

Definition at line 502 of file dcfmtsym.h.

void DecimalFormatSymbols::setZeroDigit ( UChar zeroDigit ) [inline]
 

character used for zero.

Different for Arabic, etc. This function can set only a one-code unit symbol, unlike setSymbol().

Deprecated:
remove after 2000-dec-31. See UNumberFormatSymbol and unum_getSymbol() for a replacement.

Definition at line 519 of file dcfmtsym.h.


Member Data Documentation

UnicodeString DecimalFormatSymbols::fSymbols[kFormatSymbolCount] [private]
 

Definition at line 484 of file dcfmtsym.h.


The documentation for this class was generated from the following file:
Generated at Thu Mar 22 16:13:08 2001 for ICU 1.8 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000