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/uformattedvalue.h"
00018
00019 #if U_SHOW_CPLUSPLUS_API
00020 #include "unicode/localpointer.h"
00021 #endif // U_SHOW_CPLUSPLUS_API
00022
00037 struct UListFormatter;
00038 typedef struct UListFormatter UListFormatter;
00040 struct UFormattedList;
00045 typedef struct UFormattedList UFormattedList;
00046
00052 typedef enum UListFormatterField {
00057 ULISTFMT_LITERAL_FIELD,
00062 ULISTFMT_ELEMENT_FIELD
00063 } UListFormatterField;
00064
00070 typedef enum UListFormatterType {
00076 ULISTFMT_TYPE_AND,
00077
00084 ULISTFMT_TYPE_OR,
00085
00091 ULISTFMT_TYPE_UNITS
00092 } UListFormatterType;
00093
00099 typedef enum UListFormatterWidth {
00105 ULISTFMT_WIDTH_WIDE,
00106
00111 ULISTFMT_WIDTH_SHORT,
00112
00117 ULISTFMT_WIDTH_NARROW,
00118 } UListFormatterWidth;
00119
00138 U_CAPI UListFormatter* U_EXPORT2
00139 ulistfmt_open(const char* locale,
00140 UErrorCode* status);
00141
00164 U_CAPI UListFormatter* U_EXPORT2
00165 ulistfmt_openForType(const char* locale, UListFormatterType type,
00166 UListFormatterWidth width, UErrorCode* status);
00167
00174 U_CAPI void U_EXPORT2
00175 ulistfmt_close(UListFormatter *listfmt);
00176
00186 U_CAPI UFormattedList* U_EXPORT2
00187 ulistfmt_openResult(UErrorCode* ec);
00188
00210 U_CAPI const UFormattedValue* U_EXPORT2
00211 ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec);
00212
00219 U_CAPI void U_EXPORT2
00220 ulistfmt_closeResult(UFormattedList* uresult);
00221
00222
00223 #if U_SHOW_CPLUSPLUS_API
00224
00225 U_NAMESPACE_BEGIN
00226
00236 U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close);
00237
00247 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult);
00248
00249 U_NAMESPACE_END
00250
00251 #endif
00252
00287 U_CAPI int32_t U_EXPORT2
00288 ulistfmt_format(const UListFormatter* listfmt,
00289 const UChar* const strings[],
00290 const int32_t * stringLengths,
00291 int32_t stringCount,
00292 UChar* result,
00293 int32_t resultCapacity,
00294 UErrorCode* status);
00295
00322 U_CAPI void U_EXPORT2
00323 ulistfmt_formatStringsToResult(
00324 const UListFormatter* listfmt,
00325 const UChar* const strings[],
00326 const int32_t * stringLengths,
00327 int32_t stringCount,
00328 UFormattedList* uresult,
00329 UErrorCode* status);
00330
00331 #endif
00332
00333 #endif