ICU 65.1
65.1
|
An immutable class for formatting a list, using data from CLDR (or supplied separately). More...
#include <listformatter.h>
Public Member Functions | |
ListFormatter (const ListFormatter &) | |
Copy constructor. More... | |
ListFormatter & | operator= (const ListFormatter &other) |
Assignment operator. More... | |
virtual | ~ListFormatter () |
Destructor. More... | |
UnicodeString & | format (const UnicodeString items[], int32_t n_items, UnicodeString &appendTo, UErrorCode &errorCode) const |
Formats a list of strings. More... | |
UnicodeString & | format (const UnicodeString items[], int32_t n_items, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &errorCode) const |
Format a list of strings. More... | |
FormattedList | formatStringsToValue (const UnicodeString items[], int32_t n_items, UErrorCode &errorCode) const |
Formats a list of strings to a FormattedList, which exposes field position information. More... | |
UnicodeString & | format (const UnicodeString items[], int32_t n_items, UnicodeString &appendTo, int32_t index, int32_t &offset, UErrorCode &errorCode) const |
ListFormatter (const ListFormatData &data, UErrorCode &errorCode) | |
ListFormatter (const ListFormatInternal *listFormatterInternal) | |
Public Member Functions inherited from icu::UObject | |
virtual | ~UObject () |
Destructor. More... | |
virtual UClassID | getDynamicClassID () const |
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More... | |
Static Public Member Functions | |
static ListFormatter * | createInstance (UErrorCode &errorCode) |
Creates a ListFormatter appropriate for the default locale. More... | |
static ListFormatter * | createInstance (const Locale &locale, UErrorCode &errorCode) |
Creates a ListFormatter appropriate for a locale. More... | |
static ListFormatter * | createInstance (const Locale &locale, const char *style, UErrorCode &errorCode) |
Creates a ListFormatter appropriate for a locale and style. More... | |
An immutable class for formatting a list, using data from CLDR (or supplied separately).
Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted as "Alice, Bob, Charlie and Delta" in English.
The ListFormatter class is not intended for public subclassing.
Definition at line 151 of file listformatter.h.
icu::ListFormatter::ListFormatter | ( | const ListFormatter & | ) |
Copy constructor.
|
virtual |
Destructor.
icu::ListFormatter::ListFormatter | ( | const ListFormatData & | data, |
UErrorCode & | errorCode | ||
) |
This API is for internal use only. constructor made public for testing.
icu::ListFormatter::ListFormatter | ( | const ListFormatInternal * | listFormatterInternal | ) |
This API is for internal use only. constructor made public for testing.
|
static |
Creates a ListFormatter appropriate for the default locale.
errorCode | ICU error code, set if no data available for default locale. |
|
static |
Creates a ListFormatter appropriate for a locale.
locale | The locale. |
errorCode | ICU error code, set if no data available for the given locale. |
|
static |
Creates a ListFormatter appropriate for a locale and style.
locale | The locale. |
style | the style, either "standard", "or", "unit", "unit-narrow", or "unit-short" |
errorCode | ICU error code, set if no data available for the given locale. |
UnicodeString& icu::ListFormatter::format | ( | const UnicodeString | items[], |
int32_t | n_items, | ||
UnicodeString & | appendTo, | ||
UErrorCode & | errorCode | ||
) | const |
Formats a list of strings.
items | An array of strings to be combined and formatted. |
n_items | Length of the array items. |
appendTo | The string to which the result should be appended to. |
errorCode | ICU error code, set if there is an error. |
UnicodeString& icu::ListFormatter::format | ( | const UnicodeString | items[], |
int32_t | n_items, | ||
UnicodeString & | appendTo, | ||
FieldPositionIterator * | posIter, | ||
UErrorCode & | errorCode | ||
) | const |
Format a list of strings.
items | An array of strings to be combined and formatted. |
n_items | Length of the array items. |
appendTo | The string to which the formatted result will be appended. |
posIter | On return, can be used to iterate over positions of fields generated by this format call. Field values are defined in UListFormatterField. Can be NULL. |
errorCode | ICU error code returned here. |
UnicodeString& icu::ListFormatter::format | ( | const UnicodeString | items[], |
int32_t | n_items, | ||
UnicodeString & | appendTo, | ||
int32_t | index, | ||
int32_t & | offset, | ||
UErrorCode & | errorCode | ||
) | const |
This API is for internal use only. for MeasureFormat
FormattedList icu::ListFormatter::formatStringsToValue | ( | const UnicodeString | items[], |
int32_t | n_items, | ||
UErrorCode & | errorCode | ||
) | const |
Formats a list of strings to a FormattedList, which exposes field position information.
The FormattedList contains more information than a FieldPositionIterator.
items | An array of strings to be combined and formatted. |
n_items | Length of the array items. |
errorCode | ICU error code returned here. |
ListFormatter& icu::ListFormatter::operator= | ( | const ListFormatter & | other | ) |
Assignment operator.