ICU 64.2
64.2
|
An abstract formatted value: a string with associated field attributes. More...
#include <formattedvalue.h>
Public Member Functions | |
virtual | ~FormattedValue () |
virtual UnicodeString | toString (UErrorCode &status) const =0 |
Returns the formatted string as a self-contained UnicodeString. More... | |
virtual UnicodeString | toTempString (UErrorCode &status) const =0 |
Returns the formatted string as a read-only alias to memory owned by the FormattedValue. More... | |
virtual Appendable & | appendTo (Appendable &appendable, UErrorCode &status) const =0 |
Appends the formatted string to an Appendable. More... | |
virtual UBool | nextPosition (ConstrainedFieldPosition &cfpos, UErrorCode &status) const =0 |
Iterates over field positions in the FormattedValue. More... | |
An abstract formatted value: a string with associated field attributes.
Many formatters format to classes implementing FormattedValue.
Definition at line 241 of file formattedvalue.h.
|
virtual |
|
pure virtual |
Appends the formatted string to an Appendable.
appendable | The Appendable to which to append the string output. |
status | Set if an error occurs. |
Implemented in icu::number::FormattedNumber, icu::number::FormattedNumberRange, icu::FormattedRelativeDateTime, icu::FormattedList, and icu::FormattedDateInterval.
Referenced by icu::FormattedDateInterval::FormattedDateInterval(), and icu::FormattedRelativeDateTime::FormattedRelativeDateTime().
|
pure virtual |
Iterates over field positions in the FormattedValue.
This lets you determine the position of specific types of substrings, like a month or a decimal separator.
To loop over all field positions:
ConstrainedFieldPosition cfpos; while (fmtval.nextPosition(cfpos, status)) { // handle the field position; get information from cfpos }
cfpos | The object used for iteration state. This can provide constraints to iterate over only one specific category or field; see ConstrainedFieldPosition::constrainCategory and ConstrainedFieldPosition::constrainField. |
status | Set if an error occurs. |
Implemented in icu::number::FormattedNumber, icu::number::FormattedNumberRange, icu::FormattedRelativeDateTime, icu::FormattedList, and icu::FormattedDateInterval.
Referenced by icu::FormattedDateInterval::FormattedDateInterval(), and icu::FormattedRelativeDateTime::FormattedRelativeDateTime().
|
pure virtual |
Returns the formatted string as a self-contained UnicodeString.
If you need the string within the current scope only, consider toTempString.
status | Set if an error occurs. |
Implemented in icu::number::FormattedNumber, icu::number::FormattedNumberRange, icu::FormattedRelativeDateTime, icu::FormattedList, and icu::FormattedDateInterval.
Referenced by icu::FormattedDateInterval::FormattedDateInterval(), and icu::FormattedRelativeDateTime::FormattedRelativeDateTime().
|
pure virtual |
Returns the formatted string as a read-only alias to memory owned by the FormattedValue.
The return value is valid only as long as this FormattedValue is present and unchanged in memory. If you need the string outside the current scope, consider toString.
The buffer returned by calling UnicodeString::getBuffer() on the return value is guaranteed to be NUL-terminated.
status | Set if an error occurs. |
Implemented in icu::number::FormattedNumber, icu::number::FormattedNumberRange, icu::FormattedRelativeDateTime, icu::FormattedList, and icu::FormattedDateInterval.
Referenced by icu::FormattedDateInterval::FormattedDateInterval(), and icu::FormattedRelativeDateTime::FormattedRelativeDateTime().