1// © 2019 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3
4#include "unicode/utypes.h"
5
6#if !UCONFIG_NO_FORMATTING
7
8#include "unicode/numberformatter.h"
9#include "number_utypes.h"
10#include "util.h"
11#include "number_decimalquantity.h"
12#include "number_decnum.h"
13
14U_NAMESPACE_BEGIN
15namespace number {
16
17
18UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber)
19
20#define UPRV_NOARG
21
22UBool FormattedNumber::nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const {
23 UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE)
24 return fData->nextFieldPosition(fieldPosition, status);
25}
26
27void FormattedNumber::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const {
28 FieldPositionIteratorHandler fpih(&iterator, status);
29 getAllFieldPositionsImpl(fpih, status);
30}
31
32void FormattedNumber::toDecimalNumber(ByteSink& sink, UErrorCode& status) const {
33 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
34 impl::DecNum decnum;
35 fData->quantity.toDecNum(decnum, status);
36 decnum.toString(sink, status);
37}
38
39void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih,
40 UErrorCode& status) const {
41 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
42 fData->getAllFieldPositions(fpih, status);
43}
44
45void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const {
46 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
47 output = fData->quantity;
48}
49
50
51impl::UFormattedNumberData::~UFormattedNumberData() = default;
52
53
54} // namespace number
55U_NAMESPACE_END
56
57#endif /* #if !UCONFIG_NO_FORMATTING */
58