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

UnicodeString & NumberFormat::format ( const DigitList number,
UnicodeString appendTo,
FieldPosition pos,
UErrorCode status 
) const [virtual, inherited]

Format a decimal number. The number is a DigitList wrapper onto a floating point decimal number. The default implementation in NumberFormat converts the decimal number to a double and formats that. Subclasses of NumberFormat that want to specifically handle big decimal numbers must override this method. class DecimalFormat does so.

number The number, a DigitList format Decimal Floating Point.
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 Output param filled with success/failure status.
Reference to 'appendTo' parameter.

For internal use only.

Reimplemented in DecimalFormat.

Definition at line 422 of file numfmt.cpp.

References NumberFormat::format(), DigitList::getDouble(), and U_FAILURE.

    // DecimalFormat overrides this function, and handles DigitList based big decimals.
    // Other subclasses (ChoiceFormat, RuleBasedNumberFormat) do not (yet) handle DigitLists,
    // so this default implementation falls back to formatting decimal numbers as doubles.
    if (U_FAILURE(status)) {
        return appendTo;
    double dnum = number.getDouble();
    format(dnum, appendTo, pos, status);
    return appendTo;

Generated by  Doxygen 1.6.0   Back to index