00001
00002
00003
00004
00005
00006
00007
00008 #ifndef UCAL_H
00009 #define UCAL_H
00010
00011 #include "unicode/utypes.h"
00012 #include "unicode/uenum.h"
00013 #include "unicode/uloc.h"
00014
00015 #if !UCONFIG_NO_FORMATTING
00016
00146 typedef void* UCalendar;
00147
00151 enum UCalendarType {
00153 UCAL_TRADITIONAL,
00155 UCAL_GREGORIAN
00156 };
00157
00159 typedef enum UCalendarType UCalendarType;
00160
00164 enum UCalendarDateFields {
00170 UCAL_ERA,
00171
00176 UCAL_YEAR,
00177
00197 UCAL_MONTH,
00198
00209 UCAL_WEEK_OF_YEAR,
00210
00222 UCAL_WEEK_OF_MONTH,
00223
00231 UCAL_DATE,
00232
00238 UCAL_DAY_OF_YEAR,
00239
00255 UCAL_DAY_OF_WEEK,
00256
00280 UCAL_DAY_OF_WEEK_IN_MONTH,
00281
00291 UCAL_AM_PM,
00292
00302 UCAL_HOUR,
00303
00311 UCAL_HOUR_OF_DAY,
00312
00319 UCAL_MINUTE,
00320
00327 UCAL_SECOND,
00328
00335 UCAL_MILLISECOND,
00336
00342 UCAL_ZONE_OFFSET,
00343
00349 UCAL_DST_OFFSET,
00350
00358 UCAL_YEAR_WOY,
00359
00366 UCAL_DOW_LOCAL,
00367
00374 UCAL_EXTENDED_YEAR,
00375
00386 UCAL_JULIAN_DAY,
00387
00397 UCAL_MILLISECONDS_IN_DAY,
00398
00403 UCAL_FIELD_COUNT,
00404
00413 UCAL_DAY_OF_MONTH=UCAL_DATE
00414 };
00415
00417 typedef enum UCalendarDateFields UCalendarDateFields;
00426 enum UCalendarDaysOfWeek {
00428 UCAL_SUNDAY = 1,
00430 UCAL_MONDAY,
00432 UCAL_TUESDAY,
00434 UCAL_WEDNESDAY,
00436 UCAL_THURSDAY,
00438 UCAL_FRIDAY,
00440 UCAL_SATURDAY
00441 };
00442
00444 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00445
00449 enum UCalendarMonths {
00451 UCAL_JANUARY,
00453 UCAL_FEBRUARY,
00455 UCAL_MARCH,
00457 UCAL_APRIL,
00459 UCAL_MAY,
00461 UCAL_JUNE,
00463 UCAL_JULY,
00465 UCAL_AUGUST,
00467 UCAL_SEPTEMBER,
00469 UCAL_OCTOBER,
00471 UCAL_NOVEMBER,
00473 UCAL_DECEMBER,
00478 UCAL_UNDECIMBER
00479 };
00480
00482 typedef enum UCalendarMonths UCalendarMonths;
00483
00487 enum UCalendarAMPMs {
00489 UCAL_AM,
00491 UCAL_PM
00492 };
00493
00495 typedef enum UCalendarAMPMs UCalendarAMPMs;
00496
00508 U_STABLE UEnumeration* U_EXPORT2
00509 ucal_openTimeZones(UErrorCode* ec);
00510
00527 U_STABLE UEnumeration* U_EXPORT2
00528 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00529
00546 U_STABLE int32_t U_EXPORT2
00547 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00548
00558 U_STABLE void U_EXPORT2
00559 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00560
00577 U_STABLE int32_t U_EXPORT2
00578 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00579
00586 U_STABLE UDate U_EXPORT2
00587 ucal_getNow(void);
00588
00601 U_STABLE UCalendar* U_EXPORT2
00602 ucal_open(const UChar* zoneID,
00603 int32_t len,
00604 const char* locale,
00605 UCalendarType type,
00606 UErrorCode* status);
00607
00614 U_STABLE void U_EXPORT2
00615 ucal_close(UCalendar *cal);
00616
00626 U_STABLE void U_EXPORT2
00627 ucal_setTimeZone(UCalendar* cal,
00628 const UChar* zoneID,
00629 int32_t len,
00630 UErrorCode* status);
00631
00636 enum UCalendarDisplayNameType {
00638 UCAL_STANDARD,
00640 UCAL_SHORT_STANDARD,
00642 UCAL_DST,
00644 UCAL_SHORT_DST
00645 };
00646
00648 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00649
00663 U_STABLE int32_t U_EXPORT2
00664 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00665 UCalendarDisplayNameType type,
00666 const char* locale,
00667 UChar* result,
00668 int32_t resultLength,
00669 UErrorCode* status);
00670
00679 U_STABLE UBool U_EXPORT2
00680 ucal_inDaylightTime(const UCalendar* cal,
00681 UErrorCode* status );
00682
00703 U_DRAFT void U_EXPORT2
00704 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00705
00726 U_DRAFT UDate U_EXPORT2
00727 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00728
00733 enum UCalendarAttribute {
00735 UCAL_LENIENT,
00737 UCAL_FIRST_DAY_OF_WEEK,
00739 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
00740 };
00741
00743 typedef enum UCalendarAttribute UCalendarAttribute;
00744
00756 U_STABLE int32_t U_EXPORT2
00757 ucal_getAttribute(const UCalendar* cal,
00758 UCalendarAttribute attr);
00759
00771 U_STABLE void U_EXPORT2
00772 ucal_setAttribute(UCalendar* cal,
00773 UCalendarAttribute attr,
00774 int32_t newValue);
00775
00785 U_STABLE const char* U_EXPORT2
00786 ucal_getAvailable(int32_t index);
00787
00796 U_STABLE int32_t U_EXPORT2
00797 ucal_countAvailable(void);
00798
00810 U_STABLE UDate U_EXPORT2
00811 ucal_getMillis(const UCalendar* cal,
00812 UErrorCode* status);
00813
00825 U_STABLE void U_EXPORT2
00826 ucal_setMillis(UCalendar* cal,
00827 UDate dateTime,
00828 UErrorCode* status );
00829
00844 U_STABLE void U_EXPORT2
00845 ucal_setDate(UCalendar* cal,
00846 int32_t year,
00847 int32_t month,
00848 int32_t date,
00849 UErrorCode* status);
00850
00868 U_STABLE void U_EXPORT2
00869 ucal_setDateTime(UCalendar* cal,
00870 int32_t year,
00871 int32_t month,
00872 int32_t date,
00873 int32_t hour,
00874 int32_t minute,
00875 int32_t second,
00876 UErrorCode* status);
00877
00887 U_STABLE UBool U_EXPORT2
00888 ucal_equivalentTo(const UCalendar* cal1,
00889 const UCalendar* cal2);
00890
00906 U_STABLE void U_EXPORT2
00907 ucal_add(UCalendar* cal,
00908 UCalendarDateFields field,
00909 int32_t amount,
00910 UErrorCode* status);
00911
00927 U_STABLE void U_EXPORT2
00928 ucal_roll(UCalendar* cal,
00929 UCalendarDateFields field,
00930 int32_t amount,
00931 UErrorCode* status);
00932
00949 U_STABLE int32_t U_EXPORT2
00950 ucal_get(const UCalendar* cal,
00951 UCalendarDateFields field,
00952 UErrorCode* status );
00953
00969 U_STABLE void U_EXPORT2
00970 ucal_set(UCalendar* cal,
00971 UCalendarDateFields field,
00972 int32_t value);
00973
00989 U_STABLE UBool U_EXPORT2
00990 ucal_isSet(const UCalendar* cal,
00991 UCalendarDateFields field);
00992
01007 U_STABLE void U_EXPORT2
01008 ucal_clearField(UCalendar* cal,
01009 UCalendarDateFields field);
01010
01021 U_STABLE void U_EXPORT2
01022 ucal_clear(UCalendar* calendar);
01023
01028 enum UCalendarLimitType {
01030 UCAL_MINIMUM,
01032 UCAL_MAXIMUM,
01034 UCAL_GREATEST_MINIMUM,
01036 UCAL_LEAST_MAXIMUM,
01038 UCAL_ACTUAL_MINIMUM,
01040 UCAL_ACTUAL_MAXIMUM
01041 };
01042
01044 typedef enum UCalendarLimitType UCalendarLimitType;
01045
01060 U_STABLE int32_t U_EXPORT2
01061 ucal_getLimit(const UCalendar* cal,
01062 UCalendarDateFields field,
01063 UCalendarLimitType type,
01064 UErrorCode* status);
01065
01066 #ifdef U_USE_UCAL_OBSOLETE_2_8
01067
01077 U_OBSOLETE const UChar* U_EXPORT2
01078 ucal_getAvailableTZIDs(int32_t rawOffset,
01079 int32_t index,
01080 UErrorCode* status);
01081
01091 U_OBSOLETE int32_t U_EXPORT2
01092 ucal_countAvailableTZIDs(int32_t rawOffset);
01093 #endif
01094
01102 U_STABLE const char * U_EXPORT2
01103 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01104
01105 #endif
01106
01107 #endif