Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

DecimalFormatSymbols Class Reference

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

#include <dcfmtsym.h>


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 Member Functions

 DecimalFormatSymbols (const Locale &locale, UErrorCode &status)
 Create a DecimalFormatSymbols object for the given locale.
 DecimalFormatSymbols (UErrorCode &status)
 Create a DecimalFormatSymbols object for the default locale.
 DecimalFormatSymbols (const DecimalFormatSymbols &)
 Copy constructor.
DecimalFormatSymbolsoperator= (const DecimalFormatSymbols &)
 Assignment operator.
 ~DecimalFormatSymbols ()
 Destructor.
UBool operator== (const DecimalFormatSymbols &other) const
 Return true if another object is semantically equal to this one.
UBool operator!= (const DecimalFormatSymbols &other) const
 Return true if another object is semantically unequal to this one.
UnicodeString getSymbol (ENumberFormatSymbol symbol) const
 Get one of the format symbols by its enum constant.
void setSymbol (ENumberFormatSymbol symbol, UnicodeString value)
 Set one of the format symbols by its enum constant.


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.


Member Enumeration Documentation

enum DecimalFormatSymbols::ENumberFormatSymbol
 

Constants for specifying a number format symbol.

Enumerator:
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 - replaces kPermillSymbol.
kPadEscapeSymbol  Escape padding character.
kInfinitySymbol  Infinity symbol.
kNaNSymbol  Nan symbol.
kFormatSymbolCount  count symbol constants


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.

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.

DecimalFormatSymbols::DecimalFormatSymbols const DecimalFormatSymbols  ) 
 

Copy constructor.

DecimalFormatSymbols::~DecimalFormatSymbols  ) 
 

Destructor.


Member Function Documentation

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.

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

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

DecimalFormatSymbols& DecimalFormatSymbols::operator= const DecimalFormatSymbols  ) 
 

Assignment operator.

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

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

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.


The documentation for this class was generated from the following file:
Generated on Mon Jul 25 21:50:52 2005 for ICU 2.1 by  doxygen 1.4.3-20050530