ICU 72.1 72.1
|
An immutable class containing the result of a date interval formatting operation. More...
#include <dtitvfmt.h>
Public Member Functions | |
FormattedDateInterval () | |
Default constructor; makes an empty FormattedDateInterval. More... | |
FormattedDateInterval (FormattedDateInterval &&src) U_NOEXCEPT | |
Move constructor: Leaves the source FormattedDateInterval in an undefined state. More... | |
virtual | ~FormattedDateInterval () U_OVERRIDE |
Destruct an instance of FormattedDateInterval. More... | |
FormattedDateInterval (const FormattedDateInterval &)=delete | |
Copying not supported; use move constructor instead. | |
FormattedDateInterval & | operator= (const FormattedDateInterval &)=delete |
Copying not supported; use move assignment instead. | |
FormattedDateInterval & | operator= (FormattedDateInterval &&src) U_NOEXCEPT |
Move assignment: Leaves the source FormattedDateInterval in an undefined state. More... | |
UnicodeString | toString (UErrorCode &status) const U_OVERRIDE |
Returns the formatted string as a self-contained UnicodeString. More... | |
UnicodeString | toTempString (UErrorCode &status) const U_OVERRIDE |
Returns the formatted string as a read-only alias to memory owned by the FormattedValue. More... | |
Appendable & | appendTo (Appendable &appendable, UErrorCode &status) const U_OVERRIDE |
Appends the formatted string to an Appendable. More... | |
UBool | nextPosition (ConstrainedFieldPosition &cfpos, UErrorCode &status) const U_OVERRIDE |
Iterates over field positions in the FormattedValue. More... | |
Public Member Functions inherited from icu::FormattedValue | |
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... | |
Friends | |
class | DateIntervalFormat |
An immutable class containing the result of a date interval formatting operation.
Instances of this class are immutable and thread-safe.
When calling nextPosition(): The fields are returned from left to right. The special field category UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime primitives came from which arguments: 0 means fromCalendar, and 1 means toCalendar. The span category will always occur before the corresponding fields in UFIELD_CATEGORY_DATE in the nextPosition() iterator.
Not intended for public subclassing.
Definition at line 59 of file dtitvfmt.h.
|
inline |
Default constructor; makes an empty FormattedDateInterval.
Definition at line 65 of file dtitvfmt.h.
icu::FormattedDateInterval::FormattedDateInterval | ( | FormattedDateInterval && | src | ) |
Move constructor: Leaves the source FormattedDateInterval in an undefined state.
|
virtual |
Destruct an instance of FormattedDateInterval.
|
virtual |
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.
|
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. |
Implements icu::FormattedValue.
FormattedDateInterval & icu::FormattedDateInterval::operator= | ( | FormattedDateInterval && | src | ) |
Move assignment: Leaves the source FormattedDateInterval in an undefined state.
|
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. |
Implements icu::FormattedValue.
|
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. |
Implements icu::FormattedValue.
|
friend |
Definition at line 110 of file dtitvfmt.h.