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
00448 UCAL_FIELD_COUNT,
00449
00458 UCAL_DAY_OF_MONTH=UCAL_DATE
00459 };
00460
00462 typedef enum UCalendarDateFields UCalendarDateFields;
00471 enum UCalendarDaysOfWeek {
00473 UCAL_SUNDAY = 1,
00475 UCAL_MONDAY,
00477 UCAL_TUESDAY,
00479 UCAL_WEDNESDAY,
00481 UCAL_THURSDAY,
00483 UCAL_FRIDAY,
00485 UCAL_SATURDAY
00486 };
00487
00489 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00490
00494 enum UCalendarMonths {
00496 UCAL_JANUARY,
00498 UCAL_FEBRUARY,
00500 UCAL_MARCH,
00502 UCAL_APRIL,
00504 UCAL_MAY,
00506 UCAL_JUNE,
00508 UCAL_JULY,
00510 UCAL_AUGUST,
00512 UCAL_SEPTEMBER,
00514 UCAL_OCTOBER,
00516 UCAL_NOVEMBER,
00518 UCAL_DECEMBER,
00523 UCAL_UNDECIMBER
00524 };
00525
00527 typedef enum UCalendarMonths UCalendarMonths;
00528
00532 enum UCalendarAMPMs {
00534 UCAL_AM,
00536 UCAL_PM
00537 };
00538
00540 typedef enum UCalendarAMPMs UCalendarAMPMs;
00541
00548 enum USystemTimeZoneType {
00553 UCAL_ZONE_TYPE_ANY,
00558 UCAL_ZONE_TYPE_CANONICAL,
00563 UCAL_ZONE_TYPE_CANONICAL_LOCATION
00564 };
00565
00567 typedef enum USystemTimeZoneType USystemTimeZoneType;
00568
00585 U_STABLE UEnumeration* U_EXPORT2
00586 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region,
00587 const int32_t* rawOffset, UErrorCode* ec);
00588
00600 U_STABLE UEnumeration* U_EXPORT2
00601 ucal_openTimeZones(UErrorCode* ec);
00602
00619 U_STABLE UEnumeration* U_EXPORT2
00620 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00621
00645 U_STABLE int32_t U_EXPORT2
00646 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00647
00657 U_STABLE void U_EXPORT2
00658 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00659
00676 U_STABLE int32_t U_EXPORT2
00677 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00678
00685 U_STABLE UDate U_EXPORT2
00686 ucal_getNow(void);
00687
00711 U_STABLE UCalendar* U_EXPORT2
00712 ucal_open(const UChar* zoneID,
00713 int32_t len,
00714 const char* locale,
00715 UCalendarType type,
00716 UErrorCode* status);
00717
00724 U_STABLE void U_EXPORT2
00725 ucal_close(UCalendar *cal);
00726
00727 #if U_SHOW_CPLUSPLUS_API
00728
00729 U_NAMESPACE_BEGIN
00730
00740 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
00741
00742 U_NAMESPACE_END
00743
00744 #endif
00745
00754 U_STABLE UCalendar* U_EXPORT2
00755 ucal_clone(const UCalendar* cal,
00756 UErrorCode* status);
00757
00767 U_STABLE void U_EXPORT2
00768 ucal_setTimeZone(UCalendar* cal,
00769 const UChar* zoneID,
00770 int32_t len,
00771 UErrorCode* status);
00772
00783 U_STABLE int32_t U_EXPORT2
00784 ucal_getTimeZoneID(const UCalendar *cal,
00785 UChar *result,
00786 int32_t resultLength,
00787 UErrorCode *status);
00788
00793 enum UCalendarDisplayNameType {
00795 UCAL_STANDARD,
00797 UCAL_SHORT_STANDARD,
00799 UCAL_DST,
00801 UCAL_SHORT_DST
00802 };
00803
00805 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00806
00820 U_STABLE int32_t U_EXPORT2
00821 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00822 UCalendarDisplayNameType type,
00823 const char* locale,
00824 UChar* result,
00825 int32_t resultLength,
00826 UErrorCode* status);
00827
00836 U_STABLE UBool U_EXPORT2
00837 ucal_inDaylightTime(const UCalendar* cal,
00838 UErrorCode* status );
00839
00860 U_STABLE void U_EXPORT2
00861 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00862
00883 U_STABLE UDate U_EXPORT2
00884 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00885
00890 enum UCalendarAttribute {
00895 UCAL_LENIENT,
00900 UCAL_FIRST_DAY_OF_WEEK,
00905 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK,
00911 UCAL_REPEATED_WALL_TIME,
00917 UCAL_SKIPPED_WALL_TIME
00918 };
00919
00921 typedef enum UCalendarAttribute UCalendarAttribute;
00922
00928 enum UCalendarWallTimeOption {
00935 UCAL_WALLTIME_LAST,
00942 UCAL_WALLTIME_FIRST,
00948 UCAL_WALLTIME_NEXT_VALID
00949 };
00951 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption;
00952
00964 U_STABLE int32_t U_EXPORT2
00965 ucal_getAttribute(const UCalendar* cal,
00966 UCalendarAttribute attr);
00967
00979 U_STABLE void U_EXPORT2
00980 ucal_setAttribute(UCalendar* cal,
00981 UCalendarAttribute attr,
00982 int32_t newValue);
00983
00993 U_STABLE const char* U_EXPORT2
00994 ucal_getAvailable(int32_t localeIndex);
00995
01004 U_STABLE int32_t U_EXPORT2
01005 ucal_countAvailable(void);
01006
01018 U_STABLE UDate U_EXPORT2
01019 ucal_getMillis(const UCalendar* cal,
01020 UErrorCode* status);
01021
01033 U_STABLE void U_EXPORT2
01034 ucal_setMillis(UCalendar* cal,
01035 UDate dateTime,
01036 UErrorCode* status );
01037
01052 U_STABLE void U_EXPORT2
01053 ucal_setDate(UCalendar* cal,
01054 int32_t year,
01055 int32_t month,
01056 int32_t date,
01057 UErrorCode* status);
01058
01076 U_STABLE void U_EXPORT2
01077 ucal_setDateTime(UCalendar* cal,
01078 int32_t year,
01079 int32_t month,
01080 int32_t date,
01081 int32_t hour,
01082 int32_t minute,
01083 int32_t second,
01084 UErrorCode* status);
01085
01095 U_STABLE UBool U_EXPORT2
01096 ucal_equivalentTo(const UCalendar* cal1,
01097 const UCalendar* cal2);
01098
01117 U_STABLE void U_EXPORT2
01118 ucal_add(UCalendar* cal,
01119 UCalendarDateFields field,
01120 int32_t amount,
01121 UErrorCode* status);
01122
01147 U_STABLE void U_EXPORT2
01148 ucal_roll(UCalendar* cal,
01149 UCalendarDateFields field,
01150 int32_t amount,
01151 UErrorCode* status);
01152
01169 U_STABLE int32_t U_EXPORT2
01170 ucal_get(const UCalendar* cal,
01171 UCalendarDateFields field,
01172 UErrorCode* status );
01173
01189 U_STABLE void U_EXPORT2
01190 ucal_set(UCalendar* cal,
01191 UCalendarDateFields field,
01192 int32_t value);
01193
01209 U_STABLE UBool U_EXPORT2
01210 ucal_isSet(const UCalendar* cal,
01211 UCalendarDateFields field);
01212
01227 U_STABLE void U_EXPORT2
01228 ucal_clearField(UCalendar* cal,
01229 UCalendarDateFields field);
01230
01241 U_STABLE void U_EXPORT2
01242 ucal_clear(UCalendar* calendar);
01243
01248 enum UCalendarLimitType {
01250 UCAL_MINIMUM,
01252 UCAL_MAXIMUM,
01254 UCAL_GREATEST_MINIMUM,
01256 UCAL_LEAST_MAXIMUM,
01258 UCAL_ACTUAL_MINIMUM,
01260 UCAL_ACTUAL_MAXIMUM
01261 };
01262
01264 typedef enum UCalendarLimitType UCalendarLimitType;
01265
01280 U_STABLE int32_t U_EXPORT2
01281 ucal_getLimit(const UCalendar* cal,
01282 UCalendarDateFields field,
01283 UCalendarLimitType type,
01284 UErrorCode* status);
01285
01293 U_STABLE const char * U_EXPORT2
01294 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01295
01302 U_STABLE const char * U_EXPORT2
01303 ucal_getTZDataVersion(UErrorCode* status);
01304
01323 U_STABLE int32_t U_EXPORT2
01324 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01325 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01333 U_STABLE const char * U_EXPORT2
01334 ucal_getType(const UCalendar *cal, UErrorCode* status);
01335
01352 U_STABLE UEnumeration* U_EXPORT2
01353 ucal_getKeywordValuesForLocale(const char* key,
01354 const char* locale,
01355 UBool commonlyUsed,
01356 UErrorCode* status);
01357
01358
01362 enum UCalendarWeekdayType {
01367 UCAL_WEEKDAY,
01372 UCAL_WEEKEND,
01378 UCAL_WEEKEND_ONSET,
01384 UCAL_WEEKEND_CEASE
01385 };
01386
01388 typedef enum UCalendarWeekdayType UCalendarWeekdayType;
01389
01407 U_STABLE UCalendarWeekdayType U_EXPORT2
01408 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
01409
01425 U_STABLE int32_t U_EXPORT2
01426 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
01427
01438 U_STABLE UBool U_EXPORT2
01439 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
01440
01465 U_STABLE int32_t U_EXPORT2
01466 ucal_getFieldDifference(UCalendar* cal,
01467 UDate target,
01468 UCalendarDateFields field,
01469 UErrorCode* status);
01470
01475 enum UTimeZoneTransitionType {
01481 UCAL_TZ_TRANSITION_NEXT,
01487 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE,
01493 UCAL_TZ_TRANSITION_PREVIOUS,
01499 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE
01500 };
01501
01502 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType;
01519 U_STABLE UBool U_EXPORT2
01520 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type,
01521 UDate* transition, UErrorCode* status);
01522
01547 U_STABLE int32_t U_EXPORT2
01548 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
01549 UChar* winid, int32_t winidCapacity, UErrorCode* status);
01550
01579 U_STABLE int32_t U_EXPORT2
01580 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region,
01581 UChar* id, int32_t idCapacity, UErrorCode* status);
01582
01583 #endif
01584
01585 #endif