ICU 77.1
77.1
|
An immutable class containing the result of a relative datetime formatting operation. More...
#include <reldatefmt.h>
Public Member Functions | |
FormattedRelativeDateTime () | |
Default constructor; makes an empty FormattedRelativeDateTime. More... | |
FormattedRelativeDateTime (FormattedRelativeDateTime &&src) noexcept | |
Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state. More... | |
virtual | ~FormattedRelativeDateTime () override |
Destruct an instance of FormattedRelativeDateTime. More... | |
FormattedRelativeDateTime (const FormattedRelativeDateTime &)=delete | |
Copying not supported; use move constructor instead. | |
FormattedRelativeDateTime & | operator= (const FormattedRelativeDateTime &)=delete |
Copying not supported; use move assignment instead. | |
FormattedRelativeDateTime & | operator= (FormattedRelativeDateTime &&src) noexcept |
Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state. More... | |
UnicodeString | toString (UErrorCode &status) const override |
Returns the formatted string as a self-contained UnicodeString. More... | |
UnicodeString | toTempString (UErrorCode &status) const override |
Returns the formatted string as a read-only alias to memory owned by the FormattedValue. More... | |
Appendable & | appendTo (Appendable &appendable, UErrorCode &status) const override |
Appends the formatted string to an Appendable. More... | |
UBool | nextPosition (ConstrainedFieldPosition &cfpos, UErrorCode &status) const override |
Iterates over field positions in the FormattedValue. More... | |
![]() | |
virtual | ~FormattedValue () |
Friends | |
class | RelativeDateTimeFormatter |
An immutable class containing the result of a relative datetime formatting operation.
Instances of this class are immutable and thread-safe.
Not intended for public subclassing.
Definition at line 272 of file reldatefmt.h.
|
inline |
Default constructor; makes an empty FormattedRelativeDateTime.
Definition at line 278 of file reldatefmt.h.
|
noexcept |
Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state.
|
overridevirtual |
Destruct an instance of FormattedRelativeDateTime.
|
overridevirtual |
Appends the formatted string to an Appendable.
appendable | The Appendable to which to append the string output. |
status | Set if an error occurs. |
Implements icu::FormattedValue.
|
overridevirtual |
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. |
Implements icu::FormattedValue.
|
noexcept |
Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state.
|
overridevirtual |
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. |
Implements icu::FormattedValue.
|
overridevirtual |
Returns the formatted string as a read-only alias to memory owned by the