00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef UCAL_H
00011 #define UCAL_H
00012
00013 #include "unicode/utypes.h"
00014 #include "unicode/uenum.h"
00015 #include "unicode/uloc.h"
00016 #include "unicode/localpointer.h"
00017
00018 #if !UCONFIG_NO_FORMATTING
00019
00162 #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown"
00163
00168 typedef void* UCalendar;
00169
00173 enum UCalendarType {
00179 UCAL_TRADITIONAL,
00184 UCAL_DEFAULT = UCAL_TRADITIONAL,
00189 UCAL_GREGORIAN
00190 };
00191
00193 typedef enum UCalendarType UCalendarType;
00194
00198 enum UCalendarDateFields {
00204 UCAL_ERA,
00205
00210 UCAL_YEAR,
00211
00231 UCAL_MONTH,
00232
00244 UCAL_WEEK_OF_YEAR,
00245
00259 UCAL_WEEK_OF_MONTH,
00260
00268 UCAL_DATE,
00269
00275 UCAL_DAY_OF_YEAR,
00276
00291 UCAL_DAY_OF_WEEK,
00292
00316 UCAL_DAY_OF_WEEK_IN_MONTH,
00317
00327 UCAL_AM_PM,
00328
00338 UCAL_HOUR,
00339
00347 UCAL_HOUR_OF_DAY,
00348
00355 UCAL_MINUTE,
00356
00363 UCAL_SECOND,
00364
00371 UCAL_MILLISECOND,
00372
00378 UCAL_ZONE_OFFSET,
00379
00385 UCAL_DST_OFFSET,
00386
00394 UCAL_YEAR_WOY,
00395
00402 UCAL_DOW_LOCAL,
00403
00410 UCAL_EXTENDED_YEAR,
00411
00422 UCAL_JULIAN_DAY,
00423
00433 UCAL_MILLISECONDS_IN_DAY,
00434
00439 UCAL_IS_LEAP_MONTH,
00440
00441
00442
00447 UCAL_FIELD_COUNT,
00448
00457 UCAL_DAY_OF_MONTH=UCAL_DATE
00458 };
00459
00461 typedef enum UCalendarDateFields UCalendarDateFields;
00470 enum UCalendarDaysOfWeek {
00472 UCAL_SUNDAY = 1,
00474 UCAL_MONDAY,
00476 UCAL_TUESDAY,
00478 UCAL_WEDNESDAY,
00480 UCAL_THURSDAY,
00482 UCAL_FRIDAY,
00484 UCAL_SATURDAY
00485 };
00486
00488 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00489
00493 enum UCalendarMonths {
00495 UCAL_JANUARY,
00497 UCAL_FEBRUARY,
00499 UCAL_MARCH,
00501 UCAL_APRIL,
00503 UCAL_MAY,
00505 UCAL_JUNE,
00507 UCAL_JULY,
00509 UCAL_AUGUST,
00511 UCAL_SEPTEMBER,
00513 UCAL_OCTOBER,
00515 UCAL_NOVEMBER,
00517 UCAL_DECEMBER,
00522 UCAL_UNDECIMBER
00523 };
00524
00526 typedef enum UCalendarMonths UCalendarMonths;
00527
00531 enum UCalendarAMPMs {
00533 UCAL_AM,
00535 UCAL_PM
00536 };
00537
00539 typedef enum UCalendarAMPMs UCalendarAMPMs;
00540
00547 enum USystemTimeZoneType {
00552 UCAL_ZONE_TYPE_ANY,
00557 UCAL_ZONE_TYPE_CANONICAL,
00562 UCAL_ZONE_TYPE_CANONICAL_LOCATION
00563 };
00564
00566 typedef enum USystemTimeZoneType USystemTimeZoneType;
00567
00584 U_STABLE UEnumeration* U_EXPORT2
00585 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region,
00586 const int32_t* rawOffset, UErrorCode* ec);
00587
00599 U_STABLE UEnumeration* U_EXPORT2
00600 ucal_openTimeZones(UErrorCode* ec);
00601
00618 U_STABLE UEnumeration* U_EXPORT2
00619 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00620
00637 U_STABLE int32_t U_EXPORT2
00638 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00639
00649 U_STABLE void U_EXPORT2
00650 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00651
00668 U_STABLE int32_t U_EXPORT2
00669 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00670
00677 U_STABLE UDate U_EXPORT2
00678 ucal_getNow(void);
00679
00703 U_STABLE UCalendar* U_EXPORT2
00704 ucal_open(const UChar* zoneID,
00705 int32_t len,
00706 const char* locale,
00707 UCalendarType type,
00708 UErrorCode* status);
00709
00716 U_STABLE void U_EXPORT2
00717 ucal_close(UCalendar *cal);
00718
00719 #if U_SHOW_CPLUSPLUS_API
00720
00721 U_NAMESPACE_BEGIN
00722
00732 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
00733
00734 U_NAMESPACE_END
00735
00736 #endif
00737
00746 U_STABLE UCalendar* U_EXPORT2
00747 ucal_clone(const UCalendar* cal,
00748 UErrorCode* status);
00749
00759 U_STABLE void U_EXPORT2
00760 ucal_setTimeZone(UCalendar* cal,
00761 const UChar* zoneID,
00762 int32_t len,
00763 UErrorCode* status);
00764
00775 U_STABLE int32_t U_EXPORT2
00776 ucal_getTimeZoneID(const UCalendar *cal,
00777 UChar *result,
00778 int32_t resultLength,
00779 UErrorCode *status);
00780
00785 enum UCalendarDisplayNameType {
00787 UCAL_STANDARD,
00789 UCAL_SHORT_STANDARD,
00791 UCAL_DST,
00793 UCAL_SHORT_DST
00794 };
00795
00797 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00798
00812 U_STABLE int32_t U_EXPORT2
00813 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00814 UCalendarDisplayNameType type,
00815 const char* locale,
00816 UChar* result,
00817 int32_t resultLength,
00818 UErrorCode* status);
00819
00828 U_STABLE UBool U_EXPORT2
00829 ucal_inDaylightTime(const UCalendar* cal,
00830 UErrorCode* status );
00831
00852 U_STABLE void U_EXPORT2
00853 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00854
00875 U_STABLE UDate U_EXPORT2
00876 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00877
00882 enum UCalendarAttribute {
00887 UCAL_LENIENT,
00892 UCAL_FIRST_DAY_OF_WEEK,
00897 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK,
00903 UCAL_REPEATED_WALL_TIME,
00909 UCAL_SKIPPED_WALL_TIME
00910 };
00911
00913 typedef enum UCalendarAttribute UCalendarAttribute;
00914
00920 enum UCalendarWallTimeOption {
00927 UCAL_WALLTIME_LAST,
00934 UCAL_WALLTIME_FIRST,
00940 UCAL_WALLTIME_NEXT_VALID
00941 };
00943 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption;
00944
00956 U_STABLE int32_t U_EXPORT2
00957 ucal_getAttribute(const UCalendar* cal,
00958 UCalendarAttribute attr);
00959
00971 U_STABLE void U_EXPORT2
00972 ucal_setAttribute(UCalendar* cal,
00973 UCalendarAttribute attr,
00974 int32_t newValue);
00975
00985 U_STABLE const char* U_EXPORT2
00986 ucal_getAvailable(int32_t localeIndex);
00987
00996 U_STABLE int32_t U_EXPORT2
00997 ucal_countAvailable(void);
00998
01010 U_STABLE UDate U_EXPORT2
01011 ucal_getMillis(const UCalendar* cal,
01012 UErrorCode* status);
01013
01025 U_STABLE void U_EXPORT2
01026 ucal_setMillis(UCalendar* cal,
01027 UDate dateTime,
01028 UErrorCode* status );
01029
01044 U_STABLE void U_EXPORT2
01045 ucal_setDate(UCalendar* cal,
01046 int32_t year,
01047 int32_t month,
01048 int32_t date,
01049 UErrorCode* status);
01050
01068 U_STABLE void U_EXPORT2
01069 ucal_setDateTime(UCalendar* cal,
01070 int32_t year,
01071 int32_t month,
01072 int32_t date,
01073 int32_t hour,
01074 int32_t minute,
01075 int32_t second,
01076 UErrorCode* status);
01077
01087 U_STABLE UBool U_EXPORT2
01088 ucal_equivalentTo(const UCalendar* cal1,
01089 const UCalendar* cal2);
01090
01109 U_STABLE void U_EXPORT2
01110 ucal_add(UCalendar* cal,
01111 UCalendarDateFields field,
01112 int32_t amount,
01113 UErrorCode* status);
01114
01139 U_STABLE void U_EXPORT2
01140 ucal_roll(UCalendar* cal,
01141 UCalendarDateFields field,
01142 int32_t amount,
01143 UErrorCode* status);
01144
01161 U_STABLE int32_t U_EXPORT2
01162 ucal_get(const UCalendar* cal,
01163 UCalendarDateFields field,
01164 UErrorCode* status );
01165
01181 U_STABLE void U_EXPORT2
01182 ucal_set(UCalendar* cal,
01183 UCalendarDateFields field,
01184 int32_t value);
01185
01201 U_STABLE UBool U_EXPORT2
01202 ucal_isSet(const UCalendar* cal,
01203 UCalendarDateFields field);
01204
01219 U_STABLE void U_EXPORT2
01220 ucal_clearField(UCalendar* cal,
01221 UCalendarDateFields field);
01222
01233 U_STABLE void U_EXPORT2
01234 ucal_clear(UCalendar* calendar);
01235
01240 enum UCalendarLimitType {
01242 UCAL_MINIMUM,
01244 UCAL_MAXIMUM,
01246 UCAL_GREATEST_MINIMUM,
01248 UCAL_LEAST_MAXIMUM,
01250 UCAL_ACTUAL_MINIMUM,
01252 UCAL_ACTUAL_MAXIMUM
01253 };
01254
01256 typedef enum UCalendarLimitType UCalendarLimitType;
01257
01272 U_STABLE int32_t U_EXPORT2
01273 ucal_getLimit(const UCalendar* cal,
01274 UCalendarDateFields field,
01275 UCalendarLimitType type,
01276 UErrorCode* status);
01277
01285 U_STABLE const char * U_EXPORT2
01286 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01287
01294 U_STABLE const char * U_EXPORT2
01295 ucal_getTZDataVersion(UErrorCode* status);
01296
01315 U_STABLE int32_t U_EXPORT2
01316 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01317 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01325 U_STABLE const char * U_EXPORT2
01326 ucal_getType(const UCalendar *cal, UErrorCode* status);
01327
01344 U_STABLE UEnumeration* U_EXPORT2
01345 ucal_getKeywordValuesForLocale(const char* key,
01346 const char* locale,
01347 UBool commonlyUsed,
01348 UErrorCode* status);
01349
01350
01354 enum UCalendarWeekdayType {
01359 UCAL_WEEKDAY,
01364 UCAL_WEEKEND,
01370 UCAL_WEEKEND_ONSET,
01376 UCAL_WEEKEND_CEASE
01377 };
01378
01380 typedef enum UCalendarWeekdayType UCalendarWeekdayType;
01381
01399 U_STABLE UCalendarWeekdayType U_EXPORT2
01400 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
01401
01417 U_STABLE int32_t U_EXPORT2
01418 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
01419
01430 U_STABLE UBool U_EXPORT2
01431 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
01432
01457 U_STABLE int32_t U_EXPORT2
01458 ucal_getFieldDifference(UCalendar* cal,
01459 UDate target,
01460 UCalendarDateFields field,
01461 UErrorCode* status);
01462
01467 enum UTimeZoneTransitionType {
01473 UCAL_TZ_TRANSITION_NEXT,
01479 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE,
01485 UCAL_TZ_TRANSITION_PREVIOUS,
01491 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE
01492 };
01493
01494 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType;
01511 U_STABLE UBool U_EXPORT2
01512 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type,
01513 UDate* transition, UErrorCode* status);
01514
01539 U_STABLE int32_t U_EXPORT2
01540 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
01541 UChar* winid, int32_t winidCapacity, UErrorCode* status);
01542
01571 U_STABLE int32_t U_EXPORT2
01572 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region,
01573 UChar* id, int32_t idCapacity, UErrorCode* status);
01574
01575 #endif
01576
01577 #endif