Logo Search packages:      
Sourcecode: icu version File versions  Download package

DecimalFormatSymbols Class Reference

#include <dcfmtsym.h>

Inheritance diagram for DecimalFormatSymbols:

UObject UMemory

List of all members.


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 82 of file dcfmtsym.h.


Public Types

enum  ECurrencySpacing { kCurrencyMatch, kSurroundingMatch, kInsert, kCurrencySpacingCount }
enum  ENumberFormatSymbol {
  kDecimalSeparatorSymbol, kGroupingSeparatorSymbol, kPatternSeparatorSymbol, kPercentSymbol,
  kZeroDigitSymbol, kDigitSymbol, kMinusSignSymbol, kPlusSignSymbol,
  kCurrencySymbol, kIntlCurrencySymbol, kMonetarySeparatorSymbol, kExponentialSymbol,
  kPerMillSymbol, kPadEscapeSymbol, kInfinitySymbol, kNaNSymbol,
  kSignificantDigitSymbol, kMonetaryGroupingSeparatorSymbol, kFormatSymbolCount
}

Public Member Functions

 DecimalFormatSymbols (const DecimalFormatSymbols &)
 DecimalFormatSymbols (UErrorCode &status)
 DecimalFormatSymbols (const Locale &locale, UErrorCode &status)
const UnicodeStringgetConstSymbol (ENumberFormatSymbol symbol) const
const UChar * getCurrencyPattern (void) const
virtual UClassID getDynamicClassID () const
Locale getLocale (ULocDataLocaleType type, UErrorCode &status) const
Locale getLocale () const
const UnicodeStringgetPatternForCurrencySpacing (ECurrencySpacing type, UBool beforeCurrency, UErrorCode &status) const
UnicodeString getSymbol (ENumberFormatSymbol symbol) const
UBool operator!= (const DecimalFormatSymbols &other) const
DecimalFormatSymbolsoperator= (const DecimalFormatSymbols &)
UBool operator== (const DecimalFormatSymbols &other) const
void setPatternForCurrencySpacing (ECurrencySpacing type, UBool beforeCurrency, const UnicodeString &pattern)
void setSymbol (ENumberFormatSymbol symbol, const UnicodeString &value)
virtual ~DecimalFormatSymbols ()

Static Public Member Functions

static UClassID U_EXPORT2 getStaticClassID ()
static void U_EXPORT2 operator delete (void *, void *) U_NO_THROW
static void U_EXPORT2 operator delete (void *p) U_NO_THROW
static void U_EXPORT2 operator delete[] (void *p) U_NO_THROW
static void *U_EXPORT2 operator new (size_t, void *ptr) U_NO_THROW
static void *U_EXPORT2 operator new (size_t size) U_NO_THROW
static void *U_EXPORT2 operator new[] (size_t size) U_NO_THROW

Private Member Functions

void initialize ()
void initialize (const UChar **numberElements, int32_t *numberElementsStrLen, int32_t numberElementsLength)
void initialize (const Locale &locale, UErrorCode &success, UBool useLastResortData=FALSE)
void setCurrencyForSymbols ()

Private Attributes

char actualLocale [ULOC_FULLNAME_CAPACITY]
UnicodeString currencySpcAfterSym [kCurrencySpacingCount]
UnicodeString currencySpcBeforeSym [kCurrencySpacingCount]
const UChar * currPattern
UnicodeString fNoSymbol
UnicodeString fSymbols [kFormatSymbolCount]
Locale locale
char validLocale [ULOC_FULLNAME_CAPACITY]

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index