ICU-13634 Fixing remaining build warnings. In principle, formatting should work fully. Not yet tested.
X-SVN-Rev: 41109
This commit is contained in:
parent
00a23a07f7
commit
9828c56014
@ -10,23 +10,38 @@
|
||||
#define UNISTR_FROM_STRING_EXPLICIT
|
||||
|
||||
#include "unicode/compactdecimalformat.h"
|
||||
#include "number_decimfmtprops.h"
|
||||
|
||||
using namespace icu;
|
||||
|
||||
|
||||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CompactDecimalFormat)
|
||||
|
||||
|
||||
CompactDecimalFormat*
|
||||
CompactDecimalFormat::createInstance(const Locale& inLocale, UNumberCompactStyle style,
|
||||
UErrorCode& status) {}
|
||||
UErrorCode& status) {
|
||||
return new CompactDecimalFormat(inLocale, style, status);
|
||||
}
|
||||
|
||||
CompactDecimalFormat::CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style,
|
||||
UErrorCode& status)
|
||||
: DecimalFormat(new DecimalFormatSymbols(inLocale, status), status) {
|
||||
// Minimal properties: let the non-shim code path do most of the logic for us.
|
||||
fProperties->compactStyle = style;
|
||||
fProperties->groupingSize = -2; // do not forward grouping information
|
||||
fProperties->minimumGroupingDigits = 2;
|
||||
refreshFormatter(status);
|
||||
}
|
||||
|
||||
CompactDecimalFormat::CompactDecimalFormat(const CompactDecimalFormat& source) = default;
|
||||
|
||||
CompactDecimalFormat::~CompactDecimalFormat() = default;
|
||||
|
||||
CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat& rhs) {}
|
||||
|
||||
UClassID CompactDecimalFormat::getStaticClassID() {}
|
||||
|
||||
UClassID CompactDecimalFormat::getDynamicClassID() const {}
|
||||
CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat& rhs) {
|
||||
DecimalFormat::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
@ -29,6 +29,9 @@ using ERoundingMode = icu::DecimalFormat::ERoundingMode;
|
||||
using EPadPosition = icu::DecimalFormat::EPadPosition;
|
||||
|
||||
|
||||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DecimalFormat)
|
||||
|
||||
|
||||
DecimalFormat::DecimalFormat(UErrorCode& status)
|
||||
: DecimalFormat(nullptr, status) {
|
||||
}
|
||||
@ -446,13 +449,14 @@ DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo, Fi
|
||||
return appendTo;
|
||||
}
|
||||
|
||||
void
|
||||
DecimalFormat::parse(const UnicodeString& text, Formattable& result, ParsePosition& parsePosition) const {
|
||||
void DecimalFormat::parse(const UnicodeString& /*text*/, Formattable& /*result*/,
|
||||
ParsePosition& /*parsePosition*/) const {
|
||||
// FIXME
|
||||
}
|
||||
|
||||
CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& text, ParsePosition& pos) const {
|
||||
CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& /*text*/, ParsePosition& /*pos*/) const {
|
||||
// FIXME
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols(void) const {
|
||||
@ -855,28 +859,36 @@ UCurrencyUsage DecimalFormat::getCurrencyUsage() const {
|
||||
|
||||
void
|
||||
DecimalFormat::formatToDecimalQuantity(double number, DecimalQuantity& output, UErrorCode& status) const {
|
||||
// TODO
|
||||
status = U_UNSUPPORTED_ERROR;
|
||||
fFormatter->formatDouble(number, status).getDecimalQuantity(output, status);
|
||||
}
|
||||
|
||||
void DecimalFormat::formatToDecimalQuantity(const Formattable& number, DecimalQuantity& output,
|
||||
UErrorCode& status) const {
|
||||
// TODO
|
||||
status = U_UNSUPPORTED_ERROR;
|
||||
// Check if the Formattable is a DecimalQuantity
|
||||
DecimalQuantity* dq = number.getDecimalQuantity();
|
||||
if (dq != nullptr) {
|
||||
fFormatter->formatDecimalQuantity(*dq, status).getDecimalQuantity(output, status);
|
||||
return;
|
||||
}
|
||||
|
||||
// If not, it must be Double, Long (int32_t), or Int64:
|
||||
switch (number.getType()) {
|
||||
case Formattable::kDouble:
|
||||
fFormatter->formatDouble(number.getDouble(), status).getDecimalQuantity(output, status);
|
||||
break;
|
||||
case Formattable::kLong:
|
||||
fFormatter->formatInt(number.getLong(), status).getDecimalQuantity(output, status);
|
||||
break;
|
||||
case Formattable::kInt64:
|
||||
default:
|
||||
fFormatter->formatInt(number.getInt64(), status).getDecimalQuantity(output, status);
|
||||
}
|
||||
}
|
||||
|
||||
const number::LocalizedNumberFormatter& DecimalFormat::toNumberFormatter() const {
|
||||
return *fFormatter;
|
||||
}
|
||||
|
||||
UClassID DecimalFormat::getStaticClassID() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
UClassID DecimalFormat::getDynamicClassID() const {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/** Rebuilds the formatter object from the property bag. */
|
||||
void DecimalFormat::refreshFormatter(UErrorCode& status) {
|
||||
if (fExportedProperties == nullptr) {
|
||||
|
@ -74,13 +74,14 @@ NumberParserImpl::createSimpleParser(const Locale& locale, const UnicodeString&
|
||||
return parser;
|
||||
}
|
||||
|
||||
NumberParserImpl* NumberParserImpl::createParserFromProperties(
|
||||
const number::impl::DecimalFormatProperties& properties, DecimalFormatSymbols symbols,
|
||||
bool parseCurrency, bool optimize, UErrorCode& status) {
|
||||
// TODO
|
||||
status = U_UNSUPPORTED_ERROR;
|
||||
return nullptr;
|
||||
}
|
||||
//NumberParserImpl*
|
||||
//NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatProperties& properties,
|
||||
// DecimalFormatSymbols symbols, bool parseCurrency,
|
||||
// bool optimize, UErrorCode& status) {
|
||||
// // TODO
|
||||
// status = U_UNSUPPORTED_ERROR;
|
||||
// return nullptr;
|
||||
//}
|
||||
|
||||
NumberParserImpl::NumberParserImpl(parse_flags_t parseFlags, bool computeLeads)
|
||||
: fParseFlags(parseFlags), fComputeLeads(computeLeads) {
|
||||
|
@ -112,7 +112,10 @@ public:
|
||||
* other classes have different class IDs.
|
||||
* @stable ICU 51
|
||||
*/
|
||||
virtual UClassID getDynamicClassID() const U_OVERRIDE;
|
||||
UClassID getDynamicClassID() const U_OVERRIDE;
|
||||
|
||||
private:
|
||||
CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
@ -60,11 +60,9 @@ class CurrencyPluralInfo;
|
||||
class Hashtable;
|
||||
class UnicodeSet;
|
||||
class FieldPositionHandler;
|
||||
class DecimalFormatStaticSets;
|
||||
class FixedDecimal;
|
||||
class DecimalFormatImpl;
|
||||
class PluralRules;
|
||||
class VisibleDigitsWithExponent;
|
||||
class CompactDecimalFormat;
|
||||
|
||||
namespace number {
|
||||
class LocalizedNumberFormatter;
|
||||
@ -1975,7 +1973,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
|
||||
* other classes have different class IDs.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
virtual UClassID getDynamicClassID(void) const U_OVERRIDE;
|
||||
UClassID getDynamicClassID(void) const U_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
@ -2030,6 +2028,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
|
||||
LocalPointer<const numparse::impl::NumberParserImpl> fParser;
|
||||
LocalPointer<const numparse::impl::NumberParserImpl> fParserWithCurrency;
|
||||
|
||||
// Allow child class CompactDecimalFormat to access fProperties:
|
||||
friend class CompactDecimalFormat;
|
||||
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
Loading…
Reference in New Issue
Block a user