Movatterモバイル変換


[0]ホーム

URL:


ICU 78.2  78.2
Public Member Functions |Friends
icu::FormattedDateInterval Class Reference

An immutable class containing the result of a date interval formatting operation.More...

#include <dtitvfmt.h>

Inheritance diagram for icu::FormattedDateInterval:

Public Member Functions

 FormattedDateInterval ()
 Default constructor; makes an emptyFormattedDateInterval.More...
 
 FormattedDateInterval (FormattedDateInterval &&src) noexcept
 Move constructor: Leaves the sourceFormattedDateInterval in an undefined state.More...
 
virtual ~FormattedDateInterval () override
 Destruct an instance ofFormattedDateInterval.More...
 
 FormattedDateInterval (constFormattedDateInterval &)=delete
 Copying not supported; use move constructor instead.
 
FormattedDateIntervaloperator= (constFormattedDateInterval &)=delete
 Copying not supported; use move assignment instead.
 
FormattedDateIntervaloperator= (FormattedDateInterval &&src) noexcept
 Move assignment: Leaves the sourceFormattedDateInterval in an undefined state.More...
 
UnicodeString toString (UErrorCode &status) const override
 Returns the formatted string as a self-containedUnicodeString.More...
 
UnicodeString toTempString (UErrorCode &status) const override
 Returns the formatted string as a read-only alias to memory owned by theFormattedValue.More...
 
AppendableappendTo (Appendable &appendable,UErrorCode &status) const override
 Appends the formatted string to anAppendable.More...
 
UBool nextPosition (ConstrainedFieldPosition &cfpos,UErrorCode &status) const override
 Iterates over field positions in theFormattedValue.More...
 
- Public Member Functions inherited fromicu::FormattedValue
virtual ~FormattedValue ()
 

Friends

class DateIntervalFormat
 

Detailed Description

An immutable class containing the result of a date interval formatting operation.

Instances of this class are immutable and thread-safe.

When callingnextPosition(): 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 thenextPosition() iterator.

Not intended for public subclassing.

Stable:
ICU 64

Definition at line59 of filedtitvfmt.h.

Constructor & Destructor Documentation

◆ FormattedDateInterval()[1/2]

icu::FormattedDateInterval::FormattedDateInterval()
inline

Default constructor; makes an emptyFormattedDateInterval.

Stable:
ICU 64

Definition at line65 of filedtitvfmt.h.

◆ FormattedDateInterval()[2/2]

icu::FormattedDateInterval::FormattedDateInterval(FormattedDateInterval && src)
noexcept

Move constructor: Leaves the sourceFormattedDateInterval in an undefined state.

Stable:
ICU 64

◆ ~FormattedDateInterval()

virtual icu::FormattedDateInterval::~FormattedDateInterval()
overridevirtual

Destruct an instance ofFormattedDateInterval.

Stable:
ICU 64

Member Function Documentation

◆ appendTo()

Appendable& icu::FormattedDateInterval::appendTo(Appendableappendable,
UErrorCodestatus 
) const
overridevirtual

Appends the formatted string to anAppendable.

Parameters
appendableTheAppendable to which to append the string output.
statusSet if an error occurs.
Returns
The sameAppendable, for chaining.
Stable:
ICU 64
See also
Appendable

Implementsicu::FormattedValue.

◆ nextPosition()

UBool icu::FormattedDateInterval::nextPosition(ConstrainedFieldPositioncfpos,
UErrorCodestatus 
) const
overridevirtual

Iterates over field positions in theFormattedValue.

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}
Parameters
cfposThe object used for iteration state. This can provide constraints to iterate over only one specific category or field; seeConstrainedFieldPosition::constrainCategory andConstrainedFieldPosition::constrainField.
statusSet if an error occurs.
Returns
true if a new occurrence of the field was found; false otherwise or if an error was set.
Stable:
ICU 64

Implementsicu::FormattedValue.

◆ operator=()

FormattedDateInterval& icu::FormattedDateInterval::operator=(FormattedDateInterval && src)
noexcept

Move assignment: Leaves the sourceFormattedDateInterval in an undefined state.

Stable:
ICU 64

◆ toString()

UnicodeString icu::FormattedDateInterval::toString(UErrorCodestatus) const
overridevirtual

Returns the formatted string as a self-containedUnicodeString.

If you need the string within the current scope only, considertoTempString.

Parameters
statusSet if an error occurs.
Returns
aUnicodeString containing the formatted string.
Stable:
ICU 64

Implementsicu::FormattedValue.

◆ toTempString()

UnicodeString icu::FormattedDateInterval::toTempString(UErrorCodestatus) const
overridevirtual

Returns the formatted string as a read-only alias to memory owned by theFormattedValue.

The return value is valid only as long as thisFormattedValue is present and unchanged in memory. If you need the string outside the current scope, considertoString.

The buffer returned by callingUnicodeString::getBuffer() on the return value is guaranteed to be NUL-terminated.

Parameters
statusSet if an error occurs.
Returns
a temporaryUnicodeString containing the formatted string.
Stable:
ICU 64

Implementsicu::FormattedValue.


The documentation for this class was generated from the following file:

Generated by doxygen 1.9.1
[8]ページ先頭

©2009-2026 Movatter.jp