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
00149 #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown"
00150
00155 typedef void* UCalendar;
00156
00160 enum UCalendarType {
00166 UCAL_TRADITIONAL,
00171 UCAL_DEFAULT = UCAL_TRADITIONAL,
00176 UCAL_GREGORIAN
00177 };
00178
00180 typedef enum UCalendarType UCalendarType;
00181
00185 enum UCalendarDateFields {
00191 UCAL_ERA,
00192
00197 UCAL_YEAR,
00198
00218 UCAL_MONTH,
00219
00231 UCAL_WEEK_OF_YEAR,
00232
00246 UCAL_WEEK_OF_MONTH,
00247
00255 UCAL_DATE,
00256
00262 UCAL_DAY_OF_YEAR,
00263
00278 UCAL_DAY_OF_WEEK,
00279
00303 UCAL_DAY_OF_WEEK_IN_MONTH,
00304
00314 UCAL_AM_PM,
00315
00325 UCAL_HOUR,
00326
00334 UCAL_HOUR_OF_DAY,
00335
00342 UCAL_MINUTE,
00343
00350 UCAL_SECOND,
00351
00358 UCAL_MILLISECOND,
00359
00365 UCAL_ZONE_OFFSET,
00366
00372 UCAL_DST_OFFSET,
00373
00381 UCAL_YEAR_WOY,
00382
00389 UCAL_DOW_LOCAL,
00390
00397 UCAL_EXTENDED_YEAR,
00398
00409 UCAL_JULIAN_DAY,
00410
00420 UCAL_MILLISECONDS_IN_DAY,
00421
00426 UCAL_IS_LEAP_MONTH,
00427
00428
00429
00434 UCAL_FIELD_COUNT,
00435
00444 UCAL_DAY_OF_MONTH=UCAL_DATE
00445 };
00446
00448 typedef enum UCalendarDateFields UCalendarDateFields;
00457 enum UCalendarDaysOfWeek {
00459 UCAL_SUNDAY = 1,
00461 UCAL_MONDAY,
00463 UCAL_TUESDAY,
00465 UCAL_WEDNESDAY,
00467 UCAL_THURSDAY,
00469 UCAL_FRIDAY,
00471 UCAL_SATURDAY
00472 };
00473
00475 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00476
00480 enum UCalendarMonths {
00482 UCAL_JANUARY,
00484 UCAL_FEBRUARY,
00486 UCAL_MARCH,
00488 UCAL_APRIL,
00490 UCAL_MAY,
00492 UCAL_JUNE,
00494 UCAL_JULY,
00496 UCAL_AUGUST,
00498 UCAL_SEPTEMBER,
00500 UCAL_OCTOBER,
00502 UCAL_NOVEMBER,
00504 UCAL_DECEMBER,
00509 UCAL_UNDECIMBER
00510 };
00511
00513 typedef enum UCalendarMonths UCalendarMonths;
00514
00518 enum UCalendarAMPMs {
00520 UCAL_AM,
00522 UCAL_PM
00523 };
00524
00526 typedef enum UCalendarAMPMs UCalendarAMPMs;
00527
00534 enum USystemTimeZoneType {
00539 UCAL_ZONE_TYPE_ANY,
00544 UCAL_ZONE_TYPE_CANONICAL,
00549 UCAL_ZONE_TYPE_CANONICAL_LOCATION
00550 };
00551
00553 typedef enum USystemTimeZoneType USystemTimeZoneType;
00554
00571 U_STABLE UEnumeration* U_EXPORT2
00572 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region,
00573 const int32_t* rawOffset, UErrorCode* ec);
00574
00586 U_STABLE UEnumeration* U_EXPORT2
00587 ucal_openTimeZones(UErrorCode* ec);
00588
00605 U_STABLE UEnumeration* U_EXPORT2
00606 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00607
00624 U_STABLE int32_t U_EXPORT2
00625 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00626
00636 U_STABLE void U_EXPORT2
00637 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00638
00655 U_STABLE int32_t U_EXPORT2
00656 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00657
00664 U_STABLE UDate U_EXPORT2
00665 ucal_getNow(void);
00666
00690 U_STABLE UCalendar* U_EXPORT2
00691 ucal_open(const UChar* zoneID,
00692 int32_t len,
00693 const char* locale,
00694 UCalendarType type,
00695 UErrorCode* status);
00696
00703 U_STABLE void U_EXPORT2
00704 ucal_close(UCalendar *cal);
00705
00706 #if U_SHOW_CPLUSPLUS_API
00707
00708 U_NAMESPACE_BEGIN
00709
00719 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
00720
00721 U_NAMESPACE_END
00722
00723 #endif
00724
00733 U_STABLE UCalendar* U_EXPORT2
00734 ucal_clone(const UCalendar* cal,
00735 UErrorCode* status);
00736
00746 U_STABLE void U_EXPORT2
00747 ucal_setTimeZone(UCalendar* cal,
00748 const UChar* zoneID,
00749 int32_t len,
00750 UErrorCode* status);
00751
00762 U_STABLE int32_t U_EXPORT2
00763 ucal_getTimeZoneID(const UCalendar *cal,
00764 UChar *result,
00765 int32_t resultLength,
00766 UErrorCode *status);
00767
00772 enum UCalendarDisplayNameType {
00774 UCAL_STANDARD,
00776 UCAL_SHORT_STANDARD,
00778 UCAL_DST,
00780 UCAL_SHORT_DST
00781 };
00782
00784 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00785
00799 U_STABLE int32_t U_EXPORT2
00800 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00801 UCalendarDisplayNameType type,
00802 const char* locale,
00803 UChar* result,
00804 int32_t resultLength,
00805 UErrorCode* status);
00806
00815 U_STABLE UBool U_EXPORT2
00816 ucal_inDaylightTime(const UCalendar* cal,
00817 UErrorCode* status );
00818
00839 U_STABLE void U_EXPORT2
00840 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00841
00862 U_STABLE UDate U_EXPORT2
00863 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00864
00869 enum UCalendarAttribute {
00874 UCAL_LENIENT,
00879 UCAL_FIRST_DAY_OF_WEEK,
00884 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK,
00890 UCAL_REPEATED_WALL_TIME,
00896 UCAL_SKIPPED_WALL_TIME
00897 };
00898
00900 typedef enum UCalendarAttribute UCalendarAttribute;
00901
00907 enum UCalendarWallTimeOption {
00914 UCAL_WALLTIME_LAST,
00921 UCAL_WALLTIME_FIRST,
00927 UCAL_WALLTIME_NEXT_VALID
00928 };
00930 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption;
00931
00943 U_STABLE int32_t U_EXPORT2
00944 ucal_getAttribute(const UCalendar* cal,
00945 UCalendarAttribute attr);
00946
00958 U_STABLE void U_EXPORT2
00959 ucal_setAttribute(UCalendar* cal,
00960 UCalendarAttribute attr,
00961 int32_t newValue);
00962
00972 U_STABLE const char* U_EXPORT2
00973 ucal_getAvailable(int32_t localeIndex);
00974
00983 U_STABLE int32_t U_EXPORT2
00984 ucal_countAvailable(void);
00985
00997 U_STABLE UDate U_EXPORT2
00998 ucal_getMillis(const UCalendar* cal,
00999 UErrorCode* status);
01000
01012 U_STABLE void U_EXPORT2
01013 ucal_setMillis(UCalendar* cal,
01014 UDate dateTime,
01015 UErrorCode* status );
01016
01031 U_STABLE void U_EXPORT2
01032 ucal_setDate(UCalendar* cal,
01033 int32_t year,
01034 int32_t month,
01035 int32_t date,
01036 UErrorCode* status);
01037
01055 U_STABLE void U_EXPORT2
01056 ucal_setDateTime(UCalendar* cal,
01057 int32_t year,
01058 int32_t month,
01059 int32_t date,
01060 int32_t hour,
01061 int32_t minute,
01062 int32_t second,
01063 UErrorCode* status);
01064
01074 U_STABLE UBool U_EXPORT2
01075 ucal_equivalentTo(const UCalendar* cal1,
01076 const UCalendar* cal2);
01077
01096 U_STABLE void U_EXPORT2
01097 ucal_add(UCalendar* cal,
01098 UCalendarDateFields field,
01099 int32_t amount,
01100 UErrorCode* status);
01101
01126 U_STABLE void U_EXPORT2
01127 ucal_roll(UCalendar* cal,
01128 UCalendarDateFields field,
01129 int32_t amount,
01130 UErrorCode* status);
01131
01148 U_STABLE int32_t U_EXPORT2
01149 ucal_get(const UCalendar* cal,
01150 UCalendarDateFields field,
01151 UErrorCode* status );
01152
01168 U_STABLE void U_EXPORT2
01169 ucal_set(UCalendar* cal,
01170 UCalendarDateFields field,
01171 int32_t value);
01172
01188 U_STABLE UBool U_EXPORT2
01189 ucal_isSet(const UCalendar* cal,
01190 UCalendarDateFields field);
01191
01206 U_STABLE void U_EXPORT2
01207 ucal_clearField(UCalendar* cal,
01208 UCalendarDateFields field);
01209
01220 U_STABLE void U_EXPORT2
01221 ucal_clear(UCalendar* calendar);
01222
01227 enum UCalendarLimitType {
01229 UCAL_MINIMUM,
01231 UCAL_MAXIMUM,
01233 UCAL_GREATEST_MINIMUM,
01235 UCAL_LEAST_MAXIMUM,
01237 UCAL_ACTUAL_MINIMUM,
01239 UCAL_ACTUAL_MAXIMUM
01240 };
01241
01243 typedef enum UCalendarLimitType UCalendarLimitType;
01244
01259 U_STABLE int32_t U_EXPORT2
01260 ucal_getLimit(const UCalendar* cal,
01261 UCalendarDateFields field,
01262 UCalendarLimitType type,
01263 UErrorCode* status);
01264
01272 U_STABLE const char * U_EXPORT2
01273 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01274
01281 U_STABLE const char * U_EXPORT2
01282 ucal_getTZDataVersion(UErrorCode* status);
01283
01302 U_STABLE int32_t U_EXPORT2
01303 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01304 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01312 U_STABLE const char * U_EXPORT2
01313 ucal_getType(const UCalendar *cal, UErrorCode* status);
01314
01331 U_STABLE UEnumeration* U_EXPORT2
01332 ucal_getKeywordValuesForLocale(const char* key,
01333 const char* locale,
01334 UBool commonlyUsed,
01335 UErrorCode* status);
01336
01337
01341 enum UCalendarWeekdayType {
01346 UCAL_WEEKDAY,
01351 UCAL_WEEKEND,
01357 UCAL_WEEKEND_ONSET,
01363 UCAL_WEEKEND_CEASE
01364 };
01365
01367 typedef enum UCalendarWeekdayType UCalendarWeekdayType;
01368
01386 U_STABLE UCalendarWeekdayType U_EXPORT2
01387 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
01388
01404 U_STABLE int32_t U_EXPORT2
01405 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
01406
01417 U_STABLE UBool U_EXPORT2
01418 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
01419
01444 U_STABLE int32_t U_EXPORT2
01445 ucal_getFieldDifference(UCalendar* cal,
01446 UDate target,
01447 UCalendarDateFields field,
01448 UErrorCode* status);
01449
01454 enum UTimeZoneTransitionType {
01460 UCAL_TZ_TRANSITION_NEXT,
01466 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE,
01472 UCAL_TZ_TRANSITION_PREVIOUS,
01478 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE
01479 };
01480
01481 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType;
01498 U_STABLE UBool U_EXPORT2
01499 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type,
01500 UDate* transition, UErrorCode* status);
01501
01526 U_STABLE int32_t U_EXPORT2
01527 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
01528 UChar* winid, int32_t winidCapacity, UErrorCode* status);
01529
01558 U_STABLE int32_t U_EXPORT2
01559 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region,
01560 UChar* id, int32_t idCapacity, UErrorCode* status);
01561
01562 #endif
01563
01564 #endif