00001
00002
00003
00004
00005
00006
00007
#ifndef UDAT_H
00008
#define UDAT_H
00009
00010
#include "unicode/utypes.h"
00011
#include "unicode/ucal.h"
00012
#include "unicode/unum.h"
00133 typedef void*
UDateFormat;
00134
00136 enum UDateFormatStyle {
00138
UDAT_FULL,
00140
UDAT_LONG,
00142
UDAT_MEDIUM,
00144
UDAT_SHORT,
00146
UDAT_DEFAULT =
UDAT_MEDIUM,
00148
UDAT_NONE = -1,
00150
UDAT_IGNORE = -2
00151
00152 };
00153
typedef enum UDateFormatStyle UDateFormatStyle;
00154
00176 U_CAPI
UDateFormat* U_EXPORT2
00177
udat_open(UDateFormatStyle timeStyle,
00178 UDateFormatStyle dateStyle,
00179
const char *locale,
00180
const UChar *tzID,
00181 int32_t tzIDLength,
00182
const UChar *pattern,
00183 int32_t patternLength,
00184 UErrorCode *status);
00185
00186
00193 U_CAPI
void U_EXPORT2
00194
udat_close(UDateFormat* format);
00195
00204 U_CAPI
UDateFormat* U_EXPORT2
00205
udat_clone(
const UDateFormat *fmt,
00206 UErrorCode *status);
00207
00227 U_CAPI int32_t U_EXPORT2
00228
udat_format(
const UDateFormat* format,
00229 UDate dateToFormat,
00230 UChar* result,
00231 int32_t resultLength,
00232
UFieldPosition* position,
00233 UErrorCode* status);
00234
00249 U_CAPI
UDate U_EXPORT2
00250
udat_parse(
const UDateFormat* format,
00251
const UChar* text,
00252 int32_t textLength,
00253 int32_t *parsePos,
00254 UErrorCode *status);
00255
00270 U_CAPI
void U_EXPORT2
00271
udat_parseCalendar(
const UDateFormat* format,
00272 UCalendar* calendar,
00273
const UChar* text,
00274 int32_t textLength,
00275 int32_t *parsePos,
00276 UErrorCode *status);
00277
00287 U_CAPI UBool U_EXPORT2
00288
udat_isLenient(
const UDateFormat* fmt);
00289
00299 U_CAPI
void U_EXPORT2
00300
udat_setLenient( UDateFormat* fmt,
00301 UBool isLenient);
00302
00312 U_CAPI
const UCalendar* U_EXPORT2
00313
udat_getCalendar(
const UDateFormat* fmt);
00314
00324 U_CAPI
void U_EXPORT2
00325
udat_setCalendar( UDateFormat* fmt,
00326
const UCalendar* calendarToSet);
00327
00337 U_CAPI
const UNumberFormat* U_EXPORT2
00338
udat_getNumberFormat(
const UDateFormat* fmt);
00339
00349 U_CAPI
void U_EXPORT2
00350
udat_setNumberFormat( UDateFormat* fmt,
00351
const UNumberFormat* numberFormatToSet);
00352
00362 U_CAPI
const char* U_EXPORT2
00363
udat_getAvailable(int32_t index);
00364
00373 U_CAPI int32_t U_EXPORT2
00374
udat_countAvailable(
void);
00375
00386 U_CAPI
UDate U_EXPORT2
00387
udat_get2DigitYearStart(
const UDateFormat *fmt,
00388 UErrorCode *status);
00389
00400 U_CAPI
void U_EXPORT2
00401
udat_set2DigitYearStart( UDateFormat *fmt,
00402 UDate d,
00403 UErrorCode *status);
00404
00417 U_CAPI int32_t U_EXPORT2
00418
udat_toPattern(
const UDateFormat *fmt,
00419 UBool localized,
00420 UChar *result,
00421 int32_t resultLength,
00422 UErrorCode *status);
00423
00434 U_CAPI
void U_EXPORT2
00435
udat_applyPattern( UDateFormat *format,
00436 UBool localized,
00437
const UChar *pattern,
00438 int32_t patternLength);
00439
00441 enum UDateFormatSymbolType {
00443
UDAT_ERAS,
00445
UDAT_MONTHS,
00447
UDAT_SHORT_MONTHS,
00449
UDAT_WEEKDAYS,
00451
UDAT_SHORT_WEEKDAYS,
00453
UDAT_AM_PMS,
00455
UDAT_LOCALIZED_CHARS
00456 };
00457
typedef enum UDateFormatSymbolType UDateFormatSymbolType;
00458
00462
struct UDateFormatSymbols;
00463
typedef struct UDateFormatSymbols UDateFormatSymbols;
00464
00481 U_CAPI int32_t U_EXPORT2
00482
udat_getSymbols(
const UDateFormat *fmt,
00483 UDateFormatSymbolType type,
00484 int32_t index,
00485 UChar *result,
00486 int32_t resultLength,
00487 UErrorCode *status);
00488
00501 U_CAPI int32_t U_EXPORT2
00502
udat_countSymbols(
const UDateFormat *fmt,
00503 UDateFormatSymbolType type);
00504
00520 U_CAPI
void U_EXPORT2
00521
udat_setSymbols( UDateFormat *format,
00522 UDateFormatSymbolType type,
00523 int32_t index,
00524 UChar *value,
00525 int32_t valueLength,
00526 UErrorCode *status);
00527
00528
00532
#ifdef U_USE_DEPRECATED_FORMAT_API
00533
#if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM !=1))
00534
# error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00535
#else
00536
static UDateFormat*
00537 udat_openPattern(
const UChar* pattern,int32_t patternLength,
const char* locale,UErrorCode *status)
00538 {
00539
return udat_open(UDAT_IGNORE,UDAT_IGNORE,locale,NULL,0,pattern,patternLength,status);
00540 }
00541
00542
# define udat_open_2_1(timeStyle,dateStyle,locale,tzId,tzIdLength,status) udat_open(timeStyle,dateStyle,locale,tzId,tzIdLength,NULL,0,status)
00543
#endif
00544
#endif
00545
00546
#endif