]>
Commit | Line | Data |
---|---|---|
3d1f044b A |
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" | |
340931cb | 12 | #include "number_decnum.h" |
3d1f044b A |
13 | |
14 | U_NAMESPACE_BEGIN | |
15 | namespace number { | |
16 | ||
17 | ||
18 | UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber) | |
19 | ||
20 | #define UPRV_NOARG | |
21 | ||
22 | UBool FormattedNumber::nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const { | |
23 | UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) | |
340931cb | 24 | return fData->nextFieldPosition(fieldPosition, status); |
3d1f044b A |
25 | } |
26 | ||
27 | void FormattedNumber::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const { | |
28 | FieldPositionIteratorHandler fpih(&iterator, status); | |
29 | getAllFieldPositionsImpl(fpih, status); | |
30 | } | |
31 | ||
340931cb A |
32 | void 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 | ||
3d1f044b A |
39 | void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, |
40 | UErrorCode& status) const { | |
41 | UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) | |
340931cb | 42 | fData->getAllFieldPositions(fpih, status); |
3d1f044b A |
43 | } |
44 | ||
45 | void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const { | |
46 | UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) | |
47 | output = fData->quantity; | |
48 | } | |
49 | ||
50 | ||
51 | impl::UFormattedNumberData::~UFormattedNumberData() = default; | |
52 | ||
53 | ||
54 | } // namespace number | |
55 | U_NAMESPACE_END | |
56 | ||
57 | #endif /* #if !UCONFIG_NO_FORMATTING */ |