]>
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" | |
12 | ||
13 | U_NAMESPACE_BEGIN | |
14 | namespace number { | |
15 | ||
16 | ||
17 | UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber) | |
18 | ||
19 | #define UPRV_NOARG | |
20 | ||
21 | UBool FormattedNumber::nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const { | |
22 | UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) | |
23 | // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool | |
24 | return fData->getStringRef().nextFieldPosition(fieldPosition, status) ? TRUE : FALSE; | |
25 | } | |
26 | ||
27 | void FormattedNumber::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const { | |
28 | FieldPositionIteratorHandler fpih(&iterator, status); | |
29 | getAllFieldPositionsImpl(fpih, status); | |
30 | } | |
31 | ||
32 | void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, | |
33 | UErrorCode& status) const { | |
34 | UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) | |
35 | fData->getStringRef().getAllFieldPositions(fpih, status); | |
36 | } | |
37 | ||
38 | void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const { | |
39 | UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) | |
40 | output = fData->quantity; | |
41 | } | |
42 | ||
43 | ||
44 | impl::UFormattedNumberData::~UFormattedNumberData() = default; | |
45 | ||
46 | ||
47 | } // namespace number | |
48 | U_NAMESPACE_END | |
49 | ||
50 | #endif /* #if !UCONFIG_NO_FORMATTING */ |