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

DecimalFormatSymbols Class Reference

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

#include <dcfmtsym.h>

Inheritance diagram for DecimalFormatSymbols::

UObject 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...

Locale getLocale () const
 Returns the locale for which this object was constructed. More...

virtual UClassID getDynamicClassID () const
 ICU "poor man's RTTI", returns a UClassID for the actual class. More...


Static Public Methods

UClassID getStaticClassID ()
 ICU "poor man's RTTI", returns a UClassID for this class. 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. More...

void setCurrencyForSymbols ()

Private Attributes

UnicodeString fSymbols [kFormatSymbolCount]
Locale locale

Static Private Attributes

const char fgNumberElements []
const char fgCurrencyElements []
const char fgClassID
 The address of this static class variable serves as this class's ID for ICU "poor man's RTTI". More...


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.

Definition at line 73 of file dcfmtsym.h.


Member Enumeration Documentation

enum DecimalFormatSymbols::ENumberFormatSymbol
 

Constants for specifying a number format symbol.

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

Definition at line 79 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

virtual UClassID DecimalFormatSymbols::getDynamicClassID void    const [inline, virtual]
 

ICU "poor man's RTTI", returns a UClassID for the actual class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Reimplemented from UObject.

Definition at line 206 of file dcfmtsym.h.

Locale DecimalFormatSymbols::getLocale   const [inline]
 

Returns the locale for which this object was constructed.

Definition at line 283 of file dcfmtsym.h.

UClassID DecimalFormatSymbols::getStaticClassID void    [inline, static]
 

ICU "poor man's RTTI", returns a UClassID for this class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Definition at line 213 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.

Parameters:
symbol  Constant to indicate a number format symbol.
Returns:
the format symbols by the param 'symbol'
Stable:

Definition at line 262 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.

Parameters:
numberElements  the number format symbols
currencyElements  the currency symbols

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.

Parameters:
locale  The locale to get symbols for.
success  Input/output parameter, set to success or failure code upon return.
useLastResortData  determine if use last resort data

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

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

Parameters:
other  the object to be compared with.
Returns:
true if another object is semantically unequal to this one.
Stable:

Definition at line 172 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.

Parameters:
other  the object to be compared with.
Returns:
true if another object is semantically equal to this one.
Stable:

void DecimalFormatSymbols::setCurrencyForSymbols   [private]
 

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.

Parameters:
symbol  Constant to indicate a number format symbol.
value  value of the format sybmol
Stable:

Definition at line 274 of file dcfmtsym.h.


Member Data Documentation

UnicodeString DecimalFormatSymbols::fSymbols[kFormatSymbolCount] [private]
 

Definition at line 244 of file dcfmtsym.h.

const char DecimalFormatSymbols::fgClassID [static, private]
 

The address of this static class variable serves as this class's ID for ICU "poor man's RTTI".

Definition at line 255 of file dcfmtsym.h.

const char DecimalFormatSymbols::fgCurrencyElements[] [static, private]
 

Definition at line 249 of file dcfmtsym.h.

const char DecimalFormatSymbols::fgNumberElements[] [static, private]
 

Definition at line 248 of file dcfmtsym.h.

Locale DecimalFormatSymbols::locale [private]
 

Definition at line 246 of file dcfmtsym.h.


The documentation for this class was generated from the following file:
Generated on Thu Aug 15 14:13:57 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001