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
|
#define UNISTR_FROM_STRING_EXPLICIT
|
||||||
|
|
||||||
#include "unicode/compactdecimalformat.h"
|
#include "unicode/compactdecimalformat.h"
|
||||||
|
#include "number_decimfmtprops.h"
|
||||||
|
|
||||||
using namespace icu;
|
using namespace icu;
|
||||||
|
|
||||||
|
|
||||||
|
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CompactDecimalFormat)
|
||||||
|
|
||||||
|
|
||||||
CompactDecimalFormat*
|
CompactDecimalFormat*
|
||||||
CompactDecimalFormat::createInstance(const Locale& inLocale, UNumberCompactStyle style,
|
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(const CompactDecimalFormat& source) = default;
|
||||||
|
|
||||||
CompactDecimalFormat::~CompactDecimalFormat() = default;
|
CompactDecimalFormat::~CompactDecimalFormat() = default;
|
||||||
|
|
||||||
CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat& rhs) {}
|
CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat& rhs) {
|
||||||
|
DecimalFormat::operator=(rhs);
|
||||||
UClassID CompactDecimalFormat::getStaticClassID() {}
|
return *this;
|
||||||
|
}
|
||||||
UClassID CompactDecimalFormat::getDynamicClassID() const {}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||||
|
@ -29,6 +29,9 @@ using ERoundingMode = icu::DecimalFormat::ERoundingMode;
|
|||||||
using EPadPosition = icu::DecimalFormat::EPadPosition;
|
using EPadPosition = icu::DecimalFormat::EPadPosition;
|
||||||
|
|
||||||
|
|
||||||
|
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DecimalFormat)
|
||||||
|
|
||||||
|
|
||||||
DecimalFormat::DecimalFormat(UErrorCode& status)
|
DecimalFormat::DecimalFormat(UErrorCode& status)
|
||||||
: DecimalFormat(nullptr, status) {
|
: DecimalFormat(nullptr, status) {
|
||||||
}
|
}
|
||||||
@ -446,13 +449,14 @@ DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo, Fi
|
|||||||
return appendTo;
|
return appendTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void DecimalFormat::parse(const UnicodeString& /*text*/, Formattable& /*result*/,
|
||||||
DecimalFormat::parse(const UnicodeString& text, Formattable& result, ParsePosition& parsePosition) const {
|
ParsePosition& /*parsePosition*/) const {
|
||||||
// FIXME
|
// FIXME
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& text, ParsePosition& pos) const {
|
CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& /*text*/, ParsePosition& /*pos*/) const {
|
||||||
// FIXME
|
// FIXME
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols(void) const {
|
const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols(void) const {
|
||||||
@ -855,28 +859,36 @@ UCurrencyUsage DecimalFormat::getCurrencyUsage() const {
|
|||||||
|
|
||||||
void
|
void
|
||||||
DecimalFormat::formatToDecimalQuantity(double number, DecimalQuantity& output, UErrorCode& status) const {
|
DecimalFormat::formatToDecimalQuantity(double number, DecimalQuantity& output, UErrorCode& status) const {
|
||||||
// TODO
|
fFormatter->formatDouble(number, status).getDecimalQuantity(output, status);
|
||||||
status = U_UNSUPPORTED_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecimalFormat::formatToDecimalQuantity(const Formattable& number, DecimalQuantity& output,
|
void DecimalFormat::formatToDecimalQuantity(const Formattable& number, DecimalQuantity& output,
|
||||||
UErrorCode& status) const {
|
UErrorCode& status) const {
|
||||||
// TODO
|
// Check if the Formattable is a DecimalQuantity
|
||||||
status = U_UNSUPPORTED_ERROR;
|
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 {
|
const number::LocalizedNumberFormatter& DecimalFormat::toNumberFormatter() const {
|
||||||
return *fFormatter;
|
return *fFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
UClassID DecimalFormat::getStaticClassID() {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
UClassID DecimalFormat::getDynamicClassID() const {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Rebuilds the formatter object from the property bag. */
|
/** Rebuilds the formatter object from the property bag. */
|
||||||
void DecimalFormat::refreshFormatter(UErrorCode& status) {
|
void DecimalFormat::refreshFormatter(UErrorCode& status) {
|
||||||
if (fExportedProperties == nullptr) {
|
if (fExportedProperties == nullptr) {
|
||||||
|
@ -74,13 +74,14 @@ NumberParserImpl::createSimpleParser(const Locale& locale, const UnicodeString&
|
|||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberParserImpl* NumberParserImpl::createParserFromProperties(
|
//NumberParserImpl*
|
||||||
const number::impl::DecimalFormatProperties& properties, DecimalFormatSymbols symbols,
|
//NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatProperties& properties,
|
||||||
bool parseCurrency, bool optimize, UErrorCode& status) {
|
// DecimalFormatSymbols symbols, bool parseCurrency,
|
||||||
// TODO
|
// bool optimize, UErrorCode& status) {
|
||||||
status = U_UNSUPPORTED_ERROR;
|
// // TODO
|
||||||
return nullptr;
|
// status = U_UNSUPPORTED_ERROR;
|
||||||
}
|
// return nullptr;
|
||||||
|
//}
|
||||||
|
|
||||||
NumberParserImpl::NumberParserImpl(parse_flags_t parseFlags, bool computeLeads)
|
NumberParserImpl::NumberParserImpl(parse_flags_t parseFlags, bool computeLeads)
|
||||||
: fParseFlags(parseFlags), fComputeLeads(computeLeads) {
|
: fParseFlags(parseFlags), fComputeLeads(computeLeads) {
|
||||||
|
@ -112,7 +112,10 @@ public:
|
|||||||
* other classes have different class IDs.
|
* other classes have different class IDs.
|
||||||
* @stable ICU 51
|
* @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
|
U_NAMESPACE_END
|
||||||
|
@ -60,11 +60,9 @@ class CurrencyPluralInfo;
|
|||||||
class Hashtable;
|
class Hashtable;
|
||||||
class UnicodeSet;
|
class UnicodeSet;
|
||||||
class FieldPositionHandler;
|
class FieldPositionHandler;
|
||||||
class DecimalFormatStaticSets;
|
|
||||||
class FixedDecimal;
|
class FixedDecimal;
|
||||||
class DecimalFormatImpl;
|
|
||||||
class PluralRules;
|
class PluralRules;
|
||||||
class VisibleDigitsWithExponent;
|
class CompactDecimalFormat;
|
||||||
|
|
||||||
namespace number {
|
namespace number {
|
||||||
class LocalizedNumberFormatter;
|
class LocalizedNumberFormatter;
|
||||||
@ -1975,7 +1973,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
|
|||||||
* other classes have different class IDs.
|
* other classes have different class IDs.
|
||||||
* @stable ICU 2.0
|
* @stable ICU 2.0
|
||||||
*/
|
*/
|
||||||
virtual UClassID getDynamicClassID(void) const U_OVERRIDE;
|
UClassID getDynamicClassID(void) const U_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -2030,6 +2028,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
|
|||||||
LocalPointer<const numparse::impl::NumberParserImpl> fParser;
|
LocalPointer<const numparse::impl::NumberParserImpl> fParser;
|
||||||
LocalPointer<const numparse::impl::NumberParserImpl> fParserWithCurrency;
|
LocalPointer<const numparse::impl::NumberParserImpl> fParserWithCurrency;
|
||||||
|
|
||||||
|
// Allow child class CompactDecimalFormat to access fProperties:
|
||||||
|
friend class CompactDecimalFormat;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
|
Loading…
Reference in New Issue
Block a user