2019-01-11 07:42:43 +00:00
|
|
|
// © 2019 and later: Unicode, Inc. and others.
|
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
|
|
|
#include "unicode/numberformatter.h"
|
|
|
|
#include "number_utypes.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "number_decimalquantity.h"
|
2019-08-14 22:47:41 +00:00
|
|
|
#include "number_decnum.h"
|
2019-01-11 07:42:43 +00:00
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
namespace number {
|
|
|
|
|
|
|
|
|
2019-02-15 06:42:09 +00:00
|
|
|
UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber)
|
2019-01-11 07:42:43 +00:00
|
|
|
|
2019-03-23 00:43:28 +00:00
|
|
|
#define UPRV_NOARG
|
2019-01-11 07:42:43 +00:00
|
|
|
|
2019-08-14 22:47:41 +00:00
|
|
|
void FormattedNumber::toDecimalNumber(ByteSink& sink, UErrorCode& status) const {
|
|
|
|
UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
|
|
|
|
impl::DecNum decnum;
|
|
|
|
fData->quantity.toDecNum(decnum, status);
|
|
|
|
decnum.toString(sink, status);
|
|
|
|
}
|
|
|
|
|
2019-01-11 07:42:43 +00:00
|
|
|
void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih,
|
|
|
|
UErrorCode& status) const {
|
2019-03-23 00:43:28 +00:00
|
|
|
UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
|
2019-04-05 23:43:19 +00:00
|
|
|
fData->getAllFieldPositions(fpih, status);
|
2019-01-11 07:42:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const {
|
2019-03-23 00:43:28 +00:00
|
|
|
UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
|
2019-02-15 06:42:09 +00:00
|
|
|
output = fData->quantity;
|
2019-01-11 07:42:43 +00:00
|
|
|
}
|
|
|
|
|
2019-02-15 06:42:09 +00:00
|
|
|
|
|
|
|
impl::UFormattedNumberData::~UFormattedNumberData() = default;
|
2019-01-11 07:42:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace number
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|