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
00174 U_CAPI UDateFormat* U_EXPORT2
00175 udat_open(UDateFormatStyle timeStyle,
00176 UDateFormatStyle dateStyle,
00177 const char *locale,
00178 const UChar *tzID,
00179 int32_t tzIDLength,
00180 const UChar *pattern,
00181 int32_t patternLength,
00182 UErrorCode *status);
00183
00184
00191 U_CAPI void U_EXPORT2
00192 udat_close(UDateFormat* format);
00193
00202 U_CAPI UDateFormat* U_EXPORT2
00203 udat_clone(const UDateFormat *fmt,
00204 UErrorCode *status);
00205
00225 U_CAPI int32_t U_EXPORT2
00226 udat_format( const UDateFormat* format,
00227 UDate dateToFormat,
00228 UChar* result,
00229 int32_t resultLength,
00230 UFieldPosition* position,
00231 UErrorCode* status);
00232
00247 U_CAPI UDate U_EXPORT2
00248 udat_parse( const UDateFormat* format,
00249 const UChar* text,
00250 int32_t textLength,
00251 int32_t *parsePos,
00252 UErrorCode *status);
00253
00268 U_CAPI void U_EXPORT2
00269 udat_parseCalendar(const UDateFormat* format,
00270 UCalendar* calendar,
00271 const UChar* text,
00272 int32_t textLength,
00273 int32_t *parsePos,
00274 UErrorCode *status);
00275
00285 U_CAPI UBool U_EXPORT2
00286 udat_isLenient(const UDateFormat* fmt);
00287
00297 U_CAPI void U_EXPORT2
00298 udat_setLenient( UDateFormat* fmt,
00299 UBool isLenient);
00300
00310 U_CAPI const UCalendar* U_EXPORT2
00311 udat_getCalendar(const UDateFormat* fmt);
00312
00322 U_CAPI void U_EXPORT2
00323 udat_setCalendar( UDateFormat* fmt,
00324 const UCalendar* calendarToSet);
00325
00335 U_CAPI const UNumberFormat* U_EXPORT2
00336 udat_getNumberFormat(const UDateFormat* fmt);
00337
00347 U_CAPI void U_EXPORT2
00348 udat_setNumberFormat( UDateFormat* fmt,
00349 const UNumberFormat* numberFormatToSet);
00350
00360 U_CAPI const char* U_EXPORT2
00361 udat_getAvailable(int32_t index);
00362
00371 U_CAPI int32_t U_EXPORT2
00372 udat_countAvailable(void);
00373
00384 U_CAPI UDate U_EXPORT2
00385 udat_get2DigitYearStart( const UDateFormat *fmt,
00386 UErrorCode *status);
00387
00398 U_CAPI void U_EXPORT2
00399 udat_set2DigitYearStart( UDateFormat *fmt,
00400 UDate d,
00401 UErrorCode *status);
00402
00415 U_CAPI int32_t U_EXPORT2
00416 udat_toPattern( const UDateFormat *fmt,
00417 UBool localized,
00418 UChar *result,
00419 int32_t resultLength,
00420 UErrorCode *status);
00421
00432 U_CAPI void U_EXPORT2
00433 udat_applyPattern( UDateFormat *format,
00434 UBool localized,
00435 const UChar *pattern,
00436 int32_t patternLength);
00437
00439 enum UDateFormatSymbolType {
00441 UDAT_ERAS,
00443 UDAT_MONTHS,
00445 UDAT_SHORT_MONTHS,
00447 UDAT_WEEKDAYS,
00449 UDAT_SHORT_WEEKDAYS,
00451 UDAT_AM_PMS,
00453 UDAT_LOCALIZED_CHARS
00454 };
00455 typedef enum UDateFormatSymbolType UDateFormatSymbolType;
00456
00460 struct UDateFormatSymbols;
00461 typedef struct UDateFormatSymbols UDateFormatSymbols;
00462
00479 U_CAPI int32_t U_EXPORT2
00480 udat_getSymbols(const UDateFormat *fmt,
00481 UDateFormatSymbolType type,
00482 int32_t index,
00483 UChar *result,
00484 int32_t resultLength,
00485 UErrorCode *status);
00486
00499 U_CAPI int32_t U_EXPORT2
00500 udat_countSymbols( const UDateFormat *fmt,
00501 UDateFormatSymbolType type);
00502
00518 U_CAPI void U_EXPORT2
00519 udat_setSymbols( UDateFormat *format,
00520 UDateFormatSymbolType type,
00521 int32_t index,
00522 UChar *value,
00523 int32_t valueLength,
00524 UErrorCode *status);
00525
00526
00530 #ifdef U_USE_DEPRECATED_FORMAT_API
00531 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM != 2))
00532 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00533 #else
00534 static UDateFormat*
00535 udat_openPattern(const UChar* pattern,int32_t patternLength,const char* locale,UErrorCode *status)
00536 {
00537 return udat_open(UDAT_IGNORE,UDAT_IGNORE,locale,NULL,0,pattern,patternLength,status);
00538 }
00539
00540 # define udat_open_2_2(timeStyle,dateStyle,locale,tzId,tzIdLength,status) udat_open(timeStyle,dateStyle,locale,tzId,tzIdLength,NULL,0,status)
00541 #endif
00542 #endif
00543
00544 #endif