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

DecimalFormat Class Reference

Concrete class for formatting decimal numbers, allowing a variety of parameters, and localization to Western, Arabic, or Indic numbers. More...

#include <decimfmt.h>

Inheritance diagram for DecimalFormat::

NumberFormat Format UObject UMemory List of all members.

Public Types

enum  ERoundingMode {
  kRoundCeiling, kRoundFloor, kRoundDown, kRoundUp,
  kRoundHalfEven, kRoundHalfDown, kRoundHalfUp
}
 Rounding mode. More...

enum  EPadPosition { kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, kPadAfterSuffix }
 Pad position. More...


Public Methods

 DecimalFormat (UErrorCode &status)
 Create a DecimalFormat using the default pattern and symbols for the default locale. More...

 DecimalFormat (const UnicodeString &pattern, UErrorCode &status)
 Create a DecimalFormat from the given pattern and the symbols for the default locale. More...

 DecimalFormat (const UnicodeString &pattern, DecimalFormatSymbols *symbolsToAdopt, UErrorCode &status)
 Create a DecimalFormat from the given pattern and symbols. More...

 DecimalFormat (const UnicodeString &pattern, DecimalFormatSymbols *symbolsToAdopt, UParseError &parseError, UErrorCode &status)
 Create a DecimalFormat from the given pattern and symbols. More...

 DecimalFormat (const UnicodeString &pattern, const DecimalFormatSymbols &symbols, UErrorCode &status)
 Create a DecimalFormat from the given pattern and symbols. More...

 DecimalFormat (const DecimalFormat &source)
 Copy constructor. More...

DecimalFormat & operator= (const DecimalFormat &rhs)
 Assignment operator. More...

virtual ~DecimalFormat ()
 Destructor. More...

virtual Formatclone (void) const
 Clone this Format object polymorphically. More...

virtual UBool operator== (const Format &other) const
 Return true if the given Format objects are semantically equal. More...

virtual UnicodeStringformat (double number, UnicodeString &appendTo, FieldPosition &pos) const
 Format a double or long number using base-10 representation. More...

virtual UnicodeStringformat (int32_t number, UnicodeString &appendTo, FieldPosition &pos) const
 Format a long number using base-10 representation. More...

virtual UnicodeStringformat (int64_t number, UnicodeString &appendTo, FieldPosition &pos) const
 Format an int64 number using base-10 representation. More...

virtual UnicodeStringformat (const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
 Format a Formattable using base-10 representation. More...

UnicodeStringformat (const Formattable &obj, UnicodeString &appendTo, UErrorCode &status) const
 Redeclared NumberFormat method. More...

UnicodeStringformat (double number, UnicodeString &appendTo) const
 Redeclared NumberFormat method. More...

UnicodeStringformat (int32_t number, UnicodeString &appendTo) const
 Redeclared NumberFormat method. More...

UnicodeStringformat (int64_t number, UnicodeString &appendTo) const
 Redeclared NumberFormat method. More...

virtual void parse (const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const
 Parse the given string using this object's choices. More...

virtual void parse (const UnicodeString &text, Formattable &result, UErrorCode &status) const
 Parse the given string using this object's choices. More...

virtual const DecimalFormatSymbolsgetDecimalFormatSymbols (void) const
 Returns the decimal format symbols, which is generally not changed by the programmer or user. More...

virtual void adoptDecimalFormatSymbols (DecimalFormatSymbols *symbolsToAdopt)
 Sets the decimal format symbols, which is generally not changed by the programmer or user. More...

virtual void setDecimalFormatSymbols (const DecimalFormatSymbols &symbols)
 Sets the decimal format symbols, which is generally not changed by the programmer or user. More...

UnicodeStringgetPositivePrefix (UnicodeString &result) const
 Get the positive prefix. More...

virtual void setPositivePrefix (const UnicodeString &newValue)
 Set the positive prefix. More...

UnicodeStringgetNegativePrefix (UnicodeString &result) const
 Get the negative prefix. More...

virtual void setNegativePrefix (const UnicodeString &newValue)
 Set the negative prefix. More...

UnicodeStringgetPositiveSuffix (UnicodeString &result) const
 Get the positive suffix. More...

virtual void setPositiveSuffix (const UnicodeString &newValue)
 Set the positive suffix. More...

UnicodeStringgetNegativeSuffix (UnicodeString &result) const
 Get the negative suffix. More...

virtual void setNegativeSuffix (const UnicodeString &newValue)
 Set the negative suffix. More...

int32_t getMultiplier (void) const
 Get the multiplier for use in percent, permill, etc. More...

virtual void setMultiplier (int32_t newValue)
 Set the multiplier for use in percent, permill, etc. More...

virtual double getRoundingIncrement (void)
 Get the rounding increment. More...

virtual void setRoundingIncrement (double newValue)
 Set the rounding increment. More...

virtual ERoundingMode getRoundingMode (void)
 Get the rounding mode. More...

virtual void setRoundingMode (ERoundingMode roundingMode)
 Set the rounding mode. More...

virtual int32_t getFormatWidth (void)
 Get the width to which the output of format() is padded. More...

virtual void setFormatWidth (int32_t width)
 Set the width to which the output of format() is padded. More...

virtual UnicodeString getPadCharacterString ()
 Get the grapheme string (a character, possibly with modifier letters) used to pad to the format width. More...

virtual void setPadCharacter (const UnicodeString &padChar)
 Set the grapheme string (a character, possibly with modifier letters) used to pad to the format width. More...

virtual EPadPosition getPadPosition (void)
 Get the position at which padding will take place. More...

virtual void setPadPosition (EPadPosition padPos)
 <font face=helvetica color=red>NEW</font> Set the position at which padding will take place. More...

virtual UBool isScientificNotation (void)
 Return whether or not scientific notation is used. More...

virtual void setScientificNotation (UBool useScientific)
 Set whether or not scientific notation is used. More...

virtual int8_t getMinimumExponentDigits (void)
 Return the minimum exponent digits that will be shown. More...

virtual void setMinimumExponentDigits (int8_t minExpDig)
 Set the minimum exponent digits that will be shown. More...

virtual UBool isExponentSignAlwaysShown (void)
 Return whether the exponent sign is always shown. More...

virtual void setExponentSignAlwaysShown (UBool expSignAlways)
 Set whether the exponent sign is always shown. More...

int32_t getGroupingSize (void) const
 Return the grouping size. More...

virtual void setGroupingSize (int32_t newValue)
 Set the grouping size. More...

int32_t getSecondaryGroupingSize (void) const
 Return the secondary grouping size. More...

virtual void setSecondaryGroupingSize (int32_t newValue)
 Set the secondary grouping size. More...

UBool isDecimalSeparatorAlwaysShown (void) const
 Allows you to get the behavior of the decimal separator with integers. More...

virtual void setDecimalSeparatorAlwaysShown (UBool newValue)
 Allows you to set the behavior of the decimal separator with integers. More...

virtual UnicodeStringtoPattern (UnicodeString &result) const
 Synthesizes a pattern string that represents the current state of this Format object. More...

virtual UnicodeStringtoLocalizedPattern (UnicodeString &result) const
 Synthesizes a localized pattern string that represents the current state of this Format object. More...

virtual void applyPattern (const UnicodeString &pattern, UParseError &parseError, UErrorCode &status)
 Apply the given pattern to this Format object. More...

virtual void applyPattern (const UnicodeString &pattern, UErrorCode &status)
 Sets the pattern. More...

virtual void applyLocalizedPattern (const UnicodeString &pattern, UParseError &parseError, UErrorCode &status)
 Apply the given pattern to this Format object. More...

virtual void applyLocalizedPattern (const UnicodeString &pattern, UErrorCode &status)
 Apply the given pattern to this Format object. More...

virtual void setMaximumIntegerDigits (int32_t newValue)
 Sets the maximum number of digits allowed in the integer portion of a number. More...

virtual void setMinimumIntegerDigits (int32_t newValue)
 Sets the minimum number of digits allowed in the integer portion of a number. More...

virtual void setMaximumFractionDigits (int32_t newValue)
 Sets the maximum number of digits allowed in the fraction portion of a number. More...

virtual void setMinimumFractionDigits (int32_t newValue)
 Sets the minimum number of digits allowed in the fraction portion of a number. More...

virtual void setCurrency (const UChar *theCurrency)
 Sets the currency used to display currency amounts. More...

virtual UClassID getDynamicClassID (void) const
 Returns a unique class ID POLYMORPHICALLY. More...


Static Public Methods

UClassID getStaticClassID (void)
 Return the class ID for this class. More...


Static Public Attributes

const char fgNumberPatterns []
 The resource tags we use to retrieve decimal format data from locale resource bundles. More...


Static Protected Attributes

const int32_t kDoubleIntegerDigits
 number of integer digits. More...

const int32_t kDoubleFractionDigits
 number of fraction digits. More...

const int32_t kMaxScientificIntegerDigits
 When someone turns on scientific mode, we assume that more than this number of digits is due to flipping from some other mode that didn't restrict the maximum, and so we force 1 integer digit. More...


Private Types

enum  { fgStatusInfinite, fgStatusLength }

Private Methods

 DecimalFormat ()
int32_t precision (UBool isIntegral) const
void construct (UErrorCode &status, UParseError &parseErr, const UnicodeString *pattern=0, DecimalFormatSymbols *symbolsToAdopt=0)
 Do real work of constructing a new DecimalFormat. More...

UnicodeStringtoPattern (UnicodeString &result, UBool localized) const
 Does the real work of generating a pattern. More...

void applyPattern (const UnicodeString &pattern, UBool localized, UParseError &parseError, UErrorCode &status)
 Does the real work of applying a pattern. More...

UnicodeStringsubformat (UnicodeString &appendTo, FieldPosition &fieldPosition, DigitList &digits, UBool isInteger) const
 Do the work of formatting a number, either a double or a long. More...

UBool subparse (const UnicodeString &text, ParsePosition &parsePosition, DigitList &digits, UBool *status) const
 Parse the given text into a number. More...

int32_t skipPadding (const UnicodeString &text, int32_t position) const
int32_t compareAffix (const UnicodeString &input, int32_t pos, UBool isNegative, UBool isPrefix) const
int32_t compareComplexAffix (const UnicodeString &affixPat, const UnicodeString &input, int32_t pos) const
const UnicodeStringgetConstSymbol (DecimalFormatSymbols::ENumberFormatSymbol symbol) const
 Get a decimal format symbol. More...

int32_t appendAffix (UnicodeString &buf, double number, UBool isNegative, UBool isPrefix) const
void appendAffixPattern (UnicodeString &appendTo, const UnicodeString &affix, UBool localized) const
 Append an affix to the given UnicodeString, using quotes if there are special characters. More...

void appendAffixPattern (UnicodeString &appendTo, const UnicodeString *affixPattern, const UnicodeString &expAffix, UBool localized) const
void expandAffix (const UnicodeString &pattern, UnicodeString &affix, double number, UBool doFormat) const
void expandAffixes ()
void addPadding (UnicodeString &appendTo, FieldPosition &fieldPosition, int32_t prefixLen, int32_t suffixLen) const
UBool isGroupingPosition (int32_t pos) const
void setCurrencyForSymbols ()
void setCurrencyForLocale (const char *locale, UErrorCode &ec)

Static Private Methods

int32_t compareSimpleAffix (const UnicodeString &affix, const UnicodeString &input, int32_t pos)
int32_t skipRuleWhiteSpace (const UnicodeString &text, int32_t pos)
int32_t skipUWhiteSpace (const UnicodeString &text, int32_t pos)
int32_t match (const UnicodeString &text, int32_t pos, UChar32 ch)
int32_t match (const UnicodeString &text, int32_t pos, const UnicodeString &str)
double round (double a, ERoundingMode mode, UBool isNegative)

Private Attributes

enum DecimalFormat:: { ... }  StatusFlags
UnicodeString fPositivePrefix
 Constants. More...

UnicodeString fPositiveSuffix
UnicodeString fNegativePrefix
UnicodeString fNegativeSuffix
UnicodeStringfPosPrefixPattern
UnicodeStringfPosSuffixPattern
UnicodeStringfNegPrefixPattern
UnicodeStringfNegSuffixPattern
ChoiceFormatfCurrencyChoice
 Formatter for ChoiceFormat-based currency names. More...

int32_t fMultiplier
int32_t fGroupingSize
int32_t fGroupingSize2
UBool fDecimalSeparatorAlwaysShown
UBool fIsCurrencyFormat
DecimalFormatSymbolsfSymbols
UBool fUseExponentialNotation
int8_t fMinExponentDigits
UBool fExponentSignAlwaysShown
DigitListfRoundingIncrement
double fRoundingDouble
ERoundingMode fRoundingMode
UChar32 fPad
int32_t fFormatWidth
EPadPosition fPadPosition

Detailed Description

Concrete class for formatting decimal numbers, allowing a variety of parameters, and localization to Western, Arabic, or Indic numbers.

Normally, you get the proper NumberFormat for a specific locale (including the default locale) using the NumberFormat factory methods, rather than constructing a DecimalNumberFormat directly.

Either the prefixes or the suffixes must be different for the parse to distinguish positive from negative. Parsing will be unreliable if the digits, thousands or decimal separators are the same, or if any of them occur in the prefixes or suffixes.

[Special cases:]

NaN is formatted as a single character, typically \uFFFD.

+/-Infinity is formatted as a single character, typically \u221E, plus the positive and negative pre/suffixes.

Note: this class is designed for common users; for very large or small numbers, use a format that can express exponential values.

[Example:]

 
     // normally we would have a GUI with a menu for this
     int32_t locCount;
     const Locale* locales = NumberFormat::getAvailableLocales(locCount);
     if (locCount > 12) locCount = 12;  //limit output
 
     double myNumber = -1234.56;
     UErrorCode success = U_ZERO_ERROR;
     NumberFormat* form; //= NumberFormat::createInstance(success);
 
     // just for fun, we print out a number with the locale number, currency
     // and percent format for each locale we can.
     UnicodeString countryName;
     UnicodeString displayName;
     UnicodeString str;
     UnicodeString pattern;
     Formattable fmtable;
     for (int32_t j = 0; j < 3; ++j) {
         cout << endl << "FORMAT " << j << endl;
         for (int32_t i = 0; i < locCount; ++i) {
             if (locales[i].getCountry(countryName).size() == 0) {
                 // skip language-only
                 continue;
             }
             switch (j) {
             default:
                 form = NumberFormat::createInstance(locales[i], success ); break;
             case 1:
                 form = NumberFormat::createCurrencyInstance(locales[i], success ); break;
             case 0:
                 form = NumberFormat::createPercentInstance(locales[i], success ); break;
             }
             if (form) {
                 str.remove();
                 pattern = ((DecimalFormat*)form)->toPattern(pattern);
                 cout << locales[i].getDisplayName(displayName) << ": " << pattern;
                 cout << "  ->  " << form->format(myNumber,str) << endl;
                 form->parse(form->format(myNumber,str), fmtable, success);
                 //cout << "   parsed: " << fmtable << endl;
                 delete form;  
             }
         }
     }
[The following shows the structure of the pattern.]
 
     pattern    := subpattern{;subpattern}
     subpattern := {prefix}integer{.fraction}{suffix}
     
     prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
     suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
     integer    := '#'* '0'* '0'
     fraction   := '0'* '#'*
   
  Notation:
     X*       0 or more instances of X
     (X | Y)  either X or Y.
     X..Y     any character from X up to Y, inclusive.
     S - T    characters in S, except those in T
 \code
 /pre>
 The first subpattern is for positive numbers. The second (optional)
 subpattern is used for negative numbers. (In both cases, ',' can
 occur inside the integer portion--it is just too messy to indicate
 in BNF.)  For the second subpattern, only the PREFIX and SUFFIX are
 noted; other attributes are taken only from the first subpattern.
 <P>
 Here are the special characters used in the parts of the
 subpattern, with notes on their usage.
 <pre>
 \code
     Symbol   Meaning
       0      a digit, showing up a zero if it is zero
       #      a digit, supressed if zero
       .      placeholder for decimal separator
       ,      placeholder for grouping separator.
       E      separates mantissa and exponent for exponential formats.
       ;      separates formats.
       -      default negative prefix.
       %      multiply by 100 and show as percentage
       \u2030 multiply by 1000 and show as per mille
       \u00A4 currency sign; replaced by currency symbol; if
              doubled, replaced by international currency symbol.
              If present in a pattern, the monetary decimal separator
              is used instead of the decimal separator.
       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".

Illegal formats, such as "#.#.#" in the same format, will cause a failing UErrorCode to be returned.

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 determines the primary grouping size, and the interval between the last two determines the secondary grouping size (see below); all others are ignored. So "#,##,###,####" == "###,###,####" == "##,#,###,####".

Some locales have two different grouping intervals: One used for the least significant integer digits (the primary grouping size), and one used for all others (the secondary grouping size). For example, if the primary grouping interval is 3, and the secondary is 2, then this corresponds to the pattern "#,##,##0", and the number 123456789 is formatted as "12,34,56,789".

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 184 of file decimfmt.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
fgStatusInfinite 
fgStatusLength 

Definition at line 1192 of file decimfmt.h.

enum DecimalFormat::EPadPosition
 

Pad position.

Draft:
This API has been introduced in ICU 2.4. It is still in draft state and may be modified in a future release.
Enumeration values:
kPadBeforePrefix 
kPadAfterPrefix 
kPadBeforeSuffix 
kPadAfterSuffix 

Definition at line 203 of file decimfmt.h.

enum DecimalFormat::ERoundingMode
 

Rounding mode.

Draft:
This API has been introduced in ICU 2.4. It is still in draft state and may be modified in a future release.
Enumeration values:
kRoundCeiling 
kRoundFloor 
kRoundDown 
kRoundUp 
kRoundHalfEven 
kRoundHalfDown 
kRoundHalfUp 

Definition at line 189 of file decimfmt.h.


Constructor & Destructor Documentation

DecimalFormat::DecimalFormat UErrorCode   status
 

Create a DecimalFormat using the default pattern and symbols for the default locale.

This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as createInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale.

Parameters:
status  Output param set to success/failure code. If the pattern is invalid this will be set to a failure code.
Stable:
ICU 2.0

DecimalFormat::DecimalFormat const UnicodeString   pattern,
UErrorCode   status
 

Create a DecimalFormat from the given pattern and the symbols for the default locale.

This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as createInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale.

Parameters:
pattern  A non-localized pattern string.
status  Output param set to success/failure code. If the pattern is invalid this will be set to a failure code.
Stable:
ICU 2.0

DecimalFormat::DecimalFormat const UnicodeString   pattern,
DecimalFormatSymbols   symbolsToAdopt,
UErrorCode   status
 

Create a DecimalFormat from the given pattern and symbols.

Use this constructor when you need to completely customize the behavior of the format.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as createInstance or createCurrencyInstance. If you need only minor adjustments to a standard format, you can modify the format returned by a NumberFormat factory method.

Parameters:
pattern  a non-localized pattern string
symbolsToAdopt  the set of symbols to be used. The caller should not delete this object after making this call.
status  Output param set to success/failure code. If the pattern is invalid this will be set to a failure code.
Stable:
ICU 2.0

DecimalFormat::DecimalFormat const UnicodeString   pattern,
DecimalFormatSymbols   symbolsToAdopt,
UParseError   parseError,
UErrorCode   status
 

Create a DecimalFormat from the given pattern and symbols.

Use this constructor when you need to completely customize the behavior of the format.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as createInstance or createCurrencyInstance. If you need only minor adjustments to a standard format, you can modify the format returned by a NumberFormat factory method.

Parameters:
pattern  a non-localized pattern string
symbolsToAdopt  the set of symbols to be used. The caller should not delete this object after making this call.
parseError  Output param to receive errors occured during parsing
status  Output param set to success/failure code. If the pattern is invalid this will be set to a failure code.
Stable:
ICU 2.0

DecimalFormat::DecimalFormat const UnicodeString   pattern,
const DecimalFormatSymbols   symbols,
UErrorCode   status
 

Create a DecimalFormat from the given pattern and symbols.

Use this constructor when you need to completely customize the behavior of the format.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as createInstance or createCurrencyInstance. If you need only minor adjustments to a standard format, you can modify the format returned by a NumberFormat factory method.

Parameters:
pattern  a non-localized pattern string
symbols  the set of symbols to be used
status  Output param set to success/failure code. If the pattern is invalid this will be set to a failure code.
Stable:
ICU 2.0

DecimalFormat::DecimalFormat const DecimalFormat &    source
 

Copy constructor.

Parameters:
source  the DecimalFormat object to be copied from.
Stable:
ICU 2.0

virtual DecimalFormat::~DecimalFormat   [virtual]
 

Destructor.

Stable:
ICU 2.0

DecimalFormat::DecimalFormat   [private]
 


Member Function Documentation

void DecimalFormat::addPadding UnicodeString   appendTo,
FieldPosition   fieldPosition,
int32_t    prefixLen,
int32_t    suffixLen
const [private]
 

virtual void DecimalFormat::adoptDecimalFormatSymbols DecimalFormatSymbols   symbolsToAdopt [virtual]
 

Sets the decimal format symbols, which is generally not changed by the programmer or user.

Parameters:
symbolsToAdopt  DecimalFormatSymbols to be adopted.
Stable:
ICU 2.0

int32_t DecimalFormat::appendAffix UnicodeString   buf,
double    number,
UBool    isNegative,
UBool    isPrefix
const [private]
 

void DecimalFormat::appendAffixPattern UnicodeString   appendTo,
const UnicodeString   affixPattern,
const UnicodeString   expAffix,
UBool    localized
const [private]
 

void DecimalFormat::appendAffixPattern UnicodeString   appendTo,
const UnicodeString   affix,
UBool    localized
const [private]
 

Append an affix to the given UnicodeString, using quotes if there are special characters.

Single quotes themselves must be escaped in either case.

virtual void DecimalFormat::applyLocalizedPattern const UnicodeString   pattern,
UErrorCode   status
[virtual]
 

Apply the given pattern to this Format object.

Parameters:
pattern  The localized pattern to be applied.
status  Output param set to success/failure code on exit. If the pattern is invalid, this will be set to a failure result.
Stable:
ICU 2.0

virtual void DecimalFormat::applyLocalizedPattern const UnicodeString   pattern,
UParseError   parseError,
UErrorCode   status
[virtual]
 

Apply the given pattern to this Format object.

The pattern is assumed to be in a localized notation. A pattern is a short-hand specification for the various formatting properties. These properties can also be changed individually through the various setter methods.

There is no limit to integer digits are set by this routine, since that is the typical end-user desire; use setMaximumInteger if you want to set a real value. For negative numbers, use a second pattern, separated by a semicolon

 .      Example "#,#00.0#" -> 1,234.56
 
This means a minimum of 2 integer digits, 1 fraction digit, and a maximum of 2 fraction digits.

Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.

In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern.

Parameters:
pattern  The localized pattern to be applied.
parseError  Struct to recieve information on position of error if an error is encountered
status  Output param set to success/failure code on exit. If the pattern is invalid, this will be set to a failure result.
Stable:
ICU 2.0

void DecimalFormat::applyPattern const UnicodeString   pattern,
UBool    localized,
UParseError   parseError,
UErrorCode   status
[private]
 

Does the real work of applying a pattern.

Parameters:
pattern  The pattern to be applied.
localized  If true, the pattern is localized; else false.
parseError  Struct to recieve information on position of error if an error is encountered
status  Output param set to success/failure code on exit. If the pattern is invalid, this will be set to a failure result.

virtual void DecimalFormat::applyPattern const UnicodeString   pattern,
UErrorCode   status
[virtual]
 

Sets the pattern.

Parameters:
pattern  The pattern to be applied.
status  Output param set to success/failure code on exit. If the pattern is invalid, this will be set to a failure result.
Stable:
ICU 2.0

virtual void DecimalFormat::applyPattern const UnicodeString   pattern,
UParseError   parseError,
UErrorCode   status
[virtual]
 

Apply the given pattern to this Format object.

A pattern is a short-hand specification for the various formatting properties. These properties can also be changed individually through the various setter methods.

There is no limit to integer digits are set by this routine, since that is the typical end-user desire; use setMaximumInteger if you want to set a real value. For negative numbers, use a second pattern, separated by a semicolon

 .      Example "#,#00.0#" -> 1,234.56
 
This means a minimum of 2 integer digits, 1 fraction digit, and a maximum of 2 fraction digits.
 .      Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
 
In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern.
Parameters:
pattern  The pattern to be applied.
parseError  Struct to recieve information on position of error if an error is encountered
status  Output param set to success/failure code on exit. If the pattern is invalid, this will be set to a failure result.
Stable:
ICU 2.0

virtual Format* DecimalFormat::clone void    const [virtual]
 

Clone this Format object polymorphically.

The caller owns the result and should delete it when done.

Returns:
a polymorphic copy of this DecimalFormat.
Stable:
ICU 2.0

Reimplemented from Format.

int32_t DecimalFormat::compareAffix const UnicodeString   input,
int32_t    pos,
UBool    isNegative,
UBool    isPrefix
const [private]
 

int32_t DecimalFormat::compareComplexAffix const UnicodeString   affixPat,
const UnicodeString   input,
int32_t    pos
const [private]
 

int32_t DecimalFormat::compareSimpleAffix const UnicodeString   affix,
const UnicodeString   input,
int32_t    pos
[static, private]
 

void DecimalFormat::construct UErrorCode   status,
UParseError   parseErr,
const UnicodeString   pattern = 0,
DecimalFormatSymbols   symbolsToAdopt = 0
[private]
 

Do real work of constructing a new DecimalFormat.

void DecimalFormat::expandAffix const UnicodeString   pattern,
UnicodeString   affix,
double    number,
UBool    doFormat
const [private]
 

void DecimalFormat::expandAffixes   [private]
 

UnicodeString& DecimalFormat::format int64_t    number,
UnicodeString   appendTo
const
 

Redeclared NumberFormat method.

Format an int64 number. These methods call the NumberFormat pure virtual format() methods with the default FieldPosition.

Parameters:
number  The value to be formatted.
appendTo  Output parameter to receive result. Result is appended to existing contents.
Returns:
Reference to 'appendTo' parameter.
Draft:
This API has been introduced in ICU 2.8. It is still in draft state and may be modified in a future release.

Reimplemented from NumberFormat.

UnicodeString & DecimalFormat::format int32_t    number,
UnicodeString   appendTo
const [inline]
 

Redeclared NumberFormat method.

Format a long number. These methods call the NumberFormat pure virtual format() methods with the default FieldPosition.

Parameters:
number  The value to be formatted.
appendTo  Output parameter to receive result. Result is appended to existing contents.
Returns:
Reference to 'appendTo' parameter.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

Definition at line 1361 of file decimfmt.h.

UnicodeString & DecimalFormat::format double    number,
UnicodeString   appendTo
const [inline]
 

Redeclared NumberFormat method.

Format a double number.

Parameters:
number  The value to be formatted.
appendTo  Output parameter to receive result. Result is appended to existing contents.
Returns:
Reference to 'appendTo' parameter.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

Definition at line 1354 of file decimfmt.h.

UnicodeString & DecimalFormat::format const Formattable   obj,
UnicodeString   appendTo,
UErrorCode   status
const [inline]
 

Redeclared NumberFormat method.

Formats an object to produce a string.

Parameters:
obj  The object to format.
appendTo  Output parameter to receive result. Result is appended to existing contents.
status  Output parameter filled in with success or failure status.
Returns:
Reference to 'appendTo' parameter.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

Definition at line 1345 of file decimfmt.h.

virtual UnicodeString& DecimalFormat::format const Formattable   obj,
UnicodeString   appendTo,
FieldPosition   pos,
UErrorCode   status
const [virtual]
 

Format a Formattable using base-10 representation.

Parameters:
obj  The value to be formatted.
appendTo  Output parameter to receive result. Result is appended to existing contents.
pos  On input: an alignment field, if desired. On output: the offsets of the alignment field.
status  Error code indicating success or failure.
Returns:
Reference to 'appendTo' parameter.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual UnicodeString& DecimalFormat::format int64_t    number,
UnicodeString   appendTo,
FieldPosition   pos
const [virtual]
 

Format an int64 number using base-10 representation.

Parameters:
number  The value to be formatted.
appendTo  Output parameter to receive result. Result is appended to existing contents.
pos  On input: an alignment field, if desired. On output: the offsets of the alignment field.
Returns:
Reference to 'appendTo' parameter.
Draft:
This API has been introduced in ICU 2.8. It is still in draft state and may be modified in a future release.

Reimplemented from NumberFormat.

virtual UnicodeString& DecimalFormat::format int32_t    number,
UnicodeString   appendTo,
FieldPosition   pos
const [virtual]
 

Format a long number using base-10 representation.

Parameters:
number  The value to be formatted.
appendTo  Output parameter to receive result. Result is appended to existing contents.
pos  On input: an alignment field, if desired. On output: the offsets of the alignment field.
Returns:
Reference to 'appendTo' parameter.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual UnicodeString& DecimalFormat::format double    number,
UnicodeString   appendTo,
FieldPosition   pos
const [virtual]
 

Format a double or long number using base-10 representation.

Parameters:
number  The value to be formatted.
appendTo  Output parameter to receive result. Result is appended to existing contents.
pos  On input: an alignment field, if desired. On output: the offsets of the alignment field.
Returns:
Reference to 'appendTo' parameter.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

Referenced by format().

const UnicodeString & DecimalFormat::getConstSymbol DecimalFormatSymbols::ENumberFormatSymbol    symbol const [inline, private]
 

Get a decimal format symbol.

Returns a const reference to the symbol string.

Internal:
For internal use only.

Definition at line 1368 of file decimfmt.h.

virtual const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols void    const [virtual]
 

Returns the decimal format symbols, which is generally not changed by the programmer or user.

Returns:
desired DecimalFormatSymbols
See also:
DecimalFormatSymbols
Stable:
ICU 2.0

virtual UClassID DecimalFormat::getDynamicClassID void    const [virtual]
 

Returns a unique class ID POLYMORPHICALLY.

Pure virtual override. This method is to implement a simple version of RTTI, since not all C++ compilers support genuine RTTI. Polymorphic operator==() and clone() methods call this method.

Returns:
The class ID for this object. All objects of a given class have the same class ID. Objects of other classes have different class IDs.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual int32_t DecimalFormat::getFormatWidth void    [virtual]
 

Get the width to which the output of format() is padded.

Returns:
the format width, or zero if no padding is in effect
See also:
setFormatWidth , getPadCharacter , setPadCharacter , getPadPosition , setPadPosition
Stable:
ICU 2.0

int32_t DecimalFormat::getGroupingSize void    const
 

Return the grouping size.

Grouping size is the number of digits between grouping separators in the integer portion of a number. For example, in the number "123,456.78", the grouping size is 3.

Returns:
the grouping size.
See also:
setGroupingSize , NumberFormat::isGroupingUsed , DecimalFormatSymbols::getGroupingSeparator
Stable:
ICU 2.0

virtual int8_t DecimalFormat::getMinimumExponentDigits void    [virtual]
 

Return the minimum exponent digits that will be shown.

Returns:
the minimum exponent digits that will be shown
See also:
setScientificNotation , isScientificNotation , setMinimumExponentDigits , isExponentSignAlwaysShown , setExponentSignAlwaysShown
Stable:
ICU 2.0

int32_t DecimalFormat::getMultiplier void    const
 

Get the multiplier for use in percent, permill, etc.

For a percentage, set the suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent symbol). For a permill, set the suffixes to have "\u2031" and the multiplier to be 1000.

Returns:
the multiplier for use in percent, permill, etc. Examples: with 100, 1.23 -> "123", and "123" -> 1.23
Stable:
ICU 2.0

UnicodeString& DecimalFormat::getNegativePrefix UnicodeString   result const
 

Get the negative prefix.

Parameters:
result  Output param which will receive the negative prefix.
Returns:
A reference to 'result'. Examples: -123, ($123) (with negative suffix), sFr-123
Stable:
ICU 2.0

UnicodeString& DecimalFormat::getNegativeSuffix UnicodeString   result const
 

Get the negative suffix.

Parameters:
result  Output param which will receive the negative suffix.
Returns:
A reference to 'result'. Examples: -123%, ($123) (with positive suffixes)
Stable:
ICU 2.0

virtual UnicodeString DecimalFormat::getPadCharacterString   [virtual]
 

Get the grapheme string (a character, possibly with modifier letters) used to pad to the format width.

The default is " ". Note: The current implementation only stores the first code unit of the pad string.

Returns:
the pad grapheme string
See also:
setFormatWidth , getFormatWidth , setPadCharacter , getPadPosition , setPadPosition
Stable:
ICU 2.0

virtual EPadPosition DecimalFormat::getPadPosition void    [virtual]
 

Get the position at which padding will take place.

This is the location at which padding will be inserted if the result of format() is shorter than the format width.

Returns:
the pad position, one of kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, or kPadAfterSuffix.
See also:
setFormatWidth , getFormatWidth , setPadCharacter , getPadCharacter , setPadPosition , kPadBeforePrefix , kPadAfterPrefix , kPadBeforeSuffix , kPadAfterSuffix
Stable:
ICU 2.0

UnicodeString& DecimalFormat::getPositivePrefix UnicodeString   result const
 

Get the positive prefix.

Parameters:
result  Output param which will receive the positive prefix.
Returns:
A reference to 'result'. Examples: +123, $123, sFr123
Stable:
ICU 2.0

UnicodeString& DecimalFormat::getPositiveSuffix UnicodeString   result const
 

Get the positive suffix.

Parameters:
result  Output param which will receive the positive suffix.
Returns:
A reference to 'result'. Example: 123%
Stable:
ICU 2.0

virtual double DecimalFormat::getRoundingIncrement void    [virtual]
 

Get the rounding increment.

Returns:
A positive rounding increment, or 0.0 if rounding is not in effect.
See also:
setRoundingIncrement , getRoundingMode , setRoundingMode
Stable:
ICU 2.0

virtual ERoundingMode DecimalFormat::getRoundingMode void    [virtual]
 

Get the rounding mode.

Returns:
A rounding mode
See also:
setRoundingIncrement , getRoundingIncrement , setRoundingMode
Stable:
ICU 2.0

int32_t DecimalFormat::getSecondaryGroupingSize void    const
 

Return the secondary grouping size.

In some locales one grouping interval is used for the least significant integer digits (the primary grouping size), and another is used for all others (the secondary grouping size). A formatter supporting a secondary grouping size will return a positive integer unequal to the primary grouping size returned by getGroupingSize(). For example, if the primary grouping size is 4, and the secondary grouping size is 2, then the number 123456789 formats as "1,23,45,6789", and the pattern appears as "#,##,###0".

Returns:
the secondary grouping size, or a value less than one if there is none
See also:
setSecondaryGroupingSize , NumberFormat::isGroupingUsed , DecimalFormatSymbols::getGroupingSeparator
Draft:
This API has been introduced in ICU 2.4. It is still in draft state and may be modified in a future release.

UClassID DecimalFormat::getStaticClassID void    [static]
 

Return the class ID for this class.

This is useful only for comparing to a return value from getDynamicClassID(). For example:

 .      Base* polymorphic_pointer = createPolymorphicObject();
 .      if (polymorphic_pointer->getDynamicClassID() ==
 .          Derived::getStaticClassID()) ...
 
Returns:
The class ID for all objects of this class.
Stable:
ICU 2.0

UBool DecimalFormat::isDecimalSeparatorAlwaysShown void    const
 

Allows you to get the behavior of the decimal separator with integers.

(The decimal separator will always appear with decimals.)

Returns:
TRUE if the decimal separator always appear with decimals. Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
Stable:
ICU 2.0

virtual UBool DecimalFormat::isExponentSignAlwaysShown void    [virtual]
 

Return whether the exponent sign is always shown.

Returns:
TRUE if the exponent is always prefixed with either the localized minus sign or the localized plus sign, false if only negative exponents are prefixed with the localized minus sign.
See also:
setScientificNotation , isScientificNotation , setMinimumExponentDigits , getMinimumExponentDigits , setExponentSignAlwaysShown
Stable:
ICU 2.0

UBool DecimalFormat::isGroupingPosition int32_t    pos const [private]
 

virtual UBool DecimalFormat::isScientificNotation void    [virtual]
 

Return whether or not scientific notation is used.

Returns:
TRUE if this object formats and parses scientific notation
See also:
setScientificNotation , getMinimumExponentDigits , setMinimumExponentDigits , isExponentSignAlwaysShown , setExponentSignAlwaysShown
Stable:
ICU 2.0

int32_t DecimalFormat::match const UnicodeString   text,
int32_t    pos,
const UnicodeString   str
[static, private]
 

int32_t DecimalFormat::match const UnicodeString   text,
int32_t    pos,
UChar32    ch
[static, private]
 

DecimalFormat& DecimalFormat::operator= const DecimalFormat &    rhs
 

Assignment operator.

Parameters:
rhs  the DecimalFormat object to be copied.
Stable:
ICU 2.0

virtual UBool DecimalFormat::operator== const Format   other const [virtual]
 

Return true if the given Format objects are semantically equal.

Objects of different subclasses are considered unequal.

Parameters:
other  the object to be compared with.
Returns:
true if the given Format objects are semantically equal.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual void DecimalFormat::parse const UnicodeString   text,
Formattable   result,
UErrorCode   status
const [virtual]
 

Parse the given string using this object's choices.

Parameters:
text  The text to be parsed.
result  Formattable to be set to the parse result.
status  Output parameter filled in with success or failure status.
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual void DecimalFormat::parse const UnicodeString   text,
Formattable   result,
ParsePosition   parsePosition
const [virtual]
 

Parse the given string using this object's choices.

The method does string comparisons to try to find an optimal match. If no object can be parsed, index is unchanged, and NULL is returned. The result is returned as the most parsimonious type of Formattable that will accomodate all of the necessary precision. For example, if the result is exactly 12, it will be returned as a long. However, if it is 1.5, it will be returned as a double.

Parameters:
text  The text to be parsed.
result  Formattable to be set to the parse result. If parse fails, return contents are undefined.
parsePosition  The position to start parsing at on input. On output, moved to after the last successfully parse character. On parse failure, does not change.
See also:
Formattable
Stable:
ICU 2.0

Reimplemented from NumberFormat.

int32_t DecimalFormat::precision UBool    isIntegral const [private]
 

double DecimalFormat::round double    a,
ERoundingMode    mode,
UBool    isNegative
[static, private]
 

virtual void DecimalFormat::setCurrency const UChar *    theCurrency [virtual]
 

Sets the currency used to display currency amounts.

This takes effect immediately, if this format is a currency format. If this format is not a currency format, then the currency is used if and when this object becomes a currency format through the application of a new pattern.

Parameters:
theCurrency  a 3-letter ISO code indicating new currency to use. It need not be null-terminated.
Stable:
ICU 2.2

Reimplemented from NumberFormat.

void DecimalFormat::setCurrencyForLocale const char *    locale,
UErrorCode   ec
[private]
 

void DecimalFormat::setCurrencyForSymbols   [private]
 

virtual void DecimalFormat::setDecimalFormatSymbols const DecimalFormatSymbols   symbols [virtual]
 

Sets the decimal format symbols, which is generally not changed by the programmer or user.

Parameters:
symbols  DecimalFormatSymbols.
Stable:
ICU 2.0

virtual void DecimalFormat::setDecimalSeparatorAlwaysShown UBool    newValue [virtual]
 

Allows you to set the behavior of the decimal separator with integers.

(The decimal separator will always appear with decimals.)

Parameters:
newValue  set TRUE if the decimal separator will always appear with decimals. Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
Stable:
ICU 2.0

virtual void DecimalFormat::setExponentSignAlwaysShown UBool    expSignAlways [virtual]
 

Set whether the exponent sign is always shown.

This has no effect unless scientific notation is in use.

Parameters:
expSignAlways  TRUE if the exponent is always prefixed with either the localized minus sign or the localized plus sign, false if only negative exponents are prefixed with the localized minus sign.
See also:
setScientificNotation , isScientificNotation , setMinimumExponentDigits , getMinimumExponentDigits , isExponentSignAlwaysShown
Stable:
ICU 2.0

virtual void DecimalFormat::setFormatWidth int32_t    width [virtual]
 

Set the width to which the output of format() is padded.

This method also controls whether padding is enabled.

Parameters:
width  the width to which to pad the result of format(), or zero to disable padding. A negative width is equivalent to 0.
See also:
getFormatWidth , getPadCharacter , setPadCharacter , getPadPosition , setPadPosition
Stable:
ICU 2.0

virtual void DecimalFormat::setGroupingSize int32_t    newValue [virtual]
 

Set the grouping size.

Grouping size is the number of digits between grouping separators in the integer portion of a number. For example, in the number "123,456.78", the grouping size is 3.

Parameters:
newValue  the new value of the grouping size.
See also:
getGroupingSize , NumberFormat::setGroupingUsed , DecimalFormatSymbols::setGroupingSeparator
Stable:
ICU 2.0

virtual void DecimalFormat::setMaximumFractionDigits int32_t    newValue [virtual]
 

Sets the maximum number of digits allowed in the fraction portion of a number.

This override limits the fraction digit count to 340.

Parameters:
newValue  the new value of the maximum number of digits allowed in the fraction portion of a number.
See also:
NumberFormat::setMaximumFractionDigits
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual void DecimalFormat::setMaximumIntegerDigits int32_t    newValue [virtual]
 

Sets the maximum number of digits allowed in the integer portion of a number.

This override limits the integer digit count to 309.

Parameters:
newValue  the new value of the maximum number of digits allowed in the integer portion of a number.
See also:
NumberFormat::setMaximumIntegerDigits
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual void DecimalFormat::setMinimumExponentDigits int8_t    minExpDig [virtual]
 

Set the minimum exponent digits that will be shown.

This has no effect unless scientific notation is in use.

Parameters:
minExpDig  a value >= 1 indicating the fewest exponent digits that will be shown. Values less than 1 will be treated as 1.
See also:
setScientificNotation , isScientificNotation , getMinimumExponentDigits , isExponentSignAlwaysShown , setExponentSignAlwaysShown
Stable:
ICU 2.0

virtual void DecimalFormat::setMinimumFractionDigits int32_t    newValue [virtual]
 

Sets the minimum number of digits allowed in the fraction portion of a number.

This override limits the fraction digit count to 340.

Parameters:
newValue  the new value of the minimum number of digits allowed in the fraction portion of a number.
See also:
NumberFormat::setMinimumFractionDigits
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual void DecimalFormat::setMinimumIntegerDigits int32_t    newValue [virtual]
 

Sets the minimum number of digits allowed in the integer portion of a number.

This override limits the integer digit count to 309.

Parameters:
newValue  the new value of the minimum number of digits allowed in the integer portion of a number.
See also:
NumberFormat::setMinimumIntegerDigits
Stable:
ICU 2.0

Reimplemented from NumberFormat.

virtual void DecimalFormat::setMultiplier int32_t    newValue [virtual]
 

Set the multiplier for use in percent, permill, etc.

For a percentage, set the suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent symbol). For a permill, set the suffixes to have "\u2031" and the multiplier to be 1000.

Parameters:
newValue  the new value of the multiplier for use in percent, permill, etc. Examples: with 100, 1.23 -> "123", and "123" -> 1.23
Stable:
ICU 2.0

virtual void DecimalFormat::setNegativePrefix const UnicodeString   newValue [virtual]
 

Set the negative prefix.

Parameters:
newValue  the new value of the the negative prefix to be set. Examples: -123, ($123) (with negative suffix), sFr-123
Stable:
ICU 2.0

virtual void DecimalFormat::setNegativeSuffix const UnicodeString   newValue [virtual]
 

Set the negative suffix.

Parameters:
newValue  the new value of the negative suffix to be set. Examples: 123%
Stable:
ICU 2.0

virtual void DecimalFormat::setPadCharacter const UnicodeString   padChar [virtual]
 

Set the grapheme string (a character, possibly with modifier letters) used to pad to the format width.

This has no effect unless padding is enabled. Note: The current implementation only stores the first code unit of the pad string.

Parameters:
padChar  the pad grapheme
See also:
setFormatWidth , getFormatWidth , getPadCharacter , getPadPosition , setPadPosition
Stable:
ICU 2.0

virtual void DecimalFormat::setPadPosition EPadPosition    padPos [virtual]
 

<font face=helvetica color=red>NEW</font> Set the position at which padding will take place.

This is the location at which padding will be inserted if the result of format() is shorter than the format width. This has no effect unless padding is enabled.

Parameters:
padPos  the pad position, one of kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, or kPadAfterSuffix.
See also:
setFormatWidth , getFormatWidth , setPadCharacter , getPadCharacter , getPadPosition , kPadBeforePrefix , kPadAfterPrefix , kPadBeforeSuffix , kPadAfterSuffix
Stable:
ICU 2.0

virtual void DecimalFormat::setPositivePrefix const UnicodeString   newValue [virtual]
 

Set the positive prefix.

Parameters:
newValue  the new value of the the positive prefix to be set. Examples: +123, $123, sFr123
Stable:
ICU 2.0

virtual void DecimalFormat::setPositiveSuffix const UnicodeString   newValue [virtual]
 

Set the positive suffix.

Parameters:
newValue  the new value of the positive suffix to be set. Example: 123%
Stable:
ICU 2.0

virtual void DecimalFormat::setRoundingIncrement double    newValue [virtual]
 

Set the rounding increment.

This method also controls whether rounding is enabled.

Parameters:
newValue  A positive rounding increment, or 0.0 to disable rounding. Negative increments are equivalent to 0.0.
See also:
getRoundingIncrement , getRoundingMode , setRoundingMode
Stable:
ICU 2.0

virtual void DecimalFormat::setRoundingMode ERoundingMode    roundingMode [virtual]
 

Set the rounding mode.

This has no effect unless the rounding increment is greater than zero.

Parameters:
roundingMode  A rounding mode
See also:
setRoundingIncrement , getRoundingIncrement , getRoundingMode
Stable:
ICU 2.0

virtual void DecimalFormat::setScientificNotation UBool    useScientific [virtual]
 

Set whether or not scientific notation is used.

When scientific notation is used, the effective maximum number of integer digits is <= 8. If the maximum number of integer digits is set to more than 8, the effective maximum will be 1. This allows this call to generate a 'default' scientific number format without additional changes.

Parameters:
useScientific  TRUE if this object formats and parses scientific notation
See also:
isScientificNotation , getMinimumExponentDigits , setMinimumExponentDigits , isExponentSignAlwaysShown , setExponentSignAlwaysShown
Stable:
ICU 2.0

virtual void DecimalFormat::setSecondaryGroupingSize int32_t    newValue [virtual]
 

Set the secondary grouping size.

If set to a value less than 1, then secondary grouping is turned off, and the primary grouping size is used for all intervals, not just the least significant.

Parameters:
newValue  the new value of the secondary grouping size.
See also:
getSecondaryGroupingSize , NumberFormat::setGroupingUsed , DecimalFormatSymbols::setGroupingSeparator
Draft:
This API has been introduced in ICU 2.4. It is still in draft state and may be modified in a future release.

int32_t DecimalFormat::skipPadding const UnicodeString   text,
int32_t    position
const [private]
 

int32_t DecimalFormat::skipRuleWhiteSpace const UnicodeString   text,
int32_t    pos
[static, private]
 

int32_t DecimalFormat::skipUWhiteSpace const UnicodeString   text,
int32_t    pos
[static, private]
 

UnicodeString& DecimalFormat::subformat UnicodeString   appendTo,
FieldPosition   fieldPosition,
DigitList   digits,
UBool    isInteger
const [private]
 

Do the work of formatting a number, either a double or a long.

Parameters:
appendTo  Output parameter to receive result. Result is appended to existing contents.
fieldPosition  On input: an alignment field, if desired. On output: the offsets of the alignment field.
digits  the digits to be formatted.
isInteger  if TRUE format the digits as Integer.
Returns:
Reference to 'appendTo' parameter.

UBool DecimalFormat::subparse const UnicodeString   text,
ParsePosition   parsePosition,
DigitList   digits,
UBool   status
const [private]
 

Parse the given text into a number.

The text is parsed beginning at parsePosition, until an unparseable character is seen.

Parameters:
text  The string to parse.
parsePosition  The position at which to being parsing. Upon return, the first unparseable character.
digits  The DigitList to set to the parsed value.
isExponent  If true, parse an exponent. This means no infinite values and integer only.
status  Upon return contains boolean status flags indicating whether the value was infinite and whether it was positive.

virtual UnicodeString& DecimalFormat::toLocalizedPattern UnicodeString   result const [virtual]
 

Synthesizes a localized pattern string that represents the current state of this Format object.

Parameters:
result  Output param which will receive the localized pattern. Previous contents are deleted.
Returns:
A reference to 'result'.
See also:
applyPattern
Stable:
ICU 2.0

UnicodeString& DecimalFormat::toPattern UnicodeString   result,
UBool    localized
const [private]
 

Does the real work of generating a pattern.

Parameters:
result  Output param which will receive the pattern. Previous contents are deleted.
localized  TRUE return localized pattern.
Returns:
A reference to 'result'.

virtual UnicodeString& DecimalFormat::toPattern UnicodeString   result const [virtual]
 

Synthesizes a pattern string that represents the current state of this Format object.

Parameters:
result  Output param which will receive the pattern. Previous contents are deleted.
Returns:
A reference to 'result'.
See also:
applyPattern
Stable:
ICU 2.0


Member Data Documentation

enum { ... } DecimalFormat::StatusFlags [private]
 

ChoiceFormat* DecimalFormat::fCurrencyChoice [private]
 

Formatter for ChoiceFormat-based currency names.

If this field is not null, then delegate to it to format currency symbols.

Since:
ICU 2.6

Definition at line 1297 of file decimfmt.h.

UBool DecimalFormat::fDecimalSeparatorAlwaysShown [private]
 

Definition at line 1302 of file decimfmt.h.

UBool DecimalFormat::fExponentSignAlwaysShown [private]
 

Definition at line 1308 of file decimfmt.h.

int32_t DecimalFormat::fFormatWidth [private]
 

Definition at line 1319 of file decimfmt.h.

int32_t DecimalFormat::fGroupingSize [private]
 

Definition at line 1300 of file decimfmt.h.

int32_t DecimalFormat::fGroupingSize2 [private]
 

Definition at line 1301 of file decimfmt.h.

UBool DecimalFormat::fIsCurrencyFormat [private]
 

Definition at line 1303 of file decimfmt.h.

int8_t DecimalFormat::fMinExponentDigits [private]
 

Definition at line 1307 of file decimfmt.h.

int32_t DecimalFormat::fMultiplier [private]
 

Definition at line 1299 of file decimfmt.h.

UnicodeString* DecimalFormat::fNegPrefixPattern [private]
 

Definition at line 1289 of file decimfmt.h.

UnicodeString* DecimalFormat::fNegSuffixPattern [private]
 

Definition at line 1290 of file decimfmt.h.

UnicodeString DecimalFormat::fNegativePrefix [private]
 

Definition at line 1285 of file decimfmt.h.

UnicodeString DecimalFormat::fNegativeSuffix [private]
 

Definition at line 1286 of file decimfmt.h.

UChar32 DecimalFormat::fPad [private]
 

Definition at line 1318 of file decimfmt.h.

EPadPosition DecimalFormat::fPadPosition [private]
 

Definition at line 1320 of file decimfmt.h.

UnicodeString* DecimalFormat::fPosPrefixPattern [private]
 

Definition at line 1287 of file decimfmt.h.

UnicodeString* DecimalFormat::fPosSuffixPattern [private]
 

Definition at line 1288 of file decimfmt.h.

UnicodeString DecimalFormat::fPositivePrefix [private]
 

Constants.

Definition at line 1283 of file decimfmt.h.

UnicodeString DecimalFormat::fPositiveSuffix [private]
 

Definition at line 1284 of file decimfmt.h.

double DecimalFormat::fRoundingDouble [private]
 

Definition at line 1315 of file decimfmt.h.

DigitList* DecimalFormat::fRoundingIncrement [private]
 

Definition at line 1314 of file decimfmt.h.

ERoundingMode DecimalFormat::fRoundingMode [private]
 

Definition at line 1316 of file decimfmt.h.

DecimalFormatSymbols* DecimalFormat::fSymbols [private]
 

Definition at line 1304 of file decimfmt.h.

UBool DecimalFormat::fUseExponentialNotation [private]
 

Definition at line 1306 of file decimfmt.h.

const char DecimalFormat::fgNumberPatterns[] [static]
 

The resource tags we use to retrieve decimal format data from locale resource bundles.

Stable:
ICU 2.0

Definition at line 1108 of file decimfmt.h.

const int32_t DecimalFormat::kDoubleFractionDigits [static, protected]
 

number of fraction digits.

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

Definition at line 1330 of file decimfmt.h.

const int32_t DecimalFormat::kDoubleIntegerDigits [static, protected]
 

number of integer digits.

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

Definition at line 1326 of file decimfmt.h.

const int32_t DecimalFormat::kMaxScientificIntegerDigits [static, protected]
 

When someone turns on scientific mode, we assume that more than this number of digits is due to flipping from some other mode that didn't restrict the maximum, and so we force 1 integer digit.

We don't bother to track and see if someone is using exponential notation with more than this number, it wouldn't make sense anyway, and this is just to make sure that someone turning on scientific mode with default settings doesn't end up with lots of zeroes.

Definition at line 1341 of file decimfmt.h.


The documentation for this class was generated from the following file:
Generated on Mon Nov 24 14:36:29 2003 for ICU 2.8 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001