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
00017 #if U_SHOW_CPLUSPLUS_API
00018 #include "unicode/localpointer.h"
00019 #endif // U_SHOW_CPLUSPLUS_API
00020
00021 #if !UCONFIG_NO_FORMATTING
00022
00166 #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown"
00167
00172 typedef void* UCalendar;
00173
00177 enum UCalendarType {
00183 UCAL_TRADITIONAL,
00188 UCAL_DEFAULT = UCAL_TRADITIONAL,
00193 UCAL_GREGORIAN
00194 };
00195
00197 typedef enum UCalendarType UCalendarType;
00198
00202 enum UCalendarDateFields {
00208 UCAL_ERA,
00209
00214 UCAL_YEAR,
00215
00235 UCAL_MONTH,
00236
00248 UCAL_WEEK_OF_YEAR,
00249
00263 UCAL_WEEK_OF_MONTH,
00264
00272 UCAL_DATE,
00273
00279 UCAL_DAY_OF_YEAR,
00280
00295 UCAL_DAY_OF_WEEK,
00296
00320 UCAL_DAY_OF_WEEK_IN_MONTH,
00321
00331 UCAL_AM_PM,
00332
00342 UCAL_HOUR,
00343
00351 UCAL_HOUR_OF_DAY,
00352
00359 UCAL_MINUTE,
00360
00367 UCAL_SECOND,
00368
00375 UCAL_MILLISECOND,
00376
00382 UCAL_ZONE_OFFSET,
00383
00389 UCAL_DST_OFFSET,
00390
00398 UCAL_YEAR_WOY,
00399
00406 UCAL_DOW_LOCAL,
00407
00414 UCAL_EXTENDED_YEAR,
00415
00426 UCAL_JULIAN_DAY,
00427
00437 UCAL_MILLISECONDS_IN_DAY,
00438
00443 UCAL_IS_LEAP_MONTH,
00444
00445
00446
00447 #ifndef U_FORCE_HIDE_DEPRECATED_API
00448
00452 UCAL_FIELD_COUNT,
00453 #endif // U_FORCE_HIDE_DEPRECATED_API
00454
00463 UCAL_DAY_OF_MONTH=UCAL_DATE
00464 };
00465
00467 typedef enum UCalendarDateFields UCalendarDateFields;
00476 enum UCalendarDaysOfWeek {
00478 UCAL_SUNDAY = 1,
00480 UCAL_MONDAY,
00482 UCAL_TUESDAY,
00484 UCAL_WEDNESDAY,
00486 UCAL_THURSDAY,
00488 UCAL_FRIDAY,
00490 UCAL_SATURDAY
00491 };
00492
00494 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00495
00499 enum UCalendarMonths {
00501 UCAL_JANUARY,
00503 UCAL_FEBRUARY,
00505 UCAL_MARCH,
00507 UCAL_APRIL,
00509 UCAL_MAY,
00511 UCAL_JUNE,
00513 UCAL_JULY,
00515 UCAL_AUGUST,
00517 UCAL_SEPTEMBER,
00519 UCAL_OCTOBER,
00521 UCAL_NOVEMBER,
00523 UCAL_DECEMBER,
00528 UCAL_UNDECIMBER
00529 };
00530
00532 typedef enum UCalendarMonths UCalendarMonths;
00533
00537 enum UCalendarAMPMs {
00539 UCAL_AM,
00541 UCAL_PM
00542 };
00543
00545 typedef enum UCalendarAMPMs UCalendarAMPMs;
00546
00553 enum USystemTimeZoneType {
00558 UCAL_ZONE_TYPE_ANY,
00563 UCAL_ZONE_TYPE_CANONICAL,
00568 UCAL_ZONE_TYPE_CANONICAL_LOCATION
00569 };
00570
00572 typedef enum USystemTimeZoneType USystemTimeZoneType;
00573
00590 U_CAPI UEnumeration* U_EXPORT2
00591 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region,
00592 const int32_t* rawOffset, UErrorCode* ec);
00593
00605 U_CAPI UEnumeration* U_EXPORT2
00606 ucal_openTimeZones(UErrorCode* ec);
00607
00624 U_CAPI UEnumeration* U_EXPORT2
00625 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00626
00650 U_CAPI int32_t U_EXPORT2
00651 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00652
00662 U_CAPI void U_EXPORT2
00663 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00664
00694 U_CAPI int32_t U_EXPORT2
00695 ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec);
00696
00713 U_CAPI int32_t U_EXPORT2
00714 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00715
00722 U_CAPI UDate U_EXPORT2
00723 ucal_getNow(void);
00724
00748 U_CAPI UCalendar* U_EXPORT2
00749 ucal_open(const UChar* zoneID,
00750 int32_t len,
00751 const char* locale,
00752 UCalendarType type,
00753 UErrorCode* status);
00754
00761 U_CAPI void U_EXPORT2
00762 ucal_close(UCalendar *cal);
00763
00764 #if U_SHOW_CPLUSPLUS_API
00765
00766 U_NAMESPACE_BEGIN
00767
00777 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
00778
00779 U_NAMESPACE_END
00780
00781 #endif
00782
00791 U_CAPI UCalendar* U_EXPORT2
00792 ucal_clone(const UCalendar* cal,
00793 UErrorCode* status);
00794
00804 U_CAPI void U_EXPORT2
00805 ucal_setTimeZone(UCalendar* cal,
00806 const UChar* zoneID,
00807 int32_t len,
00808 UErrorCode* status);
00809
00820 U_CAPI int32_t U_EXPORT2
00821 ucal_getTimeZoneID(const UCalendar *cal,
00822 UChar *result,
00823 int32_t resultLength,
00824 UErrorCode *status);
00825
00830 enum UCalendarDisplayNameType {
00832 UCAL_STANDARD,
00834 UCAL_SHORT_STANDARD,
00836 UCAL_DST,
00838 UCAL_SHORT_DST
00839 };
00840
00842 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00843
00857 U_CAPI int32_t U_EXPORT2
00858 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00859 UCalendarDisplayNameType type,
00860 const char* locale,
00861 UChar* result,
00862 int32_t resultLength,
00863 UErrorCode* status);
00864
00873 U_CAPI UBool U_EXPORT2
00874 ucal_inDaylightTime(const UCalendar* cal,
00875 UErrorCode* status );
00876
00897 U_CAPI void U_EXPORT2
00898 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00899
00920 U_CAPI UDate U_EXPORT2
00921 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00922
00927 enum UCalendarAttribute {
00932 UCAL_LENIENT,
00937 UCAL_FIRST_DAY_OF_WEEK,
00942 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK,
00948 UCAL_REPEATED_WALL_TIME,
00954 UCAL_SKIPPED_WALL_TIME
00955 };
00956
00958 typedef enum UCalendarAttribute UCalendarAttribute;
00959
00965 enum UCalendarWallTimeOption {
00972 UCAL_WALLTIME_LAST,
00979 UCAL_WALLTIME_FIRST,
00985 UCAL_WALLTIME_NEXT_VALID
00986 };
00988 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption;
00989
01001 U_CAPI int32_t U_EXPORT2
01002 ucal_getAttribute(const UCalendar* cal,
01003 UCalendarAttribute attr);
01004
01016 U_CAPI void U_EXPORT2
01017 ucal_setAttribute(UCalendar* cal,
01018 UCalendarAttribute attr,
01019 int32_t newValue);
01020
01030 U_CAPI const char* U_EXPORT2
01031 ucal_getAvailable(int32_t localeIndex);
01032
01041 U_CAPI int32_t U_EXPORT2
01042 ucal_countAvailable(void);
01043
01055 U_CAPI UDate U_EXPORT2
01056 ucal_getMillis(const UCalendar* cal,
01057 UErrorCode* status);
01058
01070 U_CAPI void U_EXPORT2
01071 ucal_setMillis(UCalendar* cal,
01072 UDate dateTime,
01073 UErrorCode* status );
01074
01089 U_CAPI void U_EXPORT2
01090 ucal_setDate(UCalendar* cal,
01091 int32_t year,
01092 int32_t month,
01093 int32_t date,
01094 UErrorCode* status);
01095
01113 U_CAPI void U_EXPORT2
01114 ucal_setDateTime(UCalendar* cal,
01115 int32_t year,
01116 int32_t month,
01117 int32_t date,
01118 int32_t hour,
01119 int32_t minute,
01120 int32_t second,
01121 UErrorCode* status);
01122
01132 U_CAPI UBool U_EXPORT2
01133 ucal_equivalentTo(const UCalendar* cal1,
01134 const UCalendar* cal2);
01135
01154 U_CAPI void U_EXPORT2
01155 ucal_add(UCalendar* cal,
01156 UCalendarDateFields field,
01157 int32_t amount,
01158 UErrorCode* status);
01159
01184 U_CAPI void U_EXPORT2
01185 ucal_roll(UCalendar* cal,
01186 UCalendarDateFields field,
01187 int32_t amount,
01188 UErrorCode* status);
01189
01206 U_CAPI int32_t U_EXPORT2
01207 ucal_get(const UCalendar* cal,
01208 UCalendarDateFields field,
01209 UErrorCode* status );
01210
01226 U_CAPI void U_EXPORT2
01227 ucal_set(UCalendar* cal,
01228 UCalendarDateFields field,
01229 int32_t value);
01230
01246 U_CAPI UBool U_EXPORT2
01247 ucal_isSet(const UCalendar* cal,
01248 UCalendarDateFields field);
01249
01264 U_CAPI void U_EXPORT2
01265 ucal_clearField(UCalendar* cal,
01266 UCalendarDateFields field);
01267
01278 U_CAPI void U_EXPORT2
01279 ucal_clear(UCalendar* calendar);
01280
01285 enum UCalendarLimitType {
01287 UCAL_MINIMUM,
01289 UCAL_MAXIMUM,
01291 UCAL_GREATEST_MINIMUM,
01293 UCAL_LEAST_MAXIMUM,
01295 UCAL_ACTUAL_MINIMUM,
01297 UCAL_ACTUAL_MAXIMUM
01298 };
01299
01301 typedef enum UCalendarLimitType UCalendarLimitType;
01302
01317 U_CAPI int32_t U_EXPORT2
01318 ucal_getLimit(const UCalendar* cal,
01319 UCalendarDateFields field,
01320 UCalendarLimitType type,
01321 UErrorCode* status);
01322
01330 U_CAPI const char * U_EXPORT2
01331 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01332
01339 U_CAPI const char * U_EXPORT2
01340 ucal_getTZDataVersion(UErrorCode* status);
01341
01360 U_CAPI int32_t U_EXPORT2
01361 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01362 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01370 U_CAPI const char * U_EXPORT2
01371 ucal_getType(const UCalendar *cal, UErrorCode* status);
01372
01389 U_CAPI UEnumeration* U_EXPORT2
01390 ucal_getKeywordValuesForLocale(const char* key,
01391 const char* locale,
01392 UBool commonlyUsed,
01393 UErrorCode* status);
01394
01395
01399 enum UCalendarWeekdayType {
01404 UCAL_WEEKDAY,
01409 UCAL_WEEKEND,
01415 UCAL_WEEKEND_ONSET,
01421 UCAL_WEEKEND_CEASE
01422 };
01423
01425 typedef enum UCalendarWeekdayType UCalendarWeekdayType;
01426
01444 U_CAPI UCalendarWeekdayType U_EXPORT2
01445 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
01446
01462 U_CAPI int32_t U_EXPORT2
01463 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
01464
01475 U_CAPI UBool U_EXPORT2
01476 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
01477
01502 U_CAPI int32_t U_EXPORT2
01503 ucal_getFieldDifference(UCalendar* cal,
01504 UDate target,
01505 UCalendarDateFields field,
01506 UErrorCode* status);
01507
01512 enum UTimeZoneTransitionType {
01518 UCAL_TZ_TRANSITION_NEXT,
01524 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE,
01530 UCAL_TZ_TRANSITION_PREVIOUS,
01536 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE
01537 };
01538
01539 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType;
01556 U_CAPI UBool U_EXPORT2
01557 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type,
01558 UDate* transition, UErrorCode* status);
01559
01584 U_CAPI int32_t U_EXPORT2
01585 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
01586 UChar* winid, int32_t winidCapacity, UErrorCode* status);
01587
01616 U_CAPI int32_t U_EXPORT2
01617 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region,
01618 UChar* id, int32_t idCapacity, UErrorCode* status);
01619
01626 enum UTimeZoneLocalOption {
01632 UCAL_TZ_LOCAL_FORMER = 0x04,
01638 UCAL_TZ_LOCAL_LATTER = 0x0C,
01647 UCAL_TZ_LOCAL_STANDARD_FORMER = UCAL_TZ_LOCAL_FORMER | 0x01,
01656 UCAL_TZ_LOCAL_STANDARD_LATTER = UCAL_TZ_LOCAL_LATTER | 0x01,
01665 UCAL_TZ_LOCAL_DAYLIGHT_FORMER = UCAL_TZ_LOCAL_FORMER | 0x03,
01674 UCAL_TZ_LOCAL_DAYLIGHT_LATTER = UCAL_TZ_LOCAL_LATTER | 0x03,
01675 };
01676 typedef enum UTimeZoneLocalOption UTimeZoneLocalOption;
01705 U_CAPI void U_EXPORT2
01706 ucal_getTimeZoneOffsetFromLocal(
01707 const UCalendar* cal,
01708 UTimeZoneLocalOption nonExistingTimeOpt,
01709 UTimeZoneLocalOption duplicatedTimeOpt,
01710 int32_t* rawOffset, int32_t* dstOffset, UErrorCode* status);
01711
01712 #endif
01713
01714 #endif