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
00163 #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown"
00164
00169 typedef void* UCalendar;
00170
00174 enum UCalendarType {
00180 UCAL_TRADITIONAL,
00185 UCAL_DEFAULT = UCAL_TRADITIONAL,
00190 UCAL_GREGORIAN
00191 };
00192
00194 typedef enum UCalendarType UCalendarType;
00195
00199 enum UCalendarDateFields {
00205 UCAL_ERA,
00206
00211 UCAL_YEAR,
00212
00232 UCAL_MONTH,
00233
00245 UCAL_WEEK_OF_YEAR,
00246
00260 UCAL_WEEK_OF_MONTH,
00261
00269 UCAL_DATE,
00270
00276 UCAL_DAY_OF_YEAR,
00277
00292 UCAL_DAY_OF_WEEK,
00293
00317 UCAL_DAY_OF_WEEK_IN_MONTH,
00318
00328 UCAL_AM_PM,
00329
00339 UCAL_HOUR,
00340
00348 UCAL_HOUR_OF_DAY,
00349
00356 UCAL_MINUTE,
00357
00364 UCAL_SECOND,
00365
00372 UCAL_MILLISECOND,
00373
00379 UCAL_ZONE_OFFSET,
00380
00386 UCAL_DST_OFFSET,
00387
00395 UCAL_YEAR_WOY,
00396
00403 UCAL_DOW_LOCAL,
00404
00411 UCAL_EXTENDED_YEAR,
00412
00423 UCAL_JULIAN_DAY,
00424
00434 UCAL_MILLISECONDS_IN_DAY,
00435
00440 UCAL_IS_LEAP_MONTH,
00441
00442
00443
00444 #ifndef U_FORCE_HIDE_DEPRECATED_API
00445
00449 UCAL_FIELD_COUNT,
00450 #endif // U_FORCE_HIDE_DEPRECATED_API
00451
00460 UCAL_DAY_OF_MONTH=UCAL_DATE
00461 };
00462
00464 typedef enum UCalendarDateFields UCalendarDateFields;
00473 enum UCalendarDaysOfWeek {
00475 UCAL_SUNDAY = 1,
00477 UCAL_MONDAY,
00479 UCAL_TUESDAY,
00481 UCAL_WEDNESDAY,
00483 UCAL_THURSDAY,
00485 UCAL_FRIDAY,
00487 UCAL_SATURDAY
00488 };
00489
00491 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00492
00496 enum UCalendarMonths {
00498 UCAL_JANUARY,
00500 UCAL_FEBRUARY,
00502 UCAL_MARCH,
00504 UCAL_APRIL,
00506 UCAL_MAY,
00508 UCAL_JUNE,
00510 UCAL_JULY,
00512 UCAL_AUGUST,
00514 UCAL_SEPTEMBER,
00516 UCAL_OCTOBER,
00518 UCAL_NOVEMBER,
00520 UCAL_DECEMBER,
00525 UCAL_UNDECIMBER
00526 };
00527
00529 typedef enum UCalendarMonths UCalendarMonths;
00530
00534 enum UCalendarAMPMs {
00536 UCAL_AM,
00538 UCAL_PM
00539 };
00540
00542 typedef enum UCalendarAMPMs UCalendarAMPMs;
00543
00550 enum USystemTimeZoneType {
00555 UCAL_ZONE_TYPE_ANY,
00560 UCAL_ZONE_TYPE_CANONICAL,
00565 UCAL_ZONE_TYPE_CANONICAL_LOCATION
00566 };
00567
00569 typedef enum USystemTimeZoneType USystemTimeZoneType;
00570
00587 U_STABLE UEnumeration* U_EXPORT2
00588 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region,
00589 const int32_t* rawOffset, UErrorCode* ec);
00590
00602 U_STABLE UEnumeration* U_EXPORT2
00603 ucal_openTimeZones(UErrorCode* ec);
00604
00621 U_STABLE UEnumeration* U_EXPORT2
00622 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00623
00647 U_STABLE int32_t U_EXPORT2
00648 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00649
00659 U_STABLE void U_EXPORT2
00660 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00661
00662 #ifndef U_HIDE_DRAFT_API
00663
00693 U_DRAFT int32_t U_EXPORT2
00694 ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec);
00695
00696 #endif // U_HIDE_DRAFT_API
00697
00714 U_STABLE int32_t U_EXPORT2
00715 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00716
00723 U_STABLE UDate U_EXPORT2
00724 ucal_getNow(void);
00725
00749 U_STABLE UCalendar* U_EXPORT2
00750 ucal_open(const UChar* zoneID,
00751 int32_t len,
00752 const char* locale,
00753 UCalendarType type,
00754 UErrorCode* status);
00755
00762 U_STABLE void U_EXPORT2
00763 ucal_close(UCalendar *cal);
00764
00765 #if U_SHOW_CPLUSPLUS_API
00766
00767 U_NAMESPACE_BEGIN
00768
00778 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
00779
00780 U_NAMESPACE_END
00781
00782 #endif
00783
00792 U_STABLE UCalendar* U_EXPORT2
00793 ucal_clone(const UCalendar* cal,
00794 UErrorCode* status);
00795
00805 U_STABLE void U_EXPORT2
00806 ucal_setTimeZone(UCalendar* cal,
00807 const UChar* zoneID,
00808 int32_t len,
00809 UErrorCode* status);
00810
00821 U_STABLE int32_t U_EXPORT2
00822 ucal_getTimeZoneID(const UCalendar *cal,
00823 UChar *result,
00824 int32_t resultLength,
00825 UErrorCode *status);
00826
00831 enum UCalendarDisplayNameType {
00833 UCAL_STANDARD,
00835 UCAL_SHORT_STANDARD,
00837 UCAL_DST,
00839 UCAL_SHORT_DST
00840 };
00841
00843 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00844
00858 U_STABLE int32_t U_EXPORT2
00859 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00860 UCalendarDisplayNameType type,
00861 const char* locale,
00862 UChar* result,
00863 int32_t resultLength,
00864 UErrorCode* status);
00865
00874 U_STABLE UBool U_EXPORT2
00875 ucal_inDaylightTime(const UCalendar* cal,
00876 UErrorCode* status );
00877
00898 U_STABLE void U_EXPORT2
00899 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00900
00921 U_STABLE UDate U_EXPORT2
00922 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00923
00928 enum UCalendarAttribute {
00933 UCAL_LENIENT,
00938 UCAL_FIRST_DAY_OF_WEEK,
00943 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK,
00949 UCAL_REPEATED_WALL_TIME,
00955 UCAL_SKIPPED_WALL_TIME
00956 };
00957
00959 typedef enum UCalendarAttribute UCalendarAttribute;
00960
00966 enum UCalendarWallTimeOption {
00973 UCAL_WALLTIME_LAST,
00980 UCAL_WALLTIME_FIRST,
00986 UCAL_WALLTIME_NEXT_VALID
00987 };
00989 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption;
00990
01002 U_STABLE int32_t U_EXPORT2
01003 ucal_getAttribute(const UCalendar* cal,
01004 UCalendarAttribute attr);
01005
01017 U_STABLE void U_EXPORT2
01018 ucal_setAttribute(UCalendar* cal,
01019 UCalendarAttribute attr,
01020 int32_t newValue);
01021
01031 U_STABLE const char* U_EXPORT2
01032 ucal_getAvailable(int32_t localeIndex);
01033
01042 U_STABLE int32_t U_EXPORT2
01043 ucal_countAvailable(void);
01044
01056 U_STABLE UDate U_EXPORT2
01057 ucal_getMillis(const UCalendar* cal,
01058 UErrorCode* status);
01059
01071 U_STABLE void U_EXPORT2
01072 ucal_setMillis(UCalendar* cal,
01073 UDate dateTime,
01074 UErrorCode* status );
01075
01090 U_STABLE void U_EXPORT2
01091 ucal_setDate(UCalendar* cal,
01092 int32_t year,
01093 int32_t month,
01094 int32_t date,
01095 UErrorCode* status);
01096
01114 U_STABLE void U_EXPORT2
01115 ucal_setDateTime(UCalendar* cal,
01116 int32_t year,
01117 int32_t month,
01118 int32_t date,
01119 int32_t hour,
01120 int32_t minute,
01121 int32_t second,
01122 UErrorCode* status);
01123
01133 U_STABLE UBool U_EXPORT2
01134 ucal_equivalentTo(const UCalendar* cal1,
01135 const UCalendar* cal2);
01136
01155 U_STABLE void U_EXPORT2
01156 ucal_add(UCalendar* cal,
01157 UCalendarDateFields field,
01158 int32_t amount,
01159 UErrorCode* status);
01160
01185 U_STABLE void U_EXPORT2
01186 ucal_roll(UCalendar* cal,
01187 UCalendarDateFields field,
01188 int32_t amount,
01189 UErrorCode* status);
01190
01207 U_STABLE int32_t U_EXPORT2
01208 ucal_get(const UCalendar* cal,
01209 UCalendarDateFields field,
01210 UErrorCode* status );
01211
01227 U_STABLE void U_EXPORT2
01228 ucal_set(UCalendar* cal,
01229 UCalendarDateFields field,
01230 int32_t value);
01231
01247 U_STABLE UBool U_EXPORT2
01248 ucal_isSet(const UCalendar* cal,
01249 UCalendarDateFields field);
01250
01265 U_STABLE void U_EXPORT2
01266 ucal_clearField(UCalendar* cal,
01267 UCalendarDateFields field);
01268
01279 U_STABLE void U_EXPORT2
01280 ucal_clear(UCalendar* calendar);
01281
01286 enum UCalendarLimitType {
01288 UCAL_MINIMUM,
01290 UCAL_MAXIMUM,
01292 UCAL_GREATEST_MINIMUM,
01294 UCAL_LEAST_MAXIMUM,
01296 UCAL_ACTUAL_MINIMUM,
01298 UCAL_ACTUAL_MAXIMUM
01299 };
01300
01302 typedef enum UCalendarLimitType UCalendarLimitType;
01303
01318 U_STABLE int32_t U_EXPORT2
01319 ucal_getLimit(const UCalendar* cal,
01320 UCalendarDateFields field,
01321 UCalendarLimitType type,
01322 UErrorCode* status);
01323
01331 U_STABLE const char * U_EXPORT2
01332 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01333
01340 U_STABLE const char * U_EXPORT2
01341 ucal_getTZDataVersion(UErrorCode* status);
01342
01361 U_STABLE int32_t U_EXPORT2
01362 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01363 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01371 U_STABLE const char * U_EXPORT2
01372 ucal_getType(const UCalendar *cal, UErrorCode* status);
01373
01390 U_STABLE UEnumeration* U_EXPORT2
01391 ucal_getKeywordValuesForLocale(const char* key,
01392 const char* locale,
01393 UBool commonlyUsed,
01394 UErrorCode* status);
01395
01396
01400 enum UCalendarWeekdayType {
01405 UCAL_WEEKDAY,
01410 UCAL_WEEKEND,
01416 UCAL_WEEKEND_ONSET,
01422 UCAL_WEEKEND_CEASE
01423 };
01424
01426 typedef enum UCalendarWeekdayType UCalendarWeekdayType;
01427
01445 U_STABLE UCalendarWeekdayType U_EXPORT2
01446 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
01447
01463 U_STABLE int32_t U_EXPORT2
01464 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
01465
01476 U_STABLE UBool U_EXPORT2
01477 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
01478
01503 U_STABLE int32_t U_EXPORT2
01504 ucal_getFieldDifference(UCalendar* cal,
01505 UDate target,
01506 UCalendarDateFields field,
01507 UErrorCode* status);
01508
01513 enum UTimeZoneTransitionType {
01519 UCAL_TZ_TRANSITION_NEXT,
01525 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE,
01531 UCAL_TZ_TRANSITION_PREVIOUS,
01537 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE
01538 };
01539
01540 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType;
01557 U_STABLE UBool U_EXPORT2
01558 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type,
01559 UDate* transition, UErrorCode* status);
01560
01585 U_STABLE int32_t U_EXPORT2
01586 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
01587 UChar* winid, int32_t winidCapacity, UErrorCode* status);
01588
01617 U_STABLE int32_t U_EXPORT2
01618 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region,
01619 UChar* id, int32_t idCapacity, UErrorCode* status);
01620
01621 #endif
01622
01623 #endif