ICU 60.2  60.2
calendar.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 1997-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
8 *
9 * File CALENDAR.H
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 04/22/97 aliu Expanded and corrected comments and other header
15 * contents.
16 * 05/01/97 aliu Made equals(), before(), after() arguments const.
17 * 05/20/97 aliu Replaced fAreFieldsSet with fAreFieldsInSync and
18 * fAreAllFieldsSet.
19 * 07/27/98 stephen Sync up with JDK 1.2
20 * 11/15/99 weiv added YEAR_WOY and DOW_LOCAL
21 * to EDateFields
22 * 8/19/2002 srl Removed Javaisms
23 * 11/07/2003 srl Update, clean up documentation.
24 ********************************************************************************
25 */
26 
27 #ifndef CALENDAR_H
28 #define CALENDAR_H
29 
30 #include "unicode/utypes.h"
31 
36 #if !UCONFIG_NO_FORMATTING
37 
38 #include "unicode/uobject.h"
39 #include "unicode/locid.h"
40 #include "unicode/timezone.h"
41 #include "unicode/ucal.h"
42 #include "unicode/umisc.h"
43 
45 
46 class ICUServiceFactory;
47 
51 typedef int32_t UFieldResolutionTable[12][8];
52 
53 class BasicTimeZone;
202 class U_I18N_API Calendar : public UObject {
203 public:
204 
211  enum EDateFields {
212 #ifndef U_HIDE_DEPRECATED_API
213 /*
214  * ERA may be defined on other platforms. To avoid any potential problems undefined it here.
215  */
216 #ifdef ERA
217 #undef ERA
218 #endif
219  ERA, // Example: 0..1
220  YEAR, // Example: 1..big number
221  MONTH, // Example: 0..11
222  WEEK_OF_YEAR, // Example: 1..53
223  WEEK_OF_MONTH, // Example: 1..4
224  DATE, // Example: 1..31
225  DAY_OF_YEAR, // Example: 1..365
226  DAY_OF_WEEK, // Example: 1..7
227  DAY_OF_WEEK_IN_MONTH, // Example: 1..4, may be specified as -1
228  AM_PM, // Example: 0..1
229  HOUR, // Example: 0..11
230  HOUR_OF_DAY, // Example: 0..23
231  MINUTE, // Example: 0..59
232  SECOND, // Example: 0..59
233  MILLISECOND, // Example: 0..999
234  ZONE_OFFSET, // Example: -12*U_MILLIS_PER_HOUR..12*U_MILLIS_PER_HOUR
235  DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR
236  YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year
237  DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized
238 
239  EXTENDED_YEAR,
240  JULIAN_DAY,
241  MILLISECONDS_IN_DAY,
242  IS_LEAP_MONTH,
243 
244  FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
245 #endif /* U_HIDE_DEPRECATED_API */
246  };
247 
248 #ifndef U_HIDE_DEPRECATED_API
249 
255  enum EDaysOfWeek {
256  SUNDAY = 1,
257  MONDAY,
258  TUESDAY,
259  WEDNESDAY,
260  THURSDAY,
261  FRIDAY,
262  SATURDAY
263  };
264 
269  enum EMonths {
270  JANUARY,
271  FEBRUARY,
272  MARCH,
273  APRIL,
274  MAY,
275  JUNE,
276  JULY,
277  AUGUST,
278  SEPTEMBER,
279  OCTOBER,
280  NOVEMBER,
281  DECEMBER,
282  UNDECIMBER
283  };
284 
289  enum EAmpm {
290  AM,
291  PM
292  };
293 #endif /* U_HIDE_DEPRECATED_API */
294 
299  virtual ~Calendar();
300 
307  virtual Calendar* clone(void) const = 0;
308 
320  static Calendar* U_EXPORT2 createInstance(UErrorCode& success);
321 
334  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success);
335 
347  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success);
348 
359  static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success);
360 
374  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
375 
388  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
389 
399  static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
400 
401 
418  static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* key,
419  const Locale& locale, UBool commonlyUsed, UErrorCode& status);
420 
428  static UDate U_EXPORT2 getNow(void);
429 
443  inline UDate getTime(UErrorCode& status) const { return getTimeInMillis(status); }
444 
455  inline void setTime(UDate date, UErrorCode& status) { setTimeInMillis(date, status); }
456 
468  virtual UBool operator==(const Calendar& that) const;
469 
478  UBool operator!=(const Calendar& that) const {return !operator==(that);}
479 
490  virtual UBool isEquivalentTo(const Calendar& other) const;
491 
506  UBool equals(const Calendar& when, UErrorCode& status) const;
507 
521  UBool before(const Calendar& when, UErrorCode& status) const;
522 
536  UBool after(const Calendar& when, UErrorCode& status) const;
537 
558  virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
559 
580  virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status);
581 
582 #ifndef U_HIDE_DEPRECATED_API
583 
615  inline void roll(EDateFields field, UBool up, UErrorCode& status);
616 #endif /* U_HIDE_DEPRECATED_API */
617 
650  inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status);
651 
683  virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
684 
716  virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
717 
773  virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status);
774 
830  virtual int32_t fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status);
831 
840  void adoptTimeZone(TimeZone* value);
841 
849  void setTimeZone(const TimeZone& zone);
850 
859  const TimeZone& getTimeZone(void) const;
860 
869  TimeZone* orphanTimeZone(void);
870 
879  virtual UBool inDaylightTime(UErrorCode& status) const = 0;
880 
893  void setLenient(UBool lenient);
894 
901  UBool isLenient(void) const;
902 
923  void setRepeatedWallTimeOption(UCalendarWallTimeOption option);
924 
934  UCalendarWallTimeOption getRepeatedWallTimeOption(void) const;
935 
957  void setSkippedWallTimeOption(UCalendarWallTimeOption option);
958 
969  UCalendarWallTimeOption getSkippedWallTimeOption(void) const;
970 
971 #ifndef U_HIDE_DEPRECATED_API
972 
978  void setFirstDayOfWeek(EDaysOfWeek value);
979 #endif /* U_HIDE_DEPRECATED_API */
980 
987  void setFirstDayOfWeek(UCalendarDaysOfWeek value);
988 
989 #ifndef U_HIDE_DEPRECATED_API
990 
996  EDaysOfWeek getFirstDayOfWeek(void) const;
997 #endif /* U_HIDE_DEPRECATED_API */
998 
1006  UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const;
1007 
1017  void setMinimalDaysInFirstWeek(uint8_t value);
1018 
1028  uint8_t getMinimalDaysInFirstWeek(void) const;
1029 
1038  virtual int32_t getMinimum(EDateFields field) const;
1039 
1048  virtual int32_t getMinimum(UCalendarDateFields field) const;
1049 
1058  virtual int32_t getMaximum(EDateFields field) const;
1059 
1068  virtual int32_t getMaximum(UCalendarDateFields field) const;
1069 
1078  virtual int32_t getGreatestMinimum(EDateFields field) const;
1079 
1088  virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
1089 
1098  virtual int32_t getLeastMaximum(EDateFields field) const;
1099 
1108  virtual int32_t getLeastMaximum(UCalendarDateFields field) const;
1109 
1110 #ifndef U_HIDE_DEPRECATED_API
1111 
1125  int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
1126 #endif /* U_HIDE_DEPRECATED_API */
1127 
1142  virtual int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const;
1143 
1144 #ifndef U_HIDE_DEPRECATED_API
1145 
1161  int32_t getActualMaximum(EDateFields field, UErrorCode& status) const;
1162 #endif /* U_HIDE_DEPRECATED_API */
1163 
1180  virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
1181 
1182 #ifndef U_HIDE_DEPRECATED_API
1183 
1196  int32_t get(EDateFields field, UErrorCode& status) const;
1197 #endif /* U_HIDE_DEPRECATED_API */
1198 
1212  int32_t get(UCalendarDateFields field, UErrorCode& status) const;
1213 
1214 #ifndef U_HIDE_DEPRECATED_API
1215 
1223  UBool isSet(EDateFields field) const;
1224 #endif /* U_HIDE_DEPRECATED_API */
1225 
1234  UBool isSet(UCalendarDateFields field) const;
1235 
1236 #ifndef U_HIDE_DEPRECATED_API
1237 
1244  void set(EDateFields field, int32_t value);
1245 #endif /* U_HIDE_DEPRECATED_API */
1246 
1254  void set(UCalendarDateFields field, int32_t value);
1255 
1266  void set(int32_t year, int32_t month, int32_t date);
1267 
1280  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1281 
1295  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1296 
1303  void clear(void);
1304 
1305 #ifndef U_HIDE_DEPRECATED_API
1306 
1314  void clear(EDateFields field);
1315 #endif /* U_HIDE_DEPRECATED_API */
1316 
1325  void clear(UCalendarDateFields field);
1326 
1342  virtual UClassID getDynamicClassID(void) const = 0;
1343 
1376  virtual const char * getType() const = 0;
1377 
1394  virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1395 
1410  virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1411 
1421  virtual UBool isWeekend(UDate date, UErrorCode &status) const;
1422 
1430  virtual UBool isWeekend(void) const;
1431 
1432 protected:
1433 
1442  Calendar(UErrorCode& success);
1443 
1450  Calendar(const Calendar& source);
1451 
1458  Calendar& operator=(const Calendar& right);
1459 
1470  Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success);
1471 
1481  Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
1482 
1491  virtual void computeTime(UErrorCode& status);
1492 
1504  virtual void computeFields(UErrorCode& status);
1505 
1515  double getTimeInMillis(UErrorCode& status) const;
1516 
1525  void setTimeInMillis( double millis, UErrorCode& status );
1526 
1536  void complete(UErrorCode& status);
1537 
1538 #ifndef U_HIDE_DEPRECATED_API
1539 
1547  inline int32_t internalGet(EDateFields field) const {return fFields[field];}
1548 #endif /* U_HIDE_DEPRECATED_API */
1549 
1550 #ifndef U_HIDE_INTERNAL_API
1551 
1561  inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;}
1562 
1571  inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];}
1572 #endif /* U_HIDE_INTERNAL_API */
1573 
1574 #ifndef U_HIDE_DEPRECATED_API
1575 
1584  void internalSet(EDateFields field, int32_t value);
1585 #endif /* U_HIDE_DEPRECATED_API */
1586 
1596  inline void internalSet(UCalendarDateFields field, int32_t value);
1597 
1604  virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status);
1605 
1610  enum ELimitType {
1611 #ifndef U_HIDE_INTERNAL_API
1612  UCAL_LIMIT_MINIMUM = 0,
1613  UCAL_LIMIT_GREATEST_MINIMUM,
1614  UCAL_LIMIT_LEAST_MAXIMUM,
1615  UCAL_LIMIT_MAXIMUM,
1616  UCAL_LIMIT_COUNT
1617 #endif /* U_HIDE_INTERNAL_API */
1618  };
1619 
1641  virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0;
1642 
1650  virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const;
1651 
1652 
1666  virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
1667  UBool useMonth) const = 0;
1668 
1676  virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ;
1677 
1685  virtual int32_t handleGetYearLength(int32_t eyear) const;
1686 
1687 
1696  virtual int32_t handleGetExtendedYear() = 0;
1697 
1706  virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField);
1707 
1716  virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
1717 
1726  virtual void validateField(UCalendarDateFields field, UErrorCode &status);
1727 
1728 #ifndef U_HIDE_INTERNAL_API
1729 
1735  int32_t computeJulianDay();
1736 
1744  double computeMillisInDay();
1745 
1755  int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
1756 
1757 
1766  int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
1767 
1773  enum {
1775  kResolveSTOP = -1,
1777  kResolveRemap = 32
1778  };
1779 
1785  static const UFieldResolutionTable kDatePrecedence[];
1786 
1792  static const UFieldResolutionTable kYearPrecedence[];
1793 
1799  static const UFieldResolutionTable kDOWPrecedence[];
1800 
1828  UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable);
1829 #endif /* U_HIDE_INTERNAL_API */
1830 
1831 
1835  virtual const UFieldResolutionTable* getFieldResolutionTable() const;
1836 
1837 #ifndef U_HIDE_INTERNAL_API
1838 
1843  UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const;
1844 #endif /* U_HIDE_INTERNAL_API */
1845 
1846 
1847 private:
1856  int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const;
1857 
1858 
1859 protected:
1865 
1877 
1884 
1893 
1900  UDate internalGetTime(void) const { return fTime; }
1901 
1909  void internalSetTime(UDate time) { fTime = time; }
1910 
1915  int32_t fFields[UCAL_FIELD_COUNT];
1916 
1922 
1926  enum {
1927  kUnset = 0,
1928  kInternallySet,
1929  kMinimumUserStamp
1930  };
1931 
1938  int32_t fStamp[UCAL_FIELD_COUNT];
1939 
1964  virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
1965 
1966 #ifndef U_HIDE_INTERNAL_API
1967 
1972  int32_t getGregorianYear() const {
1973  return fGregorianYear;
1974  }
1975 
1981  int32_t getGregorianMonth() const {
1982  return fGregorianMonth;
1983  }
1984 
1990  int32_t getGregorianDayOfYear() const {
1991  return fGregorianDayOfYear;
1992  }
1993 
1999  int32_t getGregorianDayOfMonth() const {
2000  return fGregorianDayOfMonth;
2001  }
2002 #endif /* U_HIDE_INTERNAL_API */
2003 
2010  virtual int32_t getDefaultMonthInYear(int32_t eyear) ;
2011 
2012 
2020  virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
2021 
2022  //-------------------------------------------------------------------------
2023  // Protected utility methods for use by subclasses. These are very handy
2024  // for implementing add, roll, and computeFields.
2025  //-------------------------------------------------------------------------
2026 
2056  virtual void pinField(UCalendarDateFields field, UErrorCode& status);
2057 
2101  int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2102 
2103 
2104 #ifndef U_HIDE_INTERNAL_API
2105 
2135  inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2136 
2141  int32_t getLocalDOW();
2142 #endif /* U_HIDE_INTERNAL_API */
2143 
2144 private:
2145 
2149  int32_t fNextStamp;// = MINIMUM_USER_STAMP;
2150 
2155  void recalculateStamp();
2156 
2160  UDate fTime;
2161 
2165  UBool fLenient;
2166 
2171  TimeZone* fZone;
2172 
2177  UCalendarWallTimeOption fRepeatedWallTime;
2178 
2183  UCalendarWallTimeOption fSkippedWallTime;
2184 
2193  UCalendarDaysOfWeek fFirstDayOfWeek;
2194  uint8_t fMinimalDaysInFirstWeek;
2195  UCalendarDaysOfWeek fWeekendOnset;
2196  int32_t fWeekendOnsetMillis;
2197  UCalendarDaysOfWeek fWeekendCease;
2198  int32_t fWeekendCeaseMillis;
2199 
2210  void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success);
2211 
2221  void updateTime(UErrorCode& status);
2222 
2228  int32_t fGregorianYear;
2229 
2235  int32_t fGregorianMonth;
2236 
2242  int32_t fGregorianDayOfYear;
2243 
2249  int32_t fGregorianDayOfMonth;
2250 
2251  /* calculations */
2252 
2259  void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
2260 
2261 protected:
2262 
2270  void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
2271 
2272 private:
2273 
2294  void computeWeekFields(UErrorCode &ec);
2295 
2296 
2305  void validateFields(UErrorCode &status);
2306 
2315  void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
2316 
2317  protected:
2318 #ifndef U_HIDE_INTERNAL_API
2319 
2328  static uint8_t julianDayToDayOfWeek(double julian);
2329 #endif /* U_HIDE_INTERNAL_API */
2330 
2331  private:
2332  char validLocale[ULOC_FULLNAME_CAPACITY];
2333  char actualLocale[ULOC_FULLNAME_CAPACITY];
2334 
2335  public:
2336 #if !UCONFIG_NO_SERVICE
2337 
2341 #ifndef U_HIDE_INTERNAL_API
2342 
2348  static StringEnumeration* getAvailableLocales(void);
2349 
2363  static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status);
2364 
2380  static UBool unregister(URegistryKey key, UErrorCode& status);
2381 #endif /* U_HIDE_INTERNAL_API */
2382 
2387  friend class CalendarFactory;
2388 
2393  friend class CalendarService;
2394 
2399  friend class DefaultCalendarFactory;
2400 #endif /* !UCONFIG_NO_SERVICE */
2401 
2406  virtual UBool haveDefaultCentury() const = 0;
2407 
2412  virtual UDate defaultCenturyStart() const = 0;
2417  virtual int32_t defaultCenturyStartYear() const = 0;
2418 
2425  Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const;
2426 
2432  virtual int32_t getRelatedYear(UErrorCode &status) const;
2433 
2439  virtual void setRelatedYear(int32_t year);
2440 
2441 #ifndef U_HIDE_INTERNAL_API
2442 
2448  const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
2449 #endif /* U_HIDE_INTERNAL_API */
2450 
2451 private:
2456  BasicTimeZone* getBasicTimeZone() const;
2457 
2465  UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const;
2466 
2467 public:
2468 #ifndef U_HIDE_INTERNAL_API
2469 
2477  static Calendar * U_EXPORT2 makeInstance(
2478  const Locale &locale, UErrorCode &status);
2479 
2490  static void U_EXPORT2 getCalendarTypeFromLocale(
2491  const Locale &locale,
2492  char *typeBuffer,
2493  int32_t typeBufferSize,
2494  UErrorCode &status);
2495 #endif /* U_HIDE_INTERNAL_API */
2496 };
2497 
2498 // -------------------------------------
2499 
2500 inline Calendar*
2502 {
2503  // since the Locale isn't specified, use the default locale
2504  return createInstance(zone, Locale::getDefault(), errorCode);
2505 }
2506 
2507 // -------------------------------------
2508 
2509 inline void
2511 {
2512  roll(field, (int32_t)(up ? +1 : -1), status);
2513 }
2514 
2515 #ifndef U_HIDE_DEPRECATED_API
2516 inline void
2518 {
2519  roll((UCalendarDateFields) field, up, status);
2520 }
2521 #endif /* U_HIDE_DEPRECATED_API */
2522 
2523 
2524 // -------------------------------------
2525 
2531 inline void
2533 {
2534  fFields[field] = value;
2535  fStamp[field] = kInternallySet;
2536  fIsSet[field] = TRUE; // Remove later
2537 }
2538 
2539 
2540 #ifndef U_HIDE_INTERNAL_API
2541 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2542 {
2543  return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
2544 }
2545 #endif /* U_HIDE_INTERNAL_API */
2546 
2548 
2549 #endif /* #if !UCONFIG_NO_FORMATTING */
2550 
2551 #endif // _CALENDAR
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:185
C API: Calendar.
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
Definition: calendar.h:202
C++ API: TimeZone object.
double UDate
Date and Time data type.
Definition: utypes.h:203
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:93
C API:misc definitions.
int32_t internalGet(UCalendarDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1571
#define ULOC_FULLNAME_CAPACITY
Useful constant for the maximum size of the whole locale ID (including the terminating NULL and all k...
Definition: uloc.h:264
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:57
EMonths
Useful constants for month.
Definition: calendar.h:269
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:131
UCalendarWeekdayType
Weekday types, as returned by ucal_getDayOfWeekType().
Definition: ucal.h:1341
ELimitType
Limit enums.
Definition: calendar.h:1610
int32_t getGregorianDayOfMonth() const
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1999
int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek)
Return the week number of a day, within a period.
int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const
Gets the value for a given time field.
Definition: calendar.h:1561
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:360
UCalendarWallTimeOption
Options for handling ambiguous wall time at time zone offset transitions.
Definition: ucal.h:907
UBool fAreAllFieldsSet
True if all of the fields have been set.
Definition: calendar.h:1883
UBool fIsTimeSet
The flag which indicates if the current time is set in the calendar.
Definition: calendar.h:1864
int32_t getGregorianMonth() const
Return the month (0-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1981
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
static Calendar * createInstance(UErrorCode &success)
Creates a Calendar using the default timezone and locale.
UCalendarDaysOfWeek
Useful constant for days of week.
Definition: ucal.h:457
void internalSet(EDateFields field, int32_t value)
Sets the value for a given time field.
int32_t getGregorianYear() const
Return the extended year on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1972
void roll(EDateFields field, UBool up, UErrorCode &status)
Time Field Rolling function.
Definition: calendar.h:2517
EAmpm
Useful constants for hour in 12-hour clock.
Definition: calendar.h:289
void setTime(UDate date, UErrorCode &status)
Sets this Calendar's current time with the given UDate.
Definition: calendar.h:455
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:36
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:240
EDaysOfWeek
Useful constant for days of week.
Definition: calendar.h:255
int32_t getGregorianDayOfYear() const
Return the day of year (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1990
UDate getTime(UErrorCode &status) const
Gets this Calendar's time as milliseconds.
Definition: calendar.h:443
C++ API: Common ICU base class UObject.
const void * URegistryKey
Opaque type returned by registerInstance, registerFactory and unregister for service registration...
Definition: umisc.h:57
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:338
UBool fAreFieldsVirtuallySet
True if all fields have been virtually set, but have not yet been computed.
Definition: calendar.h:1892
UBool operator!=(const Calendar &that) const
Compares the inequality of two Calendar objects.
Definition: calendar.h:478
C++ API: Locale ID object.
int32_t internalGet(EDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1547
EDateFields
Field IDs for date and time.
Definition: calendar.h:211
void internalSetTime(UDate time)
Set the current time without affecting flags or fields.
Definition: calendar.h:1909
Basic definitions for ICU, for both C and C++ APIs.
One more than the highest normal UCalendarDateFields value.
Definition: ucal.h:434
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
int32_t UFieldResolutionTable[12][8]
Definition: calendar.h:46
UBool fAreFieldsSet
True if the fields are in sync with the currently set time of this Calendar.
Definition: calendar.h:1876
int8_t UBool
The ICU boolean type.
Definition: umachine.h:236
UDate internalGetTime(void) const
Get the current time without recomputing.
Definition: calendar.h:1900
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:188