ICU-20517 Removing dead code in rbnf.cpp

This commit is contained in:
Shane Carr 2019-08-08 16:44:39 -07:00 committed by Shane F. Carr
parent 3879315738
commit 5e7ff44f91
2 changed files with 0 additions and 61 deletions

View file

@ -1110,45 +1110,6 @@ RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status
return NULL;
}
UnicodeString&
RuleBasedNumberFormat::format(const DecimalQuantity &number,
UnicodeString &appendTo,
FieldPositionIterator *posIter,
UErrorCode &status) const {
if (U_FAILURE(status)) {
return appendTo;
}
DecimalQuantity copy(number);
if (copy.fitsInLong()) {
format(number.toLong(), appendTo, posIter, status);
}
else {
copy.roundToMagnitude(0, number::impl::RoundingMode::UNUM_ROUND_HALFEVEN, status);
if (copy.fitsInLong()) {
format(number.toDouble(), appendTo, posIter, status);
}
else {
// We're outside of our normal range that this framework can handle.
// The DecimalFormat will provide more accurate results.
// TODO this section should probably be optimized. The DecimalFormat is shared in ICU4J.
LocalPointer<NumberFormat> decimalFormat(NumberFormat::createInstance(locale, UNUM_DECIMAL, status), status);
if (decimalFormat.isNull()) {
return appendTo;
}
Formattable f;
LocalPointer<DecimalQuantity> decimalQuantity(new DecimalQuantity(number), status);
if (decimalQuantity.isNull()) {
return appendTo;
}
f.adoptDecimalQuantity(decimalQuantity.orphan()); // f now owns decimalQuantity.
decimalFormat->format(f, appendTo, posIter, status);
}
}
return appendTo;
}
UnicodeString&
RuleBasedNumberFormat::format(const DecimalQuantity &number,
UnicodeString& appendTo,

View file

@ -868,28 +868,6 @@ public:
UErrorCode& status) const;
protected:
/**
* 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.
*
* @param number The number, a DigitList format Decimal Floating Point.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @internal
*/
virtual UnicodeString& format(const number::impl::DecimalQuantity &number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a decimal number.
* The number is a DigitList wrapper onto a floating point decimal number.