"Fossies" - the Fresh Open Source Software Archive

Member "classicu_1_1FormattedList.html" (3 Oct 2019, 32636 Bytes) of package /linux/misc/icu4c-65_1-docs.zip:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the project site itself.

ICU 65.1  65.1
Public Member Functions | Friends
icu::FormattedList Class Reference

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

#include <listformatter.h>

Inheritance diagram for icu::FormattedList:
icu::UMemory icu::FormattedValue

Public Member Functions

 FormattedList ()
 Default constructor; makes an empty FormattedList. More...
 
 FormattedList (FormattedList &&src) U_NOEXCEPT
 Move constructor: Leaves the source FormattedList in an undefined state. More...
 
virtual ~FormattedList () U_OVERRIDE
 Destruct an instance of FormattedList. More...
 
 FormattedList (const FormattedList &)=delete
 Copying not supported; use move constructor instead. More...
 
FormattedListoperator= (const FormattedList &)=delete
 Copying not supported; use move assignment instead. More...
 
FormattedListoperator= (FormattedList &&src) U_NOEXCEPT
 Move assignment: Leaves the source FormattedList 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...
 
AppendableappendTo (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 ()
 

Friends

class ListFormatter
 

Detailed Description

An immutable class containing the result of a list formatting operation.

Instances of this class are immutable and thread-safe.

When calling nextPosition(): The fields are returned from start to end. The special field category UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument was inserted at the given position. The span category will always occur before the corresponding instance of UFIELD_CATEGORY_LIST in the nextPosition() iterator.

Not intended for public subclassing.

Draft:
This API may be changed in the future versions and was introduced in ICU 64

Definition at line 84 of file listformatter.h.

Constructor & Destructor Documentation

◆ FormattedList() [1/3]

icu::FormattedList::FormattedList ( )
inline

Default constructor; makes an empty FormattedList.

Draft:
This API may be changed in the future versions and was introduced in ICU 64

Definition at line 90 of file listformatter.h.

References U_NOEXCEPT, U_OVERRIDE, and U_ZERO_ERROR.

◆ FormattedList() [2/3]

icu::FormattedList::FormattedList ( FormattedList &&  src)

Move constructor: Leaves the source FormattedList in an undefined state.

Draft:
This API may be changed in the future versions and was introduced in ICU 64

◆ ~FormattedList()

virtual icu::FormattedList::~FormattedList ( )
virtual

Destruct an instance of FormattedList.

Draft:
This API may be changed in the future versions and was introduced in ICU 64

◆ FormattedList() [3/3]

icu::FormattedList::FormattedList ( const FormattedList )
delete

Copying not supported; use move constructor instead.

Member Function Documentation

◆ appendTo()

Appendable& icu::FormattedList::appendTo ( Appendable appendable,
UErrorCode status 
) const
virtual

Appends the formatted string to an Appendable.

Parameters
appendableThe Appendable to which to append the string output.
statusSet if an error occurs.
Returns
The same Appendable, for chaining.
Draft:
This API may be changed in the future versions and was introduced in ICU 64
See also
Appendable

Implements icu::FormattedValue.

◆ nextPosition()

UBool icu::FormattedList::nextPosition ( ConstrainedFieldPosition cfpos,
UErrorCode status 
) const
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
}
Parameters
cfposThe object used for iteration state. This can provide constraints to iterate over only one specific category or field; see ConstrainedFieldPosition::constrainCategory and ConstrainedFieldPosition::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.
Draft:
This API may be changed in the future versions and was introduced in ICU 64

Implements icu::FormattedValue.

◆ operator=() [1/2]

FormattedList& icu::FormattedList::operator= ( const FormattedList )
delete

Copying not supported; use move assignment instead.

◆ operator=() [2/2]

FormattedList& icu::FormattedList::operator= ( FormattedList &&  src)

Move assignment: Leaves the source FormattedList in an undefined state.

Draft:
This API may be changed in the future versions and was introduced in ICU 64

◆ toString()

UnicodeString icu::FormattedList::toString ( UErrorCode status) const
virtual

Returns the formatted string as a self-contained UnicodeString.

If you need the string within the current scope only, consider toTempString.

Parameters
statusSet if an error occurs.
Returns
a UnicodeString containing the formatted string.
Draft:
This API may be changed in the future versions and was introduced in ICU 64

Implements icu::FormattedValue.

◆ toTempString()

UnicodeString icu::FormattedList::toTempString ( UErrorCode status) const
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.

Parameters
statusSet if an error occurs.
Returns
a temporary UnicodeString containing the formatted string.
Draft:
This API may be changed in the future versions and was introduced in ICU 64

Implements icu::FormattedValue.


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