00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef ULISTFORMATTER_H
00011 #define ULISTFORMATTER_H
00012
00013 #include "unicode/utypes.h"
00014
00015 #if !UCONFIG_NO_FORMATTING
00016
00017 #include "unicode/localpointer.h"
00018 #include "unicode/uformattedvalue.h"
00019
00034 struct UListFormatter;
00035 typedef struct UListFormatter UListFormatter;
00037 struct UFormattedList;
00042 typedef struct UFormattedList UFormattedList;
00043
00049 typedef enum UListFormatterField {
00054 ULISTFMT_LITERAL_FIELD,
00059 ULISTFMT_ELEMENT_FIELD
00060 } UListFormatterField;
00061
00062 #ifndef U_HIDE_DRAFT_API
00063
00068 typedef enum UListFormatterType {
00074 ULISTFMT_TYPE_AND,
00075
00082 ULISTFMT_TYPE_OR,
00083
00089 ULISTFMT_TYPE_UNITS
00090 } UListFormatterType;
00091
00097 typedef enum UListFormatterWidth {
00103 ULISTFMT_WIDTH_WIDE,
00104
00109 ULISTFMT_WIDTH_SHORT,
00110
00115 ULISTFMT_WIDTH_NARROW,
00116 } UListFormatterWidth;
00117 #endif
00118
00137 U_CAPI UListFormatter* U_EXPORT2
00138 ulistfmt_open(const char* locale,
00139 UErrorCode* status);
00140
00141 #ifndef U_HIDE_DRAFT_API
00142
00164 U_DRAFT UListFormatter* U_EXPORT2
00165 ulistfmt_openForType(const char* locale, UListFormatterType type,
00166 UListFormatterWidth width, UErrorCode* status);
00167 #endif
00168
00175 U_CAPI void U_EXPORT2
00176 ulistfmt_close(UListFormatter *listfmt);
00177
00187 U_CAPI UFormattedList* U_EXPORT2
00188 ulistfmt_openResult(UErrorCode* ec);
00189
00211 U_CAPI const UFormattedValue* U_EXPORT2
00212 ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec);
00213
00220 U_CAPI void U_EXPORT2
00221 ulistfmt_closeResult(UFormattedList* uresult);
00222
00223
00224 #if U_SHOW_CPLUSPLUS_API
00225
00226 U_NAMESPACE_BEGIN
00227
00237 U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close);
00238
00248 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult);
00249
00250 U_NAMESPACE_END
00251
00252 #endif
00253
00288 U_CAPI int32_t U_EXPORT2
00289 ulistfmt_format(const UListFormatter* listfmt,
00290 const UChar* const strings[],
00291 const int32_t * stringLengths,
00292 int32_t stringCount,
00293 UChar* result,
00294 int32_t resultCapacity,
00295 UErrorCode* status);
00296
00323 U_CAPI void U_EXPORT2
00324 ulistfmt_formatStringsToResult(
00325 const UListFormatter* listfmt,
00326 const UChar* const strings[],
00327 const int32_t * stringLengths,
00328 int32_t stringCount,
00329 UFormattedList* uresult,
00330 UErrorCode* status);
00331
00332 #endif
00333
00334 #endif