ICU 63.1  63.1
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;
185 class U_I18N_API Calendar : public UObject {
186 public:
187 
194  enum EDateFields {
195 #ifndef U_HIDE_DEPRECATED_API
196 /*
197  * ERA may be defined on other platforms. To avoid any potential problems undefined it here.
198  */
199 #ifdef ERA
200 #undef ERA
201 #endif
202  ERA, // Example: 0..1
203  YEAR, // Example: 1..big number
204  MONTH, // Example: 0..11
205  WEEK_OF_YEAR, // Example: 1..53
206  WEEK_OF_MONTH, // Example: 1..4
207  DATE, // Example: 1..31
208  DAY_OF_YEAR, // Example: 1..365
209  DAY_OF_WEEK, // Example: 1..7
210  DAY_OF_WEEK_IN_MONTH, // Example: 1..4, may be specified as -1
211  AM_PM, // Example: 0..1
212  HOUR, // Example: 0..11
213  HOUR_OF_DAY, // Example: 0..23
214  MINUTE, // Example: 0..59
215  SECOND, // Example: 0..59
216  MILLISECOND, // Example: 0..999
217  ZONE_OFFSET, // Example: -12*U_MILLIS_PER_HOUR..12*U_MILLIS_PER_HOUR
218  DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR
219  YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year
220  DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized
221 
222  EXTENDED_YEAR,
223  JULIAN_DAY,
224  MILLISECONDS_IN_DAY,
225  IS_LEAP_MONTH,
226 
227  FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
228 #endif /* U_HIDE_DEPRECATED_API */
229  };
230 
231 #ifndef U_HIDE_DEPRECATED_API
232 
238  enum EDaysOfWeek {
239  SUNDAY = 1,
240  MONDAY,
241  TUESDAY,
242  WEDNESDAY,
243  THURSDAY,
244  FRIDAY,
245  SATURDAY
246  };
247 
252  enum EMonths {
253  JANUARY,
254  FEBRUARY,
255  MARCH,
256  APRIL,
257  MAY,
258  JUNE,
259  JULY,
260  AUGUST,
261  SEPTEMBER,
262  OCTOBER,
263  NOVEMBER,
264  DECEMBER,
265  UNDECIMBER
266  };
267 
272  enum EAmpm {
273  AM,
274  PM
275  };
276 #endif /* U_HIDE_DEPRECATED_API */
277 
282  virtual ~Calendar();
283 
290  virtual Calendar* clone(void) const = 0;
291 
303  static Calendar* U_EXPORT2 createInstance(UErrorCode& success);
304 
317  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success);
318 
330  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success);
331 
342  static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success);
343 
357  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
358 
371  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
372 
382  static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
383 
384 
401  static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* key,
402  const Locale& locale, UBool commonlyUsed, UErrorCode& status);
403 
411  static UDate U_EXPORT2 getNow(void);
412 
426  inline UDate getTime(UErrorCode& status) const { return getTimeInMillis(status); }
427 
438  inline void setTime(UDate date, UErrorCode& status) { setTimeInMillis(date, status); }
439 
451  virtual UBool operator==(const Calendar& that) const;
452 
461  UBool operator!=(const Calendar& that) const {return !operator==(that);}
462 
473  virtual UBool isEquivalentTo(const Calendar& other) const;
474 
489  UBool equals(const Calendar& when, UErrorCode& status) const;
490 
504  UBool before(const Calendar& when, UErrorCode& status) const;
505 
519  UBool after(const Calendar& when, UErrorCode& status) const;
520 
541  virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
542 
563  virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status);
564 
565 #ifndef U_HIDE_DEPRECATED_API
566 
598  inline void roll(EDateFields field, UBool up, UErrorCode& status);
599 #endif /* U_HIDE_DEPRECATED_API */
600 
633  inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status);
634 
666  virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
667 
699  virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
700 
756  virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status);
757 
813  virtual int32_t fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status);
814 
823  void adoptTimeZone(TimeZone* value);
824 
832  void setTimeZone(const TimeZone& zone);
833 
842  const TimeZone& getTimeZone(void) const;
843 
852  TimeZone* orphanTimeZone(void);
853 
862  virtual UBool inDaylightTime(UErrorCode& status) const = 0;
863 
876  void setLenient(UBool lenient);
877 
884  UBool isLenient(void) const;
885 
906  void setRepeatedWallTimeOption(UCalendarWallTimeOption option);
907 
917  UCalendarWallTimeOption getRepeatedWallTimeOption(void) const;
918 
940  void setSkippedWallTimeOption(UCalendarWallTimeOption option);
941 
952  UCalendarWallTimeOption getSkippedWallTimeOption(void) const;
953 
954 #ifndef U_HIDE_DEPRECATED_API
955 
961  void setFirstDayOfWeek(EDaysOfWeek value);
962 #endif /* U_HIDE_DEPRECATED_API */
963 
970  void setFirstDayOfWeek(UCalendarDaysOfWeek value);
971 
972 #ifndef U_HIDE_DEPRECATED_API
973 
979  EDaysOfWeek getFirstDayOfWeek(void) const;
980 #endif /* U_HIDE_DEPRECATED_API */
981 
989  UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const;
990 
1000  void setMinimalDaysInFirstWeek(uint8_t value);
1001 
1011  uint8_t getMinimalDaysInFirstWeek(void) const;
1012 
1021  virtual int32_t getMinimum(EDateFields field) const;
1022 
1031  virtual int32_t getMinimum(UCalendarDateFields field) const;
1032 
1041  virtual int32_t getMaximum(EDateFields field) const;
1042 
1051  virtual int32_t getMaximum(UCalendarDateFields field) const;
1052 
1061  virtual int32_t getGreatestMinimum(EDateFields field) const;
1062 
1071  virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
1072 
1081  virtual int32_t getLeastMaximum(EDateFields field) const;
1082 
1091  virtual int32_t getLeastMaximum(UCalendarDateFields field) const;
1092 
1093 #ifndef U_HIDE_DEPRECATED_API
1094 
1108  int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
1109 #endif /* U_HIDE_DEPRECATED_API */
1110 
1125  virtual int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const;
1126 
1127 #ifndef U_HIDE_DEPRECATED_API
1128 
1144  int32_t getActualMaximum(EDateFields field, UErrorCode& status) const;
1145 #endif /* U_HIDE_DEPRECATED_API */
1146 
1163  virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
1164 
1165 #ifndef U_HIDE_DEPRECATED_API
1166 
1179  int32_t get(EDateFields field, UErrorCode& status) const;
1180 #endif /* U_HIDE_DEPRECATED_API */
1181 
1195  int32_t get(UCalendarDateFields field, UErrorCode& status) const;
1196 
1197 #ifndef U_HIDE_DEPRECATED_API
1198 
1206  UBool isSet(EDateFields field) const;
1207 #endif /* U_HIDE_DEPRECATED_API */
1208 
1217  UBool isSet(UCalendarDateFields field) const;
1218 
1219 #ifndef U_HIDE_DEPRECATED_API
1220 
1227  void set(EDateFields field, int32_t value);
1228 #endif /* U_HIDE_DEPRECATED_API */
1229 
1237  void set(UCalendarDateFields field, int32_t value);
1238 
1249  void set(int32_t year, int32_t month, int32_t date);
1250 
1263  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1264 
1278  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1279 
1286  void clear(void);
1287 
1288 #ifndef U_HIDE_DEPRECATED_API
1289 
1297  void clear(EDateFields field);
1298 #endif /* U_HIDE_DEPRECATED_API */
1299 
1308  void clear(UCalendarDateFields field);
1309 
1325  virtual UClassID getDynamicClassID(void) const = 0;
1326 
1359  virtual const char * getType() const = 0;
1360 
1377  virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1378 
1393  virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1394 
1404  virtual UBool isWeekend(UDate date, UErrorCode &status) const;
1405 
1413  virtual UBool isWeekend(void) const;
1414 
1415 protected:
1416 
1425  Calendar(UErrorCode& success);
1426 
1433  Calendar(const Calendar& source);
1434 
1441  Calendar& operator=(const Calendar& right);
1442 
1453  Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success);
1454 
1464  Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
1465 
1474  virtual void computeTime(UErrorCode& status);
1475 
1487  virtual void computeFields(UErrorCode& status);
1488 
1498  double getTimeInMillis(UErrorCode& status) const;
1499 
1508  void setTimeInMillis( double millis, UErrorCode& status );
1509 
1519  void complete(UErrorCode& status);
1520 
1521 #ifndef U_HIDE_DEPRECATED_API
1522 
1530  inline int32_t internalGet(EDateFields field) const {return fFields[field];}
1531 #endif /* U_HIDE_DEPRECATED_API */
1532 
1533 #ifndef U_HIDE_INTERNAL_API
1534 
1544  inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;}
1545 
1554  inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];}
1555 #endif /* U_HIDE_INTERNAL_API */
1556 
1557 #ifndef U_HIDE_DEPRECATED_API
1558 
1567  void internalSet(EDateFields field, int32_t value);
1568 #endif /* U_HIDE_DEPRECATED_API */
1569 
1579  inline void internalSet(UCalendarDateFields field, int32_t value);
1580 
1587  virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status);
1588 
1593  enum ELimitType {
1594 #ifndef U_HIDE_INTERNAL_API
1595  UCAL_LIMIT_MINIMUM = 0,
1596  UCAL_LIMIT_GREATEST_MINIMUM,
1597  UCAL_LIMIT_LEAST_MAXIMUM,
1598  UCAL_LIMIT_MAXIMUM,
1599  UCAL_LIMIT_COUNT
1600 #endif /* U_HIDE_INTERNAL_API */
1601  };
1602 
1624  virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0;
1625 
1633  virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const;
1634 
1635 
1649  virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
1650  UBool useMonth) const = 0;
1651 
1659  virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ;
1660 
1668  virtual int32_t handleGetYearLength(int32_t eyear) const;
1669 
1670 
1679  virtual int32_t handleGetExtendedYear() = 0;
1680 
1689  virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField);
1690 
1699  virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
1700 
1707  virtual void validateField(UCalendarDateFields field, UErrorCode &status);
1708 
1709 #ifndef U_HIDE_INTERNAL_API
1710 
1716  int32_t computeJulianDay();
1717 
1725  double computeMillisInDay();
1726 
1736  int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
1737 
1738 
1747  int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
1748 
1754  enum {
1756  kResolveSTOP = -1,
1758  kResolveRemap = 32
1759  };
1760 
1766  static const UFieldResolutionTable kDatePrecedence[];
1767 
1773  static const UFieldResolutionTable kYearPrecedence[];
1774 
1780  static const UFieldResolutionTable kDOWPrecedence[];
1781 
1809  UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable);
1810 #endif /* U_HIDE_INTERNAL_API */
1811 
1812 
1816  virtual const UFieldResolutionTable* getFieldResolutionTable() const;
1817 
1818 #ifndef U_HIDE_INTERNAL_API
1819 
1824  UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const;
1825 #endif /* U_HIDE_INTERNAL_API */
1826 
1827 
1828 private:
1837  int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const;
1838 
1839 
1840 protected:
1846 
1858 
1865 
1874 
1881  UDate internalGetTime(void) const { return fTime; }
1882 
1890  void internalSetTime(UDate time) { fTime = time; }
1891 
1896  int32_t fFields[UCAL_FIELD_COUNT];
1897 
1903 
1907  enum {
1908  kUnset = 0,
1909  kInternallySet,
1910  kMinimumUserStamp
1911  };
1912 
1919  int32_t fStamp[UCAL_FIELD_COUNT];
1920 
1945  virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
1946 
1947 #ifndef U_HIDE_INTERNAL_API
1948 
1953  int32_t getGregorianYear() const {
1954  return fGregorianYear;
1955  }
1956 
1962  int32_t getGregorianMonth() const {
1963  return fGregorianMonth;
1964  }
1965 
1971  int32_t getGregorianDayOfYear() const {
1972  return fGregorianDayOfYear;
1973  }
1974 
1980  int32_t getGregorianDayOfMonth() const {
1981  return fGregorianDayOfMonth;
1982  }
1983 #endif /* U_HIDE_INTERNAL_API */
1984 
1991  virtual int32_t getDefaultMonthInYear(int32_t eyear) ;
1992 
1993 
2001  virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
2002 
2003  //-------------------------------------------------------------------------
2004  // Protected utility methods for use by subclasses. These are very handy
2005  // for implementing add, roll, and computeFields.
2006  //-------------------------------------------------------------------------
2007 
2037  virtual void pinField(UCalendarDateFields field, UErrorCode& status);
2038 
2082  int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2083 
2084 
2085 #ifndef U_HIDE_INTERNAL_API
2086 
2116  inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2117 
2122  int32_t getLocalDOW();
2123 #endif /* U_HIDE_INTERNAL_API */
2124 
2125 private:
2126 
2130  int32_t fNextStamp;// = MINIMUM_USER_STAMP;
2131 
2136  void recalculateStamp();
2137 
2141  UDate fTime;
2142 
2146  UBool fLenient;
2147 
2152  TimeZone* fZone;
2153 
2158  UCalendarWallTimeOption fRepeatedWallTime;
2159 
2164  UCalendarWallTimeOption fSkippedWallTime;
2165 
2174  UCalendarDaysOfWeek fFirstDayOfWeek;
2175  uint8_t fMinimalDaysInFirstWeek;
2176  UCalendarDaysOfWeek fWeekendOnset;
2177  int32_t fWeekendOnsetMillis;
2178  UCalendarDaysOfWeek fWeekendCease;
2179  int32_t fWeekendCeaseMillis;
2180 
2191  void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success);
2192 
2202  void updateTime(UErrorCode& status);
2203 
2209  int32_t fGregorianYear;
2210 
2216  int32_t fGregorianMonth;
2217 
2223  int32_t fGregorianDayOfYear;
2224 
2230  int32_t fGregorianDayOfMonth;
2231 
2232  /* calculations */
2233 
2240  void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
2241 
2242 protected:
2243 
2251  void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
2252 
2253 private:
2254 
2275  void computeWeekFields(UErrorCode &ec);
2276 
2277 
2286  void validateFields(UErrorCode &status);
2287 
2296  void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
2297 
2298  protected:
2299 #ifndef U_HIDE_INTERNAL_API
2300 
2309  static uint8_t julianDayToDayOfWeek(double julian);
2310 #endif /* U_HIDE_INTERNAL_API */
2311 
2312  private:
2313  char validLocale[ULOC_FULLNAME_CAPACITY];
2314  char actualLocale[ULOC_FULLNAME_CAPACITY];
2315 
2316  public:
2317 #if !UCONFIG_NO_SERVICE
2318 
2322 #ifndef U_HIDE_INTERNAL_API
2323 
2329  static StringEnumeration* getAvailableLocales(void);
2330 
2344  static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status);
2345 
2361  static UBool unregister(URegistryKey key, UErrorCode& status);
2362 #endif /* U_HIDE_INTERNAL_API */
2363 
2368  friend class CalendarFactory;
2369 
2374  friend class CalendarService;
2375 
2380  friend class DefaultCalendarFactory;
2381 #endif /* !UCONFIG_NO_SERVICE */
2382 
2387  virtual UBool haveDefaultCentury() const = 0;
2388 
2393  virtual UDate defaultCenturyStart() const = 0;
2398  virtual int32_t defaultCenturyStartYear() const = 0;
2399 
2406  Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const;
2407 
2413  virtual int32_t getRelatedYear(UErrorCode &status) const;
2414 
2420  virtual void setRelatedYear(int32_t year);
2421 
2422 #ifndef U_HIDE_INTERNAL_API
2423 
2429  const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
2430 #endif /* U_HIDE_INTERNAL_API */
2431 
2432 private:
2437  BasicTimeZone* getBasicTimeZone() const;
2438 
2446  UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const;
2447 
2448 public:
2449 #ifndef U_HIDE_INTERNAL_API
2450 
2458  static Calendar * U_EXPORT2 makeInstance(
2459  const Locale &locale, UErrorCode &status);
2460 
2471  static void U_EXPORT2 getCalendarTypeFromLocale(
2472  const Locale &locale,
2473  char *typeBuffer,
2474  int32_t typeBufferSize,
2475  UErrorCode &status);
2476 #endif /* U_HIDE_INTERNAL_API */
2477 };
2478 
2479 // -------------------------------------
2480 
2481 inline Calendar*
2483 {
2484  // since the Locale isn't specified, use the default locale
2485  return createInstance(zone, Locale::getDefault(), errorCode);
2486 }
2487 
2488 // -------------------------------------
2489 
2490 inline void
2492 {
2493  roll(field, (int32_t)(up ? +1 : -1), status);
2494 }
2495 
2496 #ifndef U_HIDE_DEPRECATED_API
2497 inline void
2499 {
2500  roll((UCalendarDateFields) field, up, status);
2501 }
2502 #endif /* U_HIDE_DEPRECATED_API */
2503 
2504 
2505 // -------------------------------------
2506 
2512 inline void
2514 {
2515  fFields[field] = value;
2516  fStamp[field] = kInternallySet;
2517  fIsSet[field] = TRUE; // Remove later
2518 }
2519 
2520 
2521 #ifndef U_HIDE_INTERNAL_API
2522 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2523 {
2524  return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
2525 }
2526 #endif /* U_HIDE_INTERNAL_API */
2527 
2529 
2530 #endif /* #if !UCONFIG_NO_FORMATTING */
2531 
2532 #endif // _CALENDAR
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:198
C API: Calendar.
UDate internalGetTime(void) const
Get the current time without recomputing.
Definition: calendar.h:1881
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
Definition: calendar.h:185
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.
int32_t internalGet(EDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1530
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:90
C API:misc definitions.
#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:252
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:1354
ELimitType
Limit enums.
Definition: calendar.h:1593
int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek)
Return the week number of a day, within a period.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:301
UCalendarWallTimeOption
Options for handling ambiguous wall time at time zone offset transitions.
Definition: ucal.h:920
UBool fAreAllFieldsSet
True if all of the fields have been set.
Definition: calendar.h:1864
UBool fIsTimeSet
The flag which indicates if the current time is set in the calendar.
Definition: calendar.h:1845
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
static Calendar * createInstance(UErrorCode &success)
Creates a Calendar using the default timezone and locale.
UCalendarDaysOfWeek
Useful constant for days of week.
Definition: ucal.h:470
int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const
Gets the value for a given time field.
Definition: calendar.h:1544
void internalSet(EDateFields field, int32_t value)
Sets the value for a given time field.
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
void roll(EDateFields field, UBool up, UErrorCode &status)
Time Field Rolling function.
Definition: calendar.h:2498
EAmpm
Useful constants for hour in 12-hour clock.
Definition: calendar.h:272
int32_t getGregorianYear() const
Return the extended year on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1953
void setTime(UDate date, UErrorCode &status)
Sets this Calendar's current time with the given UDate.
Definition: calendar.h:438
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:36
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:229
int32_t getGregorianDayOfMonth() const
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1980
EDaysOfWeek
Useful constant for days of week.
Definition: calendar.h:238
UDate getTime(UErrorCode &status) const
Gets this Calendar's time as milliseconds.
Definition: calendar.h:426
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
int32_t getGregorianDayOfYear() const
Return the day of year (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1971
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:138
int32_t getGregorianMonth() const
Return the month (0-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1962
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:401
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:1873
C++ API: Locale ID object.
EDateFields
Field IDs for date and time.
Definition: calendar.h:194
void internalSetTime(UDate time)
Set the current time without affecting flags or fields.
Definition: calendar.h:1890
Basic definitions for ICU, for both C and C++ APIs.
One more than the highest normal UCalendarDateFields value.
Definition: ucal.h:447
UBool operator!=(const Calendar &that) const
Compares the inequality of two Calendar objects.
Definition: calendar.h:461
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:220
int32_t UFieldResolutionTable[12][8]
Definition: calendar.h:46
int32_t internalGet(UCalendarDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1554
UBool fAreFieldsSet
True if the fields are in sync with the currently set time of this Calendar.
Definition: calendar.h:1857
int8_t UBool
The ICU boolean type.
Definition: umachine.h:225
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:192