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_IS_LEAP_MONTH,
00406
00411 UCAL_FIELD_COUNT,
00412
00421 UCAL_DAY_OF_MONTH=UCAL_DATE
00422 };
00423
00425 typedef enum UCalendarDateFields UCalendarDateFields;
00434 enum UCalendarDaysOfWeek {
00436 UCAL_SUNDAY = 1,
00438 UCAL_MONDAY,
00440 UCAL_TUESDAY,
00442 UCAL_WEDNESDAY,
00444 UCAL_THURSDAY,
00446 UCAL_FRIDAY,
00448 UCAL_SATURDAY
00449 };
00450
00452 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00453
00457 enum UCalendarMonths {
00459 UCAL_JANUARY,
00461 UCAL_FEBRUARY,
00463 UCAL_MARCH,
00465 UCAL_APRIL,
00467 UCAL_MAY,
00469 UCAL_JUNE,
00471 UCAL_JULY,
00473 UCAL_AUGUST,
00475 UCAL_SEPTEMBER,
00477 UCAL_OCTOBER,
00479 UCAL_NOVEMBER,
00481 UCAL_DECEMBER,
00486 UCAL_UNDECIMBER
00487 };
00488
00490 typedef enum UCalendarMonths UCalendarMonths;
00491
00495 enum UCalendarAMPMs {
00497 UCAL_AM,
00499 UCAL_PM
00500 };
00501
00503 typedef enum UCalendarAMPMs UCalendarAMPMs;
00504
00516 U_STABLE UEnumeration* U_EXPORT2
00517 ucal_openTimeZones(UErrorCode* ec);
00518
00535 U_STABLE UEnumeration* U_EXPORT2
00536 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00537
00554 U_STABLE int32_t U_EXPORT2
00555 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00556
00566 U_STABLE void U_EXPORT2
00567 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00568
00585 U_STABLE int32_t U_EXPORT2
00586 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00587
00594 U_STABLE UDate U_EXPORT2
00595 ucal_getNow(void);
00596
00609 U_STABLE UCalendar* U_EXPORT2
00610 ucal_open(const UChar* zoneID,
00611 int32_t len,
00612 const char* locale,
00613 UCalendarType type,
00614 UErrorCode* status);
00615
00622 U_STABLE void U_EXPORT2
00623 ucal_close(UCalendar *cal);
00624
00633 U_DRAFT UCalendar* U_EXPORT2
00634 ucal_clone(const UCalendar* cal,
00635 UErrorCode* status);
00636
00646 U_STABLE void U_EXPORT2
00647 ucal_setTimeZone(UCalendar* cal,
00648 const UChar* zoneID,
00649 int32_t len,
00650 UErrorCode* status);
00651
00656 enum UCalendarDisplayNameType {
00658 UCAL_STANDARD,
00660 UCAL_SHORT_STANDARD,
00662 UCAL_DST,
00664 UCAL_SHORT_DST
00665 };
00666
00668 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00669
00683 U_STABLE int32_t U_EXPORT2
00684 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00685 UCalendarDisplayNameType type,
00686 const char* locale,
00687 UChar* result,
00688 int32_t resultLength,
00689 UErrorCode* status);
00690
00699 U_STABLE UBool U_EXPORT2
00700 ucal_inDaylightTime(const UCalendar* cal,
00701 UErrorCode* status );
00702
00723 U_STABLE void U_EXPORT2
00724 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00725
00746 U_STABLE UDate U_EXPORT2
00747 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00748
00753 enum UCalendarAttribute {
00755 UCAL_LENIENT,
00757 UCAL_FIRST_DAY_OF_WEEK,
00759 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
00760 };
00761
00763 typedef enum UCalendarAttribute UCalendarAttribute;
00764
00776 U_STABLE int32_t U_EXPORT2
00777 ucal_getAttribute(const UCalendar* cal,
00778 UCalendarAttribute attr);
00779
00791 U_STABLE void U_EXPORT2
00792 ucal_setAttribute(UCalendar* cal,
00793 UCalendarAttribute attr,
00794 int32_t newValue);
00795
00805 U_STABLE const char* U_EXPORT2
00806 ucal_getAvailable(int32_t index);
00807
00816 U_STABLE int32_t U_EXPORT2
00817 ucal_countAvailable(void);
00818
00830 U_STABLE UDate U_EXPORT2
00831 ucal_getMillis(const UCalendar* cal,
00832 UErrorCode* status);
00833
00845 U_STABLE void U_EXPORT2
00846 ucal_setMillis(UCalendar* cal,
00847 UDate dateTime,
00848 UErrorCode* status );
00849
00864 U_STABLE void U_EXPORT2
00865 ucal_setDate(UCalendar* cal,
00866 int32_t year,
00867 int32_t month,
00868 int32_t date,
00869 UErrorCode* status);
00870
00888 U_STABLE void U_EXPORT2
00889 ucal_setDateTime(UCalendar* cal,
00890 int32_t year,
00891 int32_t month,
00892 int32_t date,
00893 int32_t hour,
00894 int32_t minute,
00895 int32_t second,
00896 UErrorCode* status);
00897
00907 U_STABLE UBool U_EXPORT2
00908 ucal_equivalentTo(const UCalendar* cal1,
00909 const UCalendar* cal2);
00910
00926 U_STABLE void U_EXPORT2
00927 ucal_add(UCalendar* cal,
00928 UCalendarDateFields field,
00929 int32_t amount,
00930 UErrorCode* status);
00931
00947 U_STABLE void U_EXPORT2
00948 ucal_roll(UCalendar* cal,
00949 UCalendarDateFields field,
00950 int32_t amount,
00951 UErrorCode* status);
00952
00969 U_STABLE int32_t U_EXPORT2
00970 ucal_get(const UCalendar* cal,
00971 UCalendarDateFields field,
00972 UErrorCode* status );
00973
00989 U_STABLE void U_EXPORT2
00990 ucal_set(UCalendar* cal,
00991 UCalendarDateFields field,
00992 int32_t value);
00993
01009 U_STABLE UBool U_EXPORT2
01010 ucal_isSet(const UCalendar* cal,
01011 UCalendarDateFields field);
01012
01027 U_STABLE void U_EXPORT2
01028 ucal_clearField(UCalendar* cal,
01029 UCalendarDateFields field);
01030
01041 U_STABLE void U_EXPORT2
01042 ucal_clear(UCalendar* calendar);
01043
01048 enum UCalendarLimitType {
01050 UCAL_MINIMUM,
01052 UCAL_MAXIMUM,
01054 UCAL_GREATEST_MINIMUM,
01056 UCAL_LEAST_MAXIMUM,
01058 UCAL_ACTUAL_MINIMUM,
01060 UCAL_ACTUAL_MAXIMUM
01061 };
01062
01064 typedef enum UCalendarLimitType UCalendarLimitType;
01065
01080 U_STABLE int32_t U_EXPORT2
01081 ucal_getLimit(const UCalendar* cal,
01082 UCalendarDateFields field,
01083 UCalendarLimitType type,
01084 UErrorCode* status);
01085
01093 U_STABLE const char * U_EXPORT2
01094 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01095
01102 U_DRAFT const char * U_EXPORT2
01103 ucal_getTZDataVersion(UErrorCode* status);
01104
01123 U_DRAFT int32_t U_EXPORT2
01124 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01125 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01126 #endif
01127
01128 #endif