00001
00002
00003
00004
00005
00006 #ifndef UCAL_H
00007 #define UCAL_H
00008
00009 #include "unicode/utypes.h"
00010 #include "unicode/uenum.h"
00011 #include "unicode/uloc.h"
00012
00013 #if !UCONFIG_NO_FORMATTING
00014
00144 typedef void* UCalendar;
00145
00149 enum UCalendarType {
00151 UCAL_TRADITIONAL,
00153 UCAL_GREGORIAN
00154 };
00155
00157 typedef enum UCalendarType UCalendarType;
00158
00162 enum UCalendarDateFields {
00167 UCAL_ERA,
00172 UCAL_YEAR,
00177 UCAL_MONTH,
00182 UCAL_WEEK_OF_YEAR,
00187 UCAL_WEEK_OF_MONTH,
00192 UCAL_DATE,
00197 UCAL_DAY_OF_YEAR,
00202 UCAL_DAY_OF_WEEK,
00207 UCAL_DAY_OF_WEEK_IN_MONTH,
00212 UCAL_AM_PM,
00217 UCAL_HOUR,
00222 UCAL_HOUR_OF_DAY,
00227 UCAL_MINUTE,
00232 UCAL_SECOND,
00237 UCAL_MILLISECOND,
00242 UCAL_ZONE_OFFSET,
00247 UCAL_DST_OFFSET,
00252 UCAL_YEAR_WOY,
00257 #ifndef U_HIDE_DRAFT_API
00258
00259 UCAL_DOW_LOCAL,
00264 UCAL_EXTENDED_YEAR,
00269 UCAL_JULIAN_DAY,
00274 UCAL_MILLISECONDS_IN_DAY,
00275
00276 #endif
00277
00282 UCAL_FIELD_COUNT,
00283
00284 #ifndef U_HIDE_DRAFT_API
00285
00290 UCAL_DAY_OF_MONTH=UCAL_DATE
00291
00292 #endif
00293 };
00294
00296 typedef enum UCalendarDateFields UCalendarDateFields;
00305 enum UCalendarDaysOfWeek {
00307 UCAL_SUNDAY = 1,
00309 UCAL_MONDAY,
00311 UCAL_TUESDAY,
00313 UCAL_WEDNESDAY,
00315 UCAL_THURSDAY,
00317 UCAL_FRIDAY,
00319 UCAL_SATURDAY
00320 };
00321
00323 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00324
00328 enum UCalendarMonths {
00330 UCAL_JANUARY,
00332 UCAL_FEBRUARY,
00334 UCAL_MARCH,
00336 UCAL_APRIL,
00338 UCAL_MAY,
00340 UCAL_JUNE,
00342 UCAL_JULY,
00344 UCAL_AUGUST,
00346 UCAL_SEPTEMBER,
00348 UCAL_OCTOBER,
00350 UCAL_NOVEMBER,
00352 UCAL_DECEMBER,
00354 UCAL_UNDECIMBER
00355 };
00356
00358 typedef enum UCalendarMonths UCalendarMonths;
00359
00363 enum UCalendarAMPMs {
00365 UCAL_AM,
00367 UCAL_PM
00368 };
00369
00371 typedef enum UCalendarAMPMs UCalendarAMPMs;
00372
00384 U_DRAFT UEnumeration* U_EXPORT2
00385 ucal_openTimeZones(UErrorCode* ec);
00386
00403 U_DRAFT UEnumeration* U_EXPORT2
00404 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00405
00422 U_DRAFT int32_t U_EXPORT2
00423 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00424
00434 U_DRAFT void U_EXPORT2
00435 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00436
00453 U_DRAFT int32_t U_EXPORT2
00454 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00455
00462 U_STABLE UDate U_EXPORT2
00463 ucal_getNow(void);
00464
00477 U_STABLE UCalendar* U_EXPORT2
00478 ucal_open(const UChar* zoneID,
00479 int32_t len,
00480 const char* locale,
00481 UCalendarType type,
00482 UErrorCode* status);
00483
00490 U_STABLE void U_EXPORT2
00491 ucal_close(UCalendar *cal);
00492
00502 U_STABLE void U_EXPORT2
00503 ucal_setTimeZone(UCalendar* cal,
00504 const UChar* zoneID,
00505 int32_t len,
00506 UErrorCode* status);
00507
00512 enum UCalendarDisplayNameType {
00514 UCAL_STANDARD,
00516 UCAL_SHORT_STANDARD,
00518 UCAL_DST,
00520 UCAL_SHORT_DST
00521 };
00522
00524 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00525
00539 U_STABLE int32_t U_EXPORT2
00540 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00541 UCalendarDisplayNameType type,
00542 const char* locale,
00543 UChar* result,
00544 int32_t resultLength,
00545 UErrorCode* status);
00546
00555 U_STABLE UBool U_EXPORT2
00556 ucal_inDaylightTime(const UCalendar* cal,
00557 UErrorCode* status );
00558
00563 enum UCalendarAttribute {
00565 UCAL_LENIENT,
00567 UCAL_FIRST_DAY_OF_WEEK,
00569 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
00570 };
00571
00573 typedef enum UCalendarAttribute UCalendarAttribute;
00574
00586 U_STABLE int32_t U_EXPORT2
00587 ucal_getAttribute(const UCalendar* cal,
00588 UCalendarAttribute attr);
00589
00601 U_STABLE void U_EXPORT2
00602 ucal_setAttribute(UCalendar* cal,
00603 UCalendarAttribute attr,
00604 int32_t newValue);
00605
00615 U_STABLE const char* U_EXPORT2
00616 ucal_getAvailable(int32_t index);
00617
00626 U_STABLE int32_t U_EXPORT2
00627 ucal_countAvailable(void);
00628
00640 U_STABLE UDate U_EXPORT2
00641 ucal_getMillis(const UCalendar* cal,
00642 UErrorCode* status);
00643
00655 U_STABLE void U_EXPORT2
00656 ucal_setMillis(UCalendar* cal,
00657 UDate dateTime,
00658 UErrorCode* status );
00659
00674 U_STABLE void U_EXPORT2
00675 ucal_setDate(UCalendar* cal,
00676 int32_t year,
00677 int32_t month,
00678 int32_t date,
00679 UErrorCode* status);
00680
00698 U_STABLE void U_EXPORT2
00699 ucal_setDateTime(UCalendar* cal,
00700 int32_t year,
00701 int32_t month,
00702 int32_t date,
00703 int32_t hour,
00704 int32_t minute,
00705 int32_t second,
00706 UErrorCode* status);
00707
00717 U_STABLE UBool U_EXPORT2
00718 ucal_equivalentTo(const UCalendar* cal1,
00719 const UCalendar* cal2);
00720
00736 U_STABLE void U_EXPORT2
00737 ucal_add(UCalendar* cal,
00738 UCalendarDateFields field,
00739 int32_t amount,
00740 UErrorCode* status);
00741
00757 U_STABLE void U_EXPORT2
00758 ucal_roll(UCalendar* cal,
00759 UCalendarDateFields field,
00760 int32_t amount,
00761 UErrorCode* status);
00762
00779 U_STABLE int32_t U_EXPORT2
00780 ucal_get(const UCalendar* cal,
00781 UCalendarDateFields field,
00782 UErrorCode* status );
00783
00799 U_STABLE void U_EXPORT2
00800 ucal_set(UCalendar* cal,
00801 UCalendarDateFields field,
00802 int32_t value);
00803
00819 U_STABLE UBool U_EXPORT2
00820 ucal_isSet(const UCalendar* cal,
00821 UCalendarDateFields field);
00822
00837 U_STABLE void U_EXPORT2
00838 ucal_clearField(UCalendar* cal,
00839 UCalendarDateFields field);
00840
00851 U_STABLE void U_EXPORT2
00852 ucal_clear(UCalendar* calendar);
00853
00858 enum UCalendarLimitType {
00860 UCAL_MINIMUM,
00862 UCAL_MAXIMUM,
00864 UCAL_GREATEST_MINIMUM,
00866 UCAL_LEAST_MAXIMUM,
00868 UCAL_ACTUAL_MINIMUM,
00870 UCAL_ACTUAL_MAXIMUM
00871 };
00872
00874 typedef enum UCalendarLimitType UCalendarLimitType;
00875
00890 U_STABLE int32_t U_EXPORT2
00891 ucal_getLimit(const UCalendar* cal,
00892 UCalendarDateFields field,
00893 UCalendarLimitType type,
00894 UErrorCode* status);
00895
00896 #ifdef U_USE_UCAL_OBSOLETE_2_8
00897
00907 U_OBSOLETE const UChar* U_EXPORT2
00908 ucal_getAvailableTZIDs(int32_t rawOffset,
00909 int32_t index,
00910 UErrorCode* status);
00911
00921 U_OBSOLETE int32_t U_EXPORT2
00922 ucal_countAvailableTZIDs(int32_t rawOffset);
00923 #endif
00924
00932 U_DRAFT const char * U_EXPORT2
00933 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
00934
00935 #endif
00936
00937 #endif