ICU 65.1  65.1
ulistformatter.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *****************************************************************************************
5 * Copyright (C) 2015-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *****************************************************************************************
8 */
9 
10 #ifndef ULISTFORMATTER_H
11 #define ULISTFORMATTER_H
12 
13 #include "unicode/utypes.h"
14 
15 #if !UCONFIG_NO_FORMATTING
16 
17 #include "unicode/localpointer.h"
19 
34 struct UListFormatter;
37 #ifndef U_HIDE_DRAFT_API
38 struct UFormattedList;
44 
50 typedef enum UListFormatterField {
62 #endif /* U_HIDE_DRAFT_API */
63 
80 U_CAPI UListFormatter* U_EXPORT2
81 ulistfmt_open(const char* locale,
82  UErrorCode* status);
83 
90 U_CAPI void U_EXPORT2
92 
93 #ifndef U_HIDE_DRAFT_API
94 
103 U_CAPI UFormattedList* U_EXPORT2
105 
127 U_CAPI const UFormattedValue* U_EXPORT2
129 
136 U_CAPI void U_EXPORT2
138 #endif /* U_HIDE_DRAFT_API */
139 
140 
141 #if U_SHOW_CPLUSPLUS_API
142 
143 U_NAMESPACE_BEGIN
144 
155 
156 #ifndef U_HIDE_DRAFT_API
157 
167 #endif /* U_HIDE_DRAFT_API */
168 
169 U_NAMESPACE_END
170 
171 #endif
172 
207 U_CAPI int32_t U_EXPORT2
208 ulistfmt_format(const UListFormatter* listfmt,
209  const UChar* const strings[],
210  const int32_t * stringLengths,
211  int32_t stringCount,
212  UChar* result,
213  int32_t resultCapacity,
214  UErrorCode* status);
215 
216 #ifndef U_HIDE_DRAFT_API
217 
243 U_CAPI void U_EXPORT2
245  const UListFormatter* listfmt,
246  const UChar* const strings[],
247  const int32_t * stringLengths,
248  int32_t stringCount,
249  UFormattedList* uresult,
250  UErrorCode* status);
251 #endif /* U_HIDE_DRAFT_API */
252 
253 #endif /* #if !UCONFIG_NO_FORMATTING */
254 
255 #endif
U_CAPI int32_t ulistfmt_format(const UListFormatter *listfmt, const UChar *const strings[], const int32_t *stringLengths, int32_t stringCount, UChar *result, int32_t resultCapacity, UErrorCode *status)
Formats a list of strings using the conventions established for the UListFormatter object...
C API: Abstract operations for localized strings.
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:109
The literal text in the result which came from the resources.
UListFormatterField
FieldPosition and UFieldPosition selectors for format fields defined by ListFormatter.
U_CAPI void ulistfmt_closeResult(UFormattedList *uresult)
Releases the UFormattedList created by ulistfmt_openResult().
U_CAPI UFormattedList * ulistfmt_openResult(UErrorCode *ec)
Creates an object to hold the result of a UListFormatter operation.
U_CAPI void ulistfmt_close(UListFormatter *listfmt)
Close a UListFormatter object.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:562
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
"Smart pointer" class, closes a UFormattedList via ulistfmt_closeResult().
"Smart pointer" class, closes a UListFormatter via ulistfmt_close().
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:377
U_CAPI const UFormattedValue * ulistfmt_resultAsValue(const UFormattedList *uresult, UErrorCode *ec)
Returns a representation of a UFormattedList as a UFormattedValue, which can be subsequently passed t...
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
The element text in the result which came from the input strings.
U_CAPI UListFormatter * ulistfmt_open(const char *locale, UErrorCode *status)
Open a new UListFormatter object using the rules for a given locale.
struct UFormattedList UFormattedList
Opaque struct to contain the results of a UListFormatter operation.
Basic definitions for ICU, for both C and C++ APIs.
U_CAPI void ulistfmt_formatStringsToResult(const UListFormatter *listfmt, const UChar *const strings[], const int32_t *stringLengths, int32_t stringCount, UFormattedList *uresult, UErrorCode *status)
Formats a list of strings to a UFormattedList, which exposes more information than the string exporte...
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
struct UListFormatter UListFormatter
C typedef for struct UListFormatter.