]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/formattedval_sbimpl.cpp
ICU-64243.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / formattedval_sbimpl.cpp
1 // © 2018 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 // This file contains one implementation of FormattedValue.
9 // Other independent implementations should go into their own cpp file for
10 // better dependency modularization.
11
12 #include "formattedval_impl.h"
13
14 U_NAMESPACE_BEGIN
15
16
17 FormattedValueNumberStringBuilderImpl::FormattedValueNumberStringBuilderImpl(number::impl::Field numericField)
18 : fNumericField(numericField) {
19 }
20
21 FormattedValueNumberStringBuilderImpl::~FormattedValueNumberStringBuilderImpl() {
22 }
23
24
25 UnicodeString FormattedValueNumberStringBuilderImpl::toString(UErrorCode&) const {
26 return fString.toUnicodeString();
27 }
28
29 UnicodeString FormattedValueNumberStringBuilderImpl::toTempString(UErrorCode&) const {
30 return fString.toTempUnicodeString();
31 }
32
33 Appendable& FormattedValueNumberStringBuilderImpl::appendTo(Appendable& appendable, UErrorCode&) const {
34 appendable.appendString(fString.chars(), fString.length());
35 return appendable;
36 }
37
38 UBool FormattedValueNumberStringBuilderImpl::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const {
39 // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool
40 return fString.nextPosition(cfpos, fNumericField, status) ? TRUE : FALSE;
41 }
42
43
44 U_NAMESPACE_END
45
46 #endif /* #if !UCONFIG_NO_FORMATTING */