ICU 62.2  62.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;
215 class U_I18N_API Calendar : public UObject {
216 public:
217 
224  enum EDateFields {
225 #ifndef U_HIDE_DEPRECATED_API
226 /*
227  * ERA may be defined on other platforms. To avoid any potential problems undefined it here.
228  */
229 #ifdef ERA
230 #undef ERA
231 #endif
232  ERA, // Example: 0..1
233  YEAR, // Example: 1..big number
234  MONTH, // Example: 0..11
235  WEEK_OF_YEAR, // Example: 1..53
236  WEEK_OF_MONTH, // Example: 1..4
237  DATE, // Example: 1..31
238  DAY_OF_YEAR, // Example: 1..365
239  DAY_OF_WEEK, // Example: 1..7
240  DAY_OF_WEEK_IN_MONTH, // Example: 1..4, may be specified as -1
241  AM_PM, // Example: 0..1
242  HOUR, // Example: 0..11
243  HOUR_OF_DAY, // Example: 0..23
244  MINUTE, // Example: 0..59
245  SECOND, // Example: 0..59
246  MILLISECOND, // Example: 0..999
247  ZONE_OFFSET, // Example: -12*U_MILLIS_PER_HOUR..12*U_MILLIS_PER_HOUR
248  DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR
249  YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year
250  DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized
251 
252  EXTENDED_YEAR,
253  JULIAN_DAY,
254  MILLISECONDS_IN_DAY,
255  IS_LEAP_MONTH,
256 
257  FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
258 #endif /* U_HIDE_DEPRECATED_API */
259  };
260 
261 #ifndef U_HIDE_DEPRECATED_API
262 
268  enum EDaysOfWeek {
269  SUNDAY = 1,
270  MONDAY,
271  TUESDAY,
272  WEDNESDAY,
273  THURSDAY,
274  FRIDAY,
275  SATURDAY
276  };
277 
282  enum EMonths {
283  JANUARY,
284  FEBRUARY,
285  MARCH,
286  APRIL,
287  MAY,
288  JUNE,
289  JULY,
290  AUGUST,
291  SEPTEMBER,
292  OCTOBER,
293  NOVEMBER,
294  DECEMBER,
295  UNDECIMBER
296  };
297 
302  enum EAmpm {
303  AM,
304  PM
305  };
306 #endif /* U_HIDE_DEPRECATED_API */
307 
312  virtual ~Calendar();
313 
320  virtual Calendar* clone(void) const = 0;
321 
333  static Calendar* U_EXPORT2 createInstance(UErrorCode& success);
334 
347  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success);
348 
360  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success);
361 
372  static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success);
373 
387  static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
388 
401  static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
402 
412  static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
413 
414 
431  static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* key,
432  const Locale& locale, UBool commonlyUsed, UErrorCode& status);
433 
441  static UDate U_EXPORT2 getNow(void);
442 
456  inline UDate getTime(UErrorCode& status) const { return getTimeInMillis(status); }
457 
468  inline void setTime(UDate date, UErrorCode& status) { setTimeInMillis(date, status); }
469 
481  virtual UBool operator==(const Calendar& that) const;
482 
491  UBool operator!=(const Calendar& that) const {return !operator==(that);}
492 
503  virtual UBool isEquivalentTo(const Calendar& other) const;
504 
519  UBool equals(const Calendar& when, UErrorCode& status) const;
520 
534  UBool before(const Calendar& when, UErrorCode& status) const;
535 
549  UBool after(const Calendar& when, UErrorCode& status) const;
550 
571  virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
572 
593  virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status);
594 
595 #ifndef U_HIDE_DEPRECATED_API
596 
628  inline void roll(EDateFields field, UBool up, UErrorCode& status);
629 #endif /* U_HIDE_DEPRECATED_API */
630 
663  inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status);
664 
696  virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
697 
729  virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
730 
786  virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status);
787 
843  virtual int32_t fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status);
844 
853  void adoptTimeZone(TimeZone* value);
854 
862  void setTimeZone(const TimeZone& zone);
863 
872  const TimeZone& getTimeZone(void) const;
873 
882  TimeZone* orphanTimeZone(void);
883 
892  virtual UBool inDaylightTime(UErrorCode& status) const = 0;
893 
906  void setLenient(UBool lenient);
907 
914  UBool isLenient(void) const;
915 
936  void setRepeatedWallTimeOption(UCalendarWallTimeOption option);
937 
947  UCalendarWallTimeOption getRepeatedWallTimeOption(void) const;
948 
970  void setSkippedWallTimeOption(UCalendarWallTimeOption option);
971 
982  UCalendarWallTimeOption getSkippedWallTimeOption(void) const;
983 
984 #ifndef U_HIDE_DEPRECATED_API
985 
991  void setFirstDayOfWeek(EDaysOfWeek value);
992 #endif /* U_HIDE_DEPRECATED_API */
993 
1000  void setFirstDayOfWeek(UCalendarDaysOfWeek value);
1001 
1002 #ifndef U_HIDE_DEPRECATED_API
1003 
1009  EDaysOfWeek getFirstDayOfWeek(void) const;
1010 #endif /* U_HIDE_DEPRECATED_API */
1011 
1019  UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const;
1020 
1030  void setMinimalDaysInFirstWeek(uint8_t value);
1031 
1041  uint8_t getMinimalDaysInFirstWeek(void) const;
1042 
1051  virtual int32_t getMinimum(EDateFields field) const;
1052 
1061  virtual int32_t getMinimum(UCalendarDateFields field) const;
1062 
1071  virtual int32_t getMaximum(EDateFields field) const;
1072 
1081  virtual int32_t getMaximum(UCalendarDateFields field) const;
1082 
1091  virtual int32_t getGreatestMinimum(EDateFields field) const;
1092 
1101  virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
1102 
1111  virtual int32_t getLeastMaximum(EDateFields field) const;
1112 
1121  virtual int32_t getLeastMaximum(UCalendarDateFields field) const;
1122 
1123 #ifndef U_HIDE_DEPRECATED_API
1124 
1138  int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
1139 #endif /* U_HIDE_DEPRECATED_API */
1140 
1155  virtual int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const;
1156 
1157 #ifndef U_HIDE_DEPRECATED_API
1158 
1174  int32_t getActualMaximum(EDateFields field, UErrorCode& status) const;
1175 #endif /* U_HIDE_DEPRECATED_API */
1176 
1193  virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
1194 
1195 #ifndef U_HIDE_DEPRECATED_API
1196 
1209  int32_t get(EDateFields field, UErrorCode& status) const;
1210 #endif /* U_HIDE_DEPRECATED_API */
1211 
1225  int32_t get(UCalendarDateFields field, UErrorCode& status) const;
1226 
1227 #ifndef U_HIDE_DEPRECATED_API
1228 
1236  UBool isSet(EDateFields field) const;
1237 #endif /* U_HIDE_DEPRECATED_API */
1238 
1247  UBool isSet(UCalendarDateFields field) const;
1248 
1249 #ifndef U_HIDE_DEPRECATED_API
1250 
1257  void set(EDateFields field, int32_t value);
1258 #endif /* U_HIDE_DEPRECATED_API */
1259 
1267  void set(UCalendarDateFields field, int32_t value);
1268 
1279  void set(int32_t year, int32_t month, int32_t date);
1280 
1293  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1294 
1308  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1309 
1316  void clear(void);
1317 
1318 #ifndef U_HIDE_DEPRECATED_API
1319 
1327  void clear(EDateFields field);
1328 #endif /* U_HIDE_DEPRECATED_API */
1329 
1338  void clear(UCalendarDateFields field);
1339 
1355  virtual UClassID getDynamicClassID(void) const = 0;
1356 
1389  virtual const char * getType() const = 0;
1390 
1407  virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1408 
1423  virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1424 
1434  virtual UBool isWeekend(UDate date, UErrorCode &status) const;
1435 
1443  virtual UBool isWeekend(void) const;
1444 
1445 protected:
1446 
1455  Calendar(UErrorCode& success);
1456 
1463  Calendar(const Calendar& source);
1464 
1471  Calendar& operator=(const Calendar& right);
1472 
1483  Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success);
1484 
1494  Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
1495 
1504  virtual void computeTime(UErrorCode& status);
1505 
1517  virtual void computeFields(UErrorCode& status);
1518 
1528  double getTimeInMillis(UErrorCode& status) const;
1529 
1538  void setTimeInMillis( double millis, UErrorCode& status );
1539 
1549  void complete(UErrorCode& status);
1550 
1551 #ifndef U_HIDE_DEPRECATED_API
1552 
1560  inline int32_t internalGet(EDateFields field) const {return fFields[field];}
1561 #endif /* U_HIDE_DEPRECATED_API */
1562 
1563 #ifndef U_HIDE_INTERNAL_API
1564 
1574  inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;}
1575 
1584  inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];}
1585 #endif /* U_HIDE_INTERNAL_API */
1586 
1587 #ifndef U_HIDE_DEPRECATED_API
1588 
1597  void internalSet(EDateFields field, int32_t value);
1598 #endif /* U_HIDE_DEPRECATED_API */
1599 
1609  inline void internalSet(UCalendarDateFields field, int32_t value);
1610 
1617  virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status);
1618 
1623  enum ELimitType {
1624 #ifndef U_HIDE_INTERNAL_API
1625  UCAL_LIMIT_MINIMUM = 0,
1626  UCAL_LIMIT_GREATEST_MINIMUM,
1627  UCAL_LIMIT_LEAST_MAXIMUM,
1628  UCAL_LIMIT_MAXIMUM,
1629  UCAL_LIMIT_COUNT
1630 #endif /* U_HIDE_INTERNAL_API */
1631  };
1632 
1654  virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0;
1655 
1663  virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const;
1664 
1665 
1679  virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
1680  UBool useMonth) const = 0;
1681 
1689  virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ;
1690 
1698  virtual int32_t handleGetYearLength(int32_t eyear) const;
1699 
1700 
1709  virtual int32_t handleGetExtendedYear() = 0;
1710 
1719  virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField);
1720 
1729  virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
1730 
1739  virtual void validateField(UCalendarDateFields field, UErrorCode &status);
1740 
1741 #ifndef U_HIDE_INTERNAL_API
1742 
1748  int32_t computeJulianDay();
1749 
1757  double computeMillisInDay();
1758 
1768  int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
1769 
1770 
1779  int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
1780 
1786  enum {
1788  kResolveSTOP = -1,
1790  kResolveRemap = 32
1791  };
1792 
1798  static const UFieldResolutionTable kDatePrecedence[];
1799 
1805  static const UFieldResolutionTable kYearPrecedence[];
1806 
1812  static const UFieldResolutionTable kDOWPrecedence[];
1813 
1841  UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable);
1842 #endif /* U_HIDE_INTERNAL_API */
1843 
1844 
1848  virtual const UFieldResolutionTable* getFieldResolutionTable() const;
1849 
1850 #ifndef U_HIDE_INTERNAL_API
1851 
1856  UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const;
1857 #endif /* U_HIDE_INTERNAL_API */
1858 
1859 
1860 private:
1869  int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const;
1870 
1871 
1872 protected:
1878 
1890 
1897 
1906 
1913  UDate internalGetTime(void) const { return fTime; }
1914 
1922  void internalSetTime(UDate time) { fTime = time; }
1923 
1928  int32_t fFields[UCAL_FIELD_COUNT];
1929 
1935 
1939  enum {
1940  kUnset = 0,
1941  kInternallySet,
1942  kMinimumUserStamp
1943  };
1944 
1951  int32_t fStamp[UCAL_FIELD_COUNT];
1952 
1977  virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
1978 
1979 #ifndef U_HIDE_INTERNAL_API
1980 
1985  int32_t getGregorianYear() const {
1986  return fGregorianYear;
1987  }
1988 
1994  int32_t getGregorianMonth() const {
1995  return fGregorianMonth;
1996  }
1997 
2003  int32_t getGregorianDayOfYear() const {
2004  return fGregorianDayOfYear;
2005  }
2006 
2012  int32_t getGregorianDayOfMonth() const {
2013  return fGregorianDayOfMonth;
2014  }
2015 #endif /* U_HIDE_INTERNAL_API */
2016 
2023  virtual int32_t getDefaultMonthInYear(int32_t eyear) ;
2024 
2025 
2033  virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
2034 
2035  //-------------------------------------------------------------------------
2036  // Protected utility methods for use by subclasses. These are very handy
2037  // for implementing add, roll, and computeFields.
2038  //-------------------------------------------------------------------------
2039 
2069  virtual void pinField(UCalendarDateFields field, UErrorCode& status);
2070 
2114  int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2115 
2116 
2117 #ifndef U_HIDE_INTERNAL_API
2118 
2148  inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2149 
2154  int32_t getLocalDOW();
2155 #endif /* U_HIDE_INTERNAL_API */
2156 
2157 private:
2158 
2162  int32_t fNextStamp;// = MINIMUM_USER_STAMP;
2163 
2168  void recalculateStamp();
2169 
2173  UDate fTime;
2174 
2178  UBool fLenient;
2179 
2184  TimeZone* fZone;
2185 
2190  UCalendarWallTimeOption fRepeatedWallTime;
2191 
2196  UCalendarWallTimeOption fSkippedWallTime;
2197 
2206  UCalendarDaysOfWeek fFirstDayOfWeek;
2207  uint8_t fMinimalDaysInFirstWeek;
2208  UCalendarDaysOfWeek fWeekendOnset;
2209  int32_t fWeekendOnsetMillis;
2210  UCalendarDaysOfWeek fWeekendCease;
2211  int32_t fWeekendCeaseMillis;
2212 
2223  void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success);
2224 
2234  void updateTime(UErrorCode& status);
2235 
2241  int32_t fGregorianYear;
2242 
2248  int32_t fGregorianMonth;
2249 
2255  int32_t fGregorianDayOfYear;
2256 
2262  int32_t fGregorianDayOfMonth;
2263 
2264  /* calculations */
2265 
2272  void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
2273 
2274 protected:
2275 
2283  void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
2284 
2285 private:
2286 
2307  void computeWeekFields(UErrorCode &ec);
2308 
2309 
2318  void validateFields(UErrorCode &status);
2319 
2328  void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
2329 
2330  protected:
2331 #ifndef U_HIDE_INTERNAL_API
2332 
2341  static uint8_t julianDayToDayOfWeek(double julian);
2342 #endif /* U_HIDE_INTERNAL_API */
2343 
2344  private:
2345  char validLocale[ULOC_FULLNAME_CAPACITY];
2346  char actualLocale[ULOC_FULLNAME_CAPACITY];
2347 
2348  public:
2349 #if !UCONFIG_NO_SERVICE
2350 
2354 #ifndef U_HIDE_INTERNAL_API
2355 
2361  static StringEnumeration* getAvailableLocales(void);
2362 
2376  static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status);
2377 
2393  static UBool unregister(URegistryKey key, UErrorCode& status);
2394 #endif /* U_HIDE_INTERNAL_API */
2395 
2400  friend class CalendarFactory;
2401 
2406  friend class CalendarService;
2407 
2412  friend class DefaultCalendarFactory;
2413 #endif /* !UCONFIG_NO_SERVICE */
2414 
2419  virtual UBool haveDefaultCentury() const = 0;
2420 
2425  virtual UDate defaultCenturyStart() const = 0;
2430  virtual int32_t defaultCenturyStartYear() const = 0;
2431 
2438  Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const;
2439 
2445  virtual int32_t getRelatedYear(UErrorCode &status) const;
2446 
2452  virtual void setRelatedYear(int32_t year);
2453 
2454 #ifndef U_HIDE_INTERNAL_API
2455 
2461  const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
2462 #endif /* U_HIDE_INTERNAL_API */
2463 
2464 private:
2469  BasicTimeZone* getBasicTimeZone() const;
2470 
2478  UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const;
2479 
2480 public:
2481 #ifndef U_HIDE_INTERNAL_API
2482 
2490  static Calendar * U_EXPORT2 makeInstance(
2491  const Locale &locale, UErrorCode &status);
2492 
2503  static void U_EXPORT2 getCalendarTypeFromLocale(
2504  const Locale &locale,
2505  char *typeBuffer,
2506  int32_t typeBufferSize,
2507  UErrorCode &status);
2508 #endif /* U_HIDE_INTERNAL_API */
2509 };
2510 
2511 // -------------------------------------
2512 
2513 inline Calendar*
2514 Calendar::createInstance(TimeZone* zone, UErrorCode& errorCode)
2515 {
2516  // since the Locale isn't specified, use the default locale
2517  return createInstance(zone, Locale::getDefault(), errorCode);
2518 }
2519 
2520 // -------------------------------------
2521 
2522 inline void
2523 Calendar::roll(UCalendarDateFields field, UBool up, UErrorCode& status)
2524 {
2525  roll(field, (int32_t)(up ? +1 : -1), status);
2526 }
2527 
2528 #ifndef U_HIDE_DEPRECATED_API
2529 inline void
2530 Calendar::roll(EDateFields field, UBool up, UErrorCode& status)
2531 {
2532  roll((UCalendarDateFields) field, up, status);
2533 }
2534 #endif /* U_HIDE_DEPRECATED_API */
2535 
2536 
2537 // -------------------------------------
2538 
2544 inline void
2545 Calendar::internalSet(UCalendarDateFields field, int32_t value)
2546 {
2547  fFields[field] = value;
2548  fStamp[field] = kInternallySet;
2549  fIsSet[field] = TRUE; // Remove later
2550 }
2551 
2552 
2553 #ifndef U_HIDE_INTERNAL_API
2554 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2555 {
2556  return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
2557 }
2558 #endif /* U_HIDE_INTERNAL_API */
2559 
2561 
2562 #endif /* #if !UCONFIG_NO_FORMATTING */
2563 
2564 #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:1913
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
Definition: calendar.h:215
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:1560
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:93
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:282
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:1623
#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:920
UBool fAreAllFieldsSet
True if all of the fields have been set.
Definition: calendar.h:1896
UBool fIsTimeSet
The flag which indicates if the current time is set in the calendar.
Definition: calendar.h:1877
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
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:1574
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
EAmpm
Useful constants for hour in 12-hour clock.
Definition: calendar.h:302
int32_t getGregorianYear() const
Return the extended year on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1985
void setTime(UDate date, UErrorCode &status)
Sets this Calendar's current time with the given UDate.
Definition: calendar.h:468
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:36
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:240
int32_t getGregorianDayOfMonth() const
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:2012
EDaysOfWeek
Useful constant for days of week.
Definition: calendar.h:268
UDate getTime(UErrorCode &status) const
Gets this Calendar's time as milliseconds.
Definition: calendar.h:456
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:2003
#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:1994
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:1905
C++ API: Locale ID object.
EDateFields
Field IDs for date and time.
Definition: calendar.h:224
void internalSetTime(UDate time)
Set the current time without affecting flags or fields.
Definition: calendar.h:1922
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:491
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
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:1584
UBool fAreFieldsSet
True if the fields are in sync with the currently set time of this Calendar.
Definition: calendar.h:1889
int8_t UBool
The ICU boolean type.
Definition: umachine.h:236
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:188