ICU 65.1  65.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 
32 #if U_SHOW_CPLUSPLUS_API
33 
38 #if !UCONFIG_NO_FORMATTING
39 
40 #include "unicode/uobject.h"
41 #include "unicode/locid.h"
42 #include "unicode/timezone.h"
43 #include "unicode/ucal.h"
44 #include "unicode/umisc.h"
45 
46 U_NAMESPACE_BEGIN
47 
48 class ICUServiceFactory;
49 
53 typedef int32_t UFieldResolutionTable[12][8];
54 
55 class BasicTimeZone;
187 class U_I18N_API Calendar : public UObject {
188 public:
189 
196  enum EDateFields {
197 #ifndef U_HIDE_DEPRECATED_API
198 /*
199  * ERA may be defined on other platforms. To avoid any potential problems undefined it here.
200  */
201 #ifdef ERA
202 #undef ERA
203 #endif
204  ERA, // Example: 0..1
205  YEAR, // Example: 1..big number
206  MONTH, // Example: 0..11
207  WEEK_OF_YEAR, // Example: 1..53
208  WEEK_OF_MONTH, // Example: 1..4
209  DATE, // Example: 1..31
210  DAY_OF_YEAR, // Example: 1..365
211  DAY_OF_WEEK, // Example: 1..7
212  DAY_OF_WEEK_IN_MONTH, // Example: 1..4, may be specified as -1
213  AM_PM, // Example: 0..1
214  HOUR, // Example: 0..11
215  HOUR_OF_DAY, // Example: 0..23
216  MINUTE, // Example: 0..59
217  SECOND, // Example: 0..59
218  MILLISECOND, // Example: 0..999
219  ZONE_OFFSET, // Example: -12*U_MILLIS_PER_HOUR..12*U_MILLIS_PER_HOUR
220  DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR
221  YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year
222  DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized
223 
224  EXTENDED_YEAR,
225  JULIAN_DAY,
226  MILLISECONDS_IN_DAY,
227  IS_LEAP_MONTH,
228 
229  FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
230 #endif /* U_HIDE_DEPRECATED_API */
231  };
232 
233 #ifndef U_HIDE_DEPRECATED_API
234 
240  enum EDaysOfWeek {
241  SUNDAY = 1,
242  MONDAY,
243  TUESDAY,
244  WEDNESDAY,
245  THURSDAY,
246  FRIDAY,
247  SATURDAY
248  };
249 
254  enum EMonths {
255  JANUARY,
256  FEBRUARY,
257  MARCH,
258  APRIL,
259  MAY,
260  JUNE,
261  JULY,
262  AUGUST,
263  SEPTEMBER,
264  OCTOBER,
265  NOVEMBER,
266  DECEMBER,
267  UNDECIMBER
268  };
269 
274  enum EAmpm {
275  AM,
276  PM
277  };
278 #endif /* U_HIDE_DEPRECATED_API */
279 
284  virtual ~Calendar();
285 
292  virtual Calendar* clone() const = 0;
293 
305  static Calendar* U_EXPORT2 createInstance(UErrorCode& success);
306 
319  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success);
320 
332  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success);
333 
344  static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success);
345 
359  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
360 
373  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
374 
384  static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
385 
386 
403  static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* key,
404  const Locale& locale, UBool commonlyUsed, UErrorCode& status);
405 
413  static UDate U_EXPORT2 getNow(void);
414 
428  inline UDate getTime(UErrorCode& status) const { return getTimeInMillis(status); }
429 
440  inline void setTime(UDate date, UErrorCode& status) { setTimeInMillis(date, status); }
441 
453  virtual UBool operator==(const Calendar& that) const;
454 
463  UBool operator!=(const Calendar& that) const {return !operator==(that);}
464 
475  virtual UBool isEquivalentTo(const Calendar& other) const;
476 
491  UBool equals(const Calendar& when, UErrorCode& status) const;
492 
506  UBool before(const Calendar& when, UErrorCode& status) const;
507 
521  UBool after(const Calendar& when, UErrorCode& status) const;
522 
543  virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
544 
565  virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status);
566 
567 #ifndef U_HIDE_DEPRECATED_API
568 
600  inline void roll(EDateFields field, UBool up, UErrorCode& status);
601 #endif /* U_HIDE_DEPRECATED_API */
602 
635  inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status);
636 
668  virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
669 
701  virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
702 
758  virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status);
759 
815  virtual int32_t fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status);
816 
825  void adoptTimeZone(TimeZone* value);
826 
834  void setTimeZone(const TimeZone& zone);
835 
844  const TimeZone& getTimeZone(void) const;
845 
854  TimeZone* orphanTimeZone(void);
855 
864  virtual UBool inDaylightTime(UErrorCode& status) const = 0;
865 
878  void setLenient(UBool lenient);
879 
886  UBool isLenient(void) const;
887 
908  void setRepeatedWallTimeOption(UCalendarWallTimeOption option);
909 
919  UCalendarWallTimeOption getRepeatedWallTimeOption(void) const;
920 
942  void setSkippedWallTimeOption(UCalendarWallTimeOption option);
943 
954  UCalendarWallTimeOption getSkippedWallTimeOption(void) const;
955 
956 #ifndef U_HIDE_DEPRECATED_API
957 
963  void setFirstDayOfWeek(EDaysOfWeek value);
964 #endif /* U_HIDE_DEPRECATED_API */
965 
972  void setFirstDayOfWeek(UCalendarDaysOfWeek value);
973 
974 #ifndef U_HIDE_DEPRECATED_API
975 
981  EDaysOfWeek getFirstDayOfWeek(void) const;
982 #endif /* U_HIDE_DEPRECATED_API */
983 
991  UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const;
992 
1002  void setMinimalDaysInFirstWeek(uint8_t value);
1003 
1013  uint8_t getMinimalDaysInFirstWeek(void) const;
1014 
1023  virtual int32_t getMinimum(EDateFields field) const;
1024 
1033  virtual int32_t getMinimum(UCalendarDateFields field) const;
1034 
1043  virtual int32_t getMaximum(EDateFields field) const;
1044 
1053  virtual int32_t getMaximum(UCalendarDateFields field) const;
1054 
1063  virtual int32_t getGreatestMinimum(EDateFields field) const;
1064 
1073  virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
1074 
1083  virtual int32_t getLeastMaximum(EDateFields field) const;
1084 
1093  virtual int32_t getLeastMaximum(UCalendarDateFields field) const;
1094 
1095 #ifndef U_HIDE_DEPRECATED_API
1096 
1110  int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
1111 #endif /* U_HIDE_DEPRECATED_API */
1112 
1127  virtual int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const;
1128 
1129 #ifndef U_HIDE_DEPRECATED_API
1130 
1146  int32_t getActualMaximum(EDateFields field, UErrorCode& status) const;
1147 #endif /* U_HIDE_DEPRECATED_API */
1148 
1165  virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
1166 
1167 #ifndef U_HIDE_DEPRECATED_API
1168 
1181  int32_t get(EDateFields field, UErrorCode& status) const;
1182 #endif /* U_HIDE_DEPRECATED_API */
1183 
1197  int32_t get(UCalendarDateFields field, UErrorCode& status) const;
1198 
1199 #ifndef U_HIDE_DEPRECATED_API
1200 
1208  UBool isSet(EDateFields field) const;
1209 #endif /* U_HIDE_DEPRECATED_API */
1210 
1219  UBool isSet(UCalendarDateFields field) const;
1220 
1221 #ifndef U_HIDE_DEPRECATED_API
1222 
1229  void set(EDateFields field, int32_t value);
1230 #endif /* U_HIDE_DEPRECATED_API */
1231 
1239  void set(UCalendarDateFields field, int32_t value);
1240 
1251  void set(int32_t year, int32_t month, int32_t date);
1252 
1265  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1266 
1280  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1281 
1288  void clear(void);
1289 
1290 #ifndef U_HIDE_DEPRECATED_API
1291 
1299  void clear(EDateFields field);
1300 #endif /* U_HIDE_DEPRECATED_API */
1301 
1310  void clear(UCalendarDateFields field);
1311 
1327  virtual UClassID getDynamicClassID(void) const = 0;
1328 
1361  virtual const char * getType() const = 0;
1362 
1379  virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1380 
1395  virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1396 
1406  virtual UBool isWeekend(UDate date, UErrorCode &status) const;
1407 
1415  virtual UBool isWeekend(void) const;
1416 
1417 protected:
1418 
1427  Calendar(UErrorCode& success);
1428 
1435  Calendar(const Calendar& source);
1436 
1443  Calendar& operator=(const Calendar& right);
1444 
1455  Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success);
1456 
1466  Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
1467 
1476  virtual void computeTime(UErrorCode& status);
1477 
1489  virtual void computeFields(UErrorCode& status);
1490 
1500  double getTimeInMillis(UErrorCode& status) const;
1501 
1510  void setTimeInMillis( double millis, UErrorCode& status );
1511 
1521  void complete(UErrorCode& status);
1522 
1523 #ifndef U_HIDE_DEPRECATED_API
1524 
1532  inline int32_t internalGet(EDateFields field) const {return fFields[field];}
1533 #endif /* U_HIDE_DEPRECATED_API */
1534 
1535 #ifndef U_HIDE_INTERNAL_API
1536 
1546  inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;}
1547 
1556  inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];}
1557 #endif /* U_HIDE_INTERNAL_API */
1558 
1559 #ifndef U_HIDE_DEPRECATED_API
1560 
1569  void internalSet(EDateFields field, int32_t value);
1570 #endif /* U_HIDE_DEPRECATED_API */
1571 
1581  inline void internalSet(UCalendarDateFields field, int32_t value);
1582 
1589  virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status);
1590 
1595  enum ELimitType {
1596 #ifndef U_HIDE_INTERNAL_API
1597  UCAL_LIMIT_MINIMUM = 0,
1598  UCAL_LIMIT_GREATEST_MINIMUM,
1599  UCAL_LIMIT_LEAST_MAXIMUM,
1600  UCAL_LIMIT_MAXIMUM,
1601  UCAL_LIMIT_COUNT
1602 #endif /* U_HIDE_INTERNAL_API */
1603  };
1604 
1626  virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0;
1627 
1635  virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const;
1636 
1637 
1651  virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
1652  UBool useMonth) const = 0;
1653 
1661  virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ;
1662 
1670  virtual int32_t handleGetYearLength(int32_t eyear) const;
1671 
1672 
1681  virtual int32_t handleGetExtendedYear() = 0;
1682 
1691  virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField);
1692 
1701  virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
1702 
1709  virtual void validateField(UCalendarDateFields field, UErrorCode &status);
1710 
1711 #ifndef U_HIDE_INTERNAL_API
1712 
1718  int32_t computeJulianDay();
1719 
1727  double computeMillisInDay();
1728 
1738  int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
1739 
1740 
1749  int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
1750 
1756  enum {
1758  kResolveSTOP = -1,
1760  kResolveRemap = 32
1761  };
1762 
1768  static const UFieldResolutionTable kDatePrecedence[];
1769 
1775  static const UFieldResolutionTable kYearPrecedence[];
1776 
1782  static const UFieldResolutionTable kDOWPrecedence[];
1783 
1811  UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable);
1812 #endif /* U_HIDE_INTERNAL_API */
1813 
1814 
1818  virtual const UFieldResolutionTable* getFieldResolutionTable() const;
1819 
1820 #ifndef U_HIDE_INTERNAL_API
1821 
1826  UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const;
1827 #endif /* U_HIDE_INTERNAL_API */
1828 
1829 
1830 private:
1839  int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const;
1840 
1841 
1842 protected:
1848 
1860 
1867 
1876 
1883  UDate internalGetTime(void) const { return fTime; }
1884 
1892  void internalSetTime(UDate time) { fTime = time; }
1893 
1898  int32_t fFields[UCAL_FIELD_COUNT];
1899 
1905 
1909  enum {
1910  kUnset = 0,
1911  kInternallySet,
1912  kMinimumUserStamp
1913  };
1914 
1921  int32_t fStamp[UCAL_FIELD_COUNT];
1922 
1947  virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
1948 
1949 #ifndef U_HIDE_INTERNAL_API
1950 
1955  int32_t getGregorianYear() const {
1956  return fGregorianYear;
1957  }
1958 
1964  int32_t getGregorianMonth() const {
1965  return fGregorianMonth;
1966  }
1967 
1973  int32_t getGregorianDayOfYear() const {
1974  return fGregorianDayOfYear;
1975  }
1976 
1982  int32_t getGregorianDayOfMonth() const {
1983  return fGregorianDayOfMonth;
1984  }
1985 #endif /* U_HIDE_INTERNAL_API */
1986 
1993  virtual int32_t getDefaultMonthInYear(int32_t eyear) ;
1994 
1995 
2003  virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
2004 
2005  //-------------------------------------------------------------------------
2006  // Protected utility methods for use by subclasses. These are very handy
2007  // for implementing add, roll, and computeFields.
2008  //-------------------------------------------------------------------------
2009 
2039  virtual void pinField(UCalendarDateFields field, UErrorCode& status);
2040 
2084  int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2085 
2086 
2087 #ifndef U_HIDE_INTERNAL_API
2088 
2118  inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2119 
2124  int32_t getLocalDOW();
2125 #endif /* U_HIDE_INTERNAL_API */
2126 
2127 private:
2128 
2132  int32_t fNextStamp;// = MINIMUM_USER_STAMP;
2133 
2138  void recalculateStamp();
2139 
2143  UDate fTime;
2144 
2148  UBool fLenient;
2149 
2154  TimeZone* fZone;
2155 
2160  UCalendarWallTimeOption fRepeatedWallTime;
2161 
2166  UCalendarWallTimeOption fSkippedWallTime;
2167 
2176  UCalendarDaysOfWeek fFirstDayOfWeek;
2177  uint8_t fMinimalDaysInFirstWeek;
2178  UCalendarDaysOfWeek fWeekendOnset;
2179  int32_t fWeekendOnsetMillis;
2180  UCalendarDaysOfWeek fWeekendCease;
2181  int32_t fWeekendCeaseMillis;
2182 
2193  void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success);
2194 
2204  void updateTime(UErrorCode& status);
2205 
2211  int32_t fGregorianYear;
2212 
2218  int32_t fGregorianMonth;
2219 
2225  int32_t fGregorianDayOfYear;
2226 
2232  int32_t fGregorianDayOfMonth;
2233 
2234  /* calculations */
2235 
2242  void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
2243 
2244 protected:
2245 
2253  void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
2254 
2255 private:
2256 
2277  void computeWeekFields(UErrorCode &ec);
2278 
2279 
2288  void validateFields(UErrorCode &status);
2289 
2298  void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
2299 
2300  protected:
2301 #ifndef U_HIDE_INTERNAL_API
2302 
2311  static uint8_t julianDayToDayOfWeek(double julian);
2312 #endif /* U_HIDE_INTERNAL_API */
2313 
2314  private:
2315  char validLocale[ULOC_FULLNAME_CAPACITY];
2316  char actualLocale[ULOC_FULLNAME_CAPACITY];
2317 
2318  public:
2319 #if !UCONFIG_NO_SERVICE
2320 
2324 #ifndef U_HIDE_INTERNAL_API
2325 
2331  static StringEnumeration* getAvailableLocales(void);
2332 
2346  static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status);
2347 
2363  static UBool unregister(URegistryKey key, UErrorCode& status);
2364 #endif /* U_HIDE_INTERNAL_API */
2365 
2370  friend class CalendarFactory;
2371 
2376  friend class CalendarService;
2377 
2382  friend class DefaultCalendarFactory;
2383 #endif /* !UCONFIG_NO_SERVICE */
2384 
2389  virtual UBool haveDefaultCentury() const = 0;
2390 
2395  virtual UDate defaultCenturyStart() const = 0;
2400  virtual int32_t defaultCenturyStartYear() const = 0;
2401 
2408  Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const;
2409 
2415  virtual int32_t getRelatedYear(UErrorCode &status) const;
2416 
2422  virtual void setRelatedYear(int32_t year);
2423 
2424 #ifndef U_HIDE_INTERNAL_API
2425 
2431  const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
2432 #endif /* U_HIDE_INTERNAL_API */
2433 
2434 private:
2439  BasicTimeZone* getBasicTimeZone() const;
2440 
2448  UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const;
2449 
2450 public:
2451 #ifndef U_HIDE_INTERNAL_API
2452 
2460  static Calendar * U_EXPORT2 makeInstance(
2461  const Locale &locale, UErrorCode &status);
2462 
2473  static void U_EXPORT2 getCalendarTypeFromLocale(
2474  const Locale &locale,
2475  char *typeBuffer,
2476  int32_t typeBufferSize,
2477  UErrorCode &status);
2478 #endif /* U_HIDE_INTERNAL_API */
2479 };
2480 
2481 // -------------------------------------
2482 
2483 inline Calendar*
2485 {
2486  // since the Locale isn't specified, use the default locale
2487  return createInstance(zone, Locale::getDefault(), errorCode);
2488 }
2489 
2490 // -------------------------------------
2491 
2492 inline void
2494 {
2495  roll(field, (int32_t)(up ? +1 : -1), status);
2496 }
2497 
2498 #ifndef U_HIDE_DEPRECATED_API
2499 inline void
2501 {
2502  roll((UCalendarDateFields) field, up, status);
2503 }
2504 #endif /* U_HIDE_DEPRECATED_API */
2505 
2506 
2507 // -------------------------------------
2508 
2514 inline void
2516 {
2517  fFields[field] = value;
2518  fStamp[field] = kInternallySet;
2519  fIsSet[field] = TRUE; // Remove later
2520 }
2521 
2522 
2523 #ifndef U_HIDE_INTERNAL_API
2524 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2525 {
2526  return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
2527 }
2528 #endif /* U_HIDE_INTERNAL_API */
2529 
2530 U_NAMESPACE_END
2531 
2532 #endif /* #if !UCONFIG_NO_FORMATTING */
2533 
2534 #endif /* U_SHOW_CPLUSPLUS_API */
2535 
2536 #endif // _CALENDAR
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:199
C API: Calendar.
UDate internalGetTime(void) const
Get the current time without recomputing.
Definition: calendar.h:1883
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
Definition: calendar.h:187
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:1532
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
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:61
EMonths
Useful constants for month.
Definition: calendar.h:254
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:133
UCalendarWeekdayType
Weekday types, as returned by ucal_getDayOfWeekType().
Definition: ucal.h:1398
ELimitType
Limit enums.
Definition: calendar.h:1595
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:964
UBool fAreAllFieldsSet
True if all of the fields have been set.
Definition: calendar.h:1866
UBool fIsTimeSet
The flag which indicates if the current time is set in the calendar.
Definition: calendar.h:1847
static Calendar * createInstance(UErrorCode &success)
Creates a Calendar using the default timezone and locale.
UCalendarDaysOfWeek
Useful constant for days of week.
Definition: ucal.h:471
int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const
Gets the value for a given time field.
Definition: calendar.h:1546
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:2500
EAmpm
Useful constants for hour in 12-hour clock.
Definition: calendar.h:274
int32_t getGregorianYear() const
Return the extended year on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1955
void setTime(UDate date, UErrorCode &status)
Sets this Calendar's current time with the given UDate.
Definition: calendar.h:440
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:38
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:264
int32_t getGregorianDayOfMonth() const
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1982
EDaysOfWeek
Useful constant for days of week.
Definition: calendar.h:240
UDate getTime(UErrorCode &status) const
Gets this Calendar's time as milliseconds.
Definition: calendar.h:428
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:1973
int32_t getGregorianMonth() const
Return the month (0-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1964
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
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:1875
C++ API: Locale ID object.
EDateFields
Field IDs for date and time.
Definition: calendar.h:196
void internalSetTime(UDate time)
Set the current time without affecting flags or fields.
Definition: calendar.h:1892
Basic definitions for ICU, for both C and C++ APIs.
One more than the highest normal UCalendarDateFields value.
Definition: ucal.h:448
UBool operator!=(const Calendar &that) const
Compares the inequality of two Calendar objects.
Definition: calendar.h:463
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
int32_t UFieldResolutionTable[12][8]
Definition: calendar.h:48
int32_t internalGet(UCalendarDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1556
UBool fAreFieldsSet
True if the fields are in sync with the currently set time of this Calendar.
Definition: calendar.h:1859
int8_t UBool
The ICU boolean type.
Definition: umachine.h:260
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195