icu::ListFormatter Class Reference
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.
|
| ListFormatter & | operator= (const ListFormatter &other) |
| | Assignment operator.
|
| virtual | ~ListFormatter () |
| | Destructor.
|
| UnicodeString & | format (const UnicodeString items[], int32_t n_items, UnicodeString &appendTo, UErrorCode &errorCode) const |
| | Formats a list of strings.
|
| UnicodeString & | format (const UnicodeString items[], int32_t n_items, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &errorCode) const |
| | Format a list of strings.
|
| 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.
|
| 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) |
Static Public Member Functions |
| static ListFormatter * | createInstance (UErrorCode &errorCode) |
| | Creates a ListFormatter appropriate for the default locale.
|
| static ListFormatter * | createInstance (const Locale &locale, UErrorCode &errorCode) |
| | Creates a ListFormatter appropriate for a locale.
|
| static ListFormatter * | createInstance (const Locale &locale, const char *style, UErrorCode &errorCode) |
| | Creates a ListFormatter appropriate for a locale and style.
|
Detailed Description
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.
- Stable:
- ICU 50
Definition at line 149 of file listformatter.h.
Constructor & Destructor Documentation
| virtual icu::ListFormatter::~ListFormatter |
( |
|
) |
[virtual] |
| icu::ListFormatter::ListFormatter |
( |
const ListFormatData & |
data, |
|
|
UErrorCode & |
errorCode | |
|
) |
| | |
- Internal:
- Do not use. This API is for internal use only. constructor made public for testing.
| icu::ListFormatter::ListFormatter |
( |
const ListFormatInternal * |
listFormatterInternal |
) |
|
- Internal:
- Do not use. This API is for internal use only. constructor made public for testing.
Member Function Documentation
Creates a ListFormatter appropriate for a locale and style.
- Parameters:
-
| 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. |
- Returns:
- A ListFormatter object created from internal data derived from CLDR data.
- Internal:
- Do not use. This API is for internal use only.
Creates a ListFormatter appropriate for a locale.
- Parameters:
-
| locale | The locale. |
| errorCode | ICU error code, set if no data available for the given locale. |
- Returns:
- A ListFormatter object created from internal data derived from CLDR data.
- Stable:
- ICU 50
Creates a ListFormatter appropriate for the default locale.
- Parameters:
-
| errorCode | ICU error code, set if no data available for default locale. |
- Returns:
- Pointer to a ListFormatter object for the default locale, created from internal data derived from CLDR data.
- Stable:
- ICU 50
Format a list of strings.
- Parameters:
-
| 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. |
- Returns:
- Formatted string combining the elements of items, appended to appendTo.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 63
Formats a list of strings.
- Parameters:
-
| 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. |
- Returns:
- Formatted string combining the elements of items, appended to appendTo.
- Stable:
- ICU 50
Formats a list of strings to a FormattedList, which exposes field position information.
The FormattedList contains more information than a FieldPositionIterator.
- Parameters:
-
| items | An array of strings to be combined and formatted. |
| n_items | Length of the array items. |
| errorCode | ICU error code returned here. |
- Returns:
- A FormattedList containing field information.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 64
The documentation for this class was generated from the following file: