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 14 U_NAMESPACE_BEGIN 15 namespace number { 16 17 UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber)18UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber) 19 20 #define UPRV_NOARG 21 22 void FormattedNumber::toDecimalNumber(ByteSink& sink, UErrorCode& status) const { 23 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) 24 impl::DecNum decnum; 25 fData->quantity.toDecNum(decnum, status); 26 decnum.toString(sink, status); 27 } 28 getAllFieldPositionsImpl(FieldPositionIteratorHandler & fpih,UErrorCode & status) const29void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, 30 UErrorCode& status) const { 31 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) 32 fData->getAllFieldPositions(fpih, status); 33 } 34 getDecimalQuantity(impl::DecimalQuantity & output,UErrorCode & status) const35void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const { 36 UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) 37 output = fData->quantity; 38 } 39 40 41 impl::UFormattedNumberData::~UFormattedNumberData() = default; 42 43 44 } // namespace number 45 U_NAMESPACE_END 46 47 #endif /* #if !UCONFIG_NO_FORMATTING */ 48