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
00210 UCAL_WEEK_OF_YEAR,
00211
00225 UCAL_WEEK_OF_MONTH,
00226
00234 UCAL_DATE,
00235
00241 UCAL_DAY_OF_YEAR,
00242
00257 UCAL_DAY_OF_WEEK,
00258
00282 UCAL_DAY_OF_WEEK_IN_MONTH,
00283
00293 UCAL_AM_PM,
00294
00304 UCAL_HOUR,
00305
00313 UCAL_HOUR_OF_DAY,
00314
00321 UCAL_MINUTE,
00322
00329 UCAL_SECOND,
00330
00337 UCAL_MILLISECOND,
00338
00344 UCAL_ZONE_OFFSET,
00345
00351 UCAL_DST_OFFSET,
00352
00360 UCAL_YEAR_WOY,
00361
00368 UCAL_DOW_LOCAL,
00369
00376 UCAL_EXTENDED_YEAR,
00377
00388 UCAL_JULIAN_DAY,
00389
00399 UCAL_MILLISECONDS_IN_DAY,
00400
00405 UCAL_FIELD_COUNT,
00406
00415 UCAL_DAY_OF_MONTH=UCAL_DATE
00416 };
00417
00419 typedef enum UCalendarDateFields UCalendarDateFields;
00428 enum UCalendarDaysOfWeek {
00430 UCAL_SUNDAY = 1,
00432 UCAL_MONDAY,
00434 UCAL_TUESDAY,
00436 UCAL_WEDNESDAY,
00438 UCAL_THURSDAY,
00440 UCAL_FRIDAY,
00442 UCAL_SATURDAY
00443 };
00444
00446 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00447
00451 enum UCalendarMonths {
00453 UCAL_JANUARY,
00455 UCAL_FEBRUARY,
00457 UCAL_MARCH,
00459 UCAL_APRIL,
00461 UCAL_MAY,
00463 UCAL_JUNE,
00465 UCAL_JULY,
00467 UCAL_AUGUST,
00469 UCAL_SEPTEMBER,
00471 UCAL_OCTOBER,
00473 UCAL_NOVEMBER,
00475 UCAL_DECEMBER,
00480 UCAL_UNDECIMBER
00481 };
00482
00484 typedef enum UCalendarMonths UCalendarMonths;
00485
00489 enum UCalendarAMPMs {
00491 UCAL_AM,
00493 UCAL_PM
00494 };
00495
00497 typedef enum UCalendarAMPMs UCalendarAMPMs;
00498
00510 U_STABLE UEnumeration* U_EXPORT2
00511 ucal_openTimeZones(UErrorCode* ec);
00512
00529 U_STABLE UEnumeration* U_EXPORT2
00530 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00531
00548 U_STABLE int32_t U_EXPORT2
00549 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00550
00560 U_STABLE void U_EXPORT2
00561 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00562
00579 U_STABLE int32_t U_EXPORT2
00580 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00581
00588 U_STABLE UDate U_EXPORT2
00589 ucal_getNow(void);
00590
00603 U_STABLE UCalendar* U_EXPORT2
00604 ucal_open(const UChar* zoneID,
00605 int32_t len,
00606 const char* locale,
00607 UCalendarType type,
00608 UErrorCode* status);
00609
00616 U_STABLE void U_EXPORT2
00617 ucal_close(UCalendar *cal);
00618
00628 U_STABLE void U_EXPORT2
00629 ucal_setTimeZone(UCalendar* cal,
00630 const UChar* zoneID,
00631 int32_t len,
00632 UErrorCode* status);
00633
00638 enum UCalendarDisplayNameType {
00640 UCAL_STANDARD,
00642 UCAL_SHORT_STANDARD,
00644 UCAL_DST,
00646 UCAL_SHORT_DST
00647 };
00648
00650 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00651
00665 U_STABLE int32_t U_EXPORT2
00666 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00667 UCalendarDisplayNameType type,
00668 const char* locale,
00669 UChar* result,
00670 int32_t resultLength,
00671 UErrorCode* status);
00672
00681 U_STABLE UBool U_EXPORT2
00682 ucal_inDaylightTime(const UCalendar* cal,
00683 UErrorCode* status );
00684
00705 U_DRAFT void U_EXPORT2
00706 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00707
00728 U_DRAFT UDate U_EXPORT2
00729 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00730
00735 enum UCalendarAttribute {
00737 UCAL_LENIENT,
00739 UCAL_FIRST_DAY_OF_WEEK,
00741 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
00742 };
00743
00745 typedef enum UCalendarAttribute UCalendarAttribute;
00746
00758 U_STABLE int32_t U_EXPORT2
00759 ucal_getAttribute(const UCalendar* cal,
00760 UCalendarAttribute attr);
00761
00773 U_STABLE void U_EXPORT2
00774 ucal_setAttribute(UCalendar* cal,
00775 UCalendarAttribute attr,
00776 int32_t newValue);
00777
00787 U_STABLE const char* U_EXPORT2
00788 ucal_getAvailable(int32_t index);
00789
00798 U_STABLE int32_t U_EXPORT2
00799 ucal_countAvailable(void);
00800
00812 U_STABLE UDate U_EXPORT2
00813 ucal_getMillis(const UCalendar* cal,
00814 UErrorCode* status);
00815
00827 U_STABLE void U_EXPORT2
00828 ucal_setMillis(UCalendar* cal,
00829 UDate dateTime,
00830 UErrorCode* status );
00831
00846 U_STABLE void U_EXPORT2
00847 ucal_setDate(UCalendar* cal,
00848 int32_t year,
00849 int32_t month,
00850 int32_t date,
00851 UErrorCode* status);
00852
00870 U_STABLE void U_EXPORT2
00871 ucal_setDateTime(UCalendar* cal,
00872 int32_t year,
00873 int32_t month,
00874 int32_t date,
00875 int32_t hour,
00876 int32_t minute,
00877 int32_t second,
00878 UErrorCode* status);
00879
00889 U_STABLE UBool U_EXPORT2
00890 ucal_equivalentTo(const UCalendar* cal1,
00891 const UCalendar* cal2);
00892
00908 U_STABLE void U_EXPORT2
00909 ucal_add(UCalendar* cal,
00910 UCalendarDateFields field,
00911 int32_t amount,
00912 UErrorCode* status);
00913
00929 U_STABLE void U_EXPORT2
00930 ucal_roll(UCalendar* cal,
00931 UCalendarDateFields field,
00932 int32_t amount,
00933 UErrorCode* status);
00934
00951 U_STABLE int32_t U_EXPORT2
00952 ucal_get(const UCalendar* cal,
00953 UCalendarDateFields field,
00954 UErrorCode* status );
00955
00971 U_STABLE void U_EXPORT2
00972 ucal_set(UCalendar* cal,
00973 UCalendarDateFields field,
00974 int32_t value);
00975
00991 U_STABLE UBool U_EXPORT2
00992 ucal_isSet(const UCalendar* cal,
00993 UCalendarDateFields field);
00994
01009 U_STABLE void U_EXPORT2
01010 ucal_clearField(UCalendar* cal,
01011 UCalendarDateFields field);
01012
01023 U_STABLE void U_EXPORT2
01024 ucal_clear(UCalendar* calendar);
01025
01030 enum UCalendarLimitType {
01032 UCAL_MINIMUM,
01034 UCAL_MAXIMUM,
01036 UCAL_GREATEST_MINIMUM,
01038 UCAL_LEAST_MAXIMUM,
01040 UCAL_ACTUAL_MINIMUM,
01042 UCAL_ACTUAL_MAXIMUM
01043 };
01044
01046 typedef enum UCalendarLimitType UCalendarLimitType;
01047
01062 U_STABLE int32_t U_EXPORT2
01063 ucal_getLimit(const UCalendar* cal,
01064 UCalendarDateFields field,
01065 UCalendarLimitType type,
01066 UErrorCode* status);
01067
01068 #ifdef U_USE_UCAL_OBSOLETE_2_8
01069
01079 U_OBSOLETE const UChar* U_EXPORT2
01080 ucal_getAvailableTZIDs(int32_t rawOffset,
01081 int32_t index,
01082 UErrorCode* status);
01083
01093 U_OBSOLETE int32_t U_EXPORT2
01094 ucal_countAvailableTZIDs(int32_t rawOffset);
01095 #endif
01096
01104 U_STABLE const char * U_EXPORT2
01105 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01106
01113 U_DRAFT const char * U_EXPORT2
01114 ucal_getTZDataVersion(UErrorCode* status);
01115
01116 #endif
01117
01118 #endif