1 // © 2022 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 4 #ifndef __FORMATTEDNUMBER_H__ 5 #define __FORMATTEDNUMBER_H__ 9 #if U_SHOW_CPLUSPLUS_API 11 #if !UCONFIG_NO_FORMATTING 27 classFieldPositionIteratorHandler;
28 classSimpleDateFormat;
30 namespacenumber {
// icu::number 34 classUFormattedNumberData;
35 structUFormattedNumberImpl;
82 // Copybrief: this method is older than the parent method 92 // Copydoc: this method is new in ICU 64 96 // Copybrief: this method is older than the parent method 106 // Copydoc: this method is new in ICU 64 128 template<
typename StringClass>
129 inline StringClass toDecimalNumber(
UErrorCode& status)
const;
153 #ifndef U_HIDE_INTERNAL_API 167 #endif/* U_HIDE_INTERNAL_API */ 170 // Can't use LocalPointer because UFormattedNumberData is forward-declared 171 impl::UFormattedNumberData *fData;
173 // Error code for the terminal methods 183 : fData(nullptr), fErrorCode(errorCode) {}
187 // To give LocalizedNumberFormatter format methods access to this class's constructor: 188 friendclassLocalizedNumberFormatter;
189 friendclassSimpleNumberFormatter;
191 // To give C API access to internals 192 friendstructimpl::UFormattedNumberImpl;
194 // To give access to the data pointer for non-heap allocation 198 template<
typename StringClass>
199 StringClass FormattedNumber::toDecimalNumber(
UErrorCode& status)
const{
202 toDecimalNumber(sink, status);
209 #endif/* #if !UCONFIG_NO_FORMATTING */ 211 #endif/* U_SHOW_CPLUSPLUS_API */ 213 #endif// __FORMATTEDNUMBER_H__ Base class for objects to which Unicode characters and strings can be appended.
A ByteSink can be filled with bytes.
Represents a span of a string containing a given field.
An abstract formatted value: a string with associated field attributes.
A unit such as length, mass, volume, currency, etc.
SimpleDateFormat is a concrete class for formatting and parsing dates in a language-independent manne...
Implementation of ByteSink that writes to a "string".
UMemory is the common ICU base class.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
The result of a number formatting operation.
void getDecimalQuantity(impl::DecimalQuantity &output, UErrorCode &status) const
Gets the raw DecimalQuantity for plural rule selection.
UDisplayOptionsNounClass getNounClass(UErrorCode &status) const
Gets the noun class of the formatted output.
FormattedNumber(const FormattedNumber &)=delete
Copying not supported; use move constructor instead.
MeasureUnit getOutputUnit(UErrorCode &status) const
Gets the resolved output unit.
FormattedNumber()
Default constructor; makes an empty FormattedNumber.
FormattedNumber & operator=(const FormattedNumber &)=delete
Copying not supported; use move assignment instead.
void getAllFieldPositionsImpl(FieldPositionIteratorHandler &fpih, UErrorCode &status) const
Populates the mutable builder type FieldPositionIteratorHandler.
virtual ~FormattedNumber() override
Destruct an instance of FormattedNumber.
UnicodeString toString(UErrorCode &status) const override
Returns the formatted string as a self-contained UnicodeString.
Appendable & appendTo(Appendable &appendable, UErrorCode &status) const override
Appends the formatted string to an Appendable.
FormattedNumber(FormattedNumber &&src) noexcept
Move constructor: Leaves the source FormattedNumber in an undefined state.
UBool nextPosition(ConstrainedFieldPosition &cfpos, UErrorCode &status) const override
Iterates over field positions in the FormattedValue.
UnicodeString toTempString(UErrorCode &status) const override
Returns the formatted string as a read-only alias to memory owned by the FormattedValue.
FormattedNumber & operator=(FormattedNumber &&src) noexcept
Move assignment: Leaves the source FormattedNumber in an undefined state.
C++ API: Abstract operations for localized strings.
C++ API: A unit for measuring a quantity.
C API: Display options (enum types, values, helper functions)
UDisplayOptionsNounClass
Represents all the grammatical noun classes that are supported by CLDR.
int8_t UBool
The ICU boolean type, a signed-byte integer.
C++ API: Common ICU base class UObject.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
@ U_INVALID_STATE_ERROR
Requested operation can not be completed with ICU in its current state.
@ U_ZERO_ERROR
No error, no warning.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.