]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/number_output.cpp
ICU-64243.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / number_output.cpp
CommitLineData
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
13U_NAMESPACE_BEGIN
14namespace number {
15
16
17UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber)
18
19#define UPRV_NOARG
20
21UBool 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
27void FormattedNumber::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const {
28 FieldPositionIteratorHandler fpih(&iterator, status);
29 getAllFieldPositionsImpl(fpih, status);
30}
31
32void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih,
33 UErrorCode& status) const {
34 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
35 fData->getStringRef().getAllFieldPositions(fpih, status);
36}
37
38void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const {
39 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
40 output = fData->quantity;
41}
42
43
44impl::UFormattedNumberData::~UFormattedNumberData() = default;
45
46
47} // namespace number
48U_NAMESPACE_END
49
50#endif /* #if !UCONFIG_NO_FORMATTING */