+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
-* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* Copyright (C) 1997-2013, International Business Machines Corporation and others.
* All Rights Reserved.
********************************************************************************
*
* \brief C++ API: Concrete class which provides the standard calendar.
*/
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids->unext(NULL, success)));
*
* // set up rules for daylight savings time
- * pdt->setStartRule(Calendar::APRIL, 1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
- * pdt->setEndRule(Calendar::OCTOBER, -1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
+ * pdt->setStartRule(UCAL_MARCH, 1, UCAL_SUNDAY, 2 * 60 * 60 * 1000);
+ * pdt->setEndRule(UCAL_NOVEMBER, 2, UCAL_SUNDAY, 2 * 60 * 60 * 1000);
*
* // create a GregorianCalendar with the Pacific Daylight time zone
* // and the current date and time
* Calendar* calendar = new GregorianCalendar( pdt, success );
*
* // print out a bunch of interesting things
- * cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
- * cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
- * cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
- * cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
- * cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
- * cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
- * cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
- * cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
- * cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
- * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
- * cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
- * cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
- * cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
- * cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
- * cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
- * cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
- * cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl;
- * cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl;
+ * cout << "ERA: " << calendar->get( UCAL_ERA, success ) << endl;
+ * cout << "YEAR: " << calendar->get( UCAL_YEAR, success ) << endl;
+ * cout << "MONTH: " << calendar->get( UCAL_MONTH, success ) << endl;
+ * cout << "WEEK_OF_YEAR: " << calendar->get( UCAL_WEEK_OF_YEAR, success ) << endl;
+ * cout << "WEEK_OF_MONTH: " << calendar->get( UCAL_WEEK_OF_MONTH, success ) << endl;
+ * cout << "DATE: " << calendar->get( UCAL_DATE, success ) << endl;
+ * cout << "DAY_OF_MONTH: " << calendar->get( UCAL_DAY_OF_MONTH, success ) << endl;
+ * cout << "DAY_OF_YEAR: " << calendar->get( UCAL_DAY_OF_YEAR, success ) << endl;
+ * cout << "DAY_OF_WEEK: " << calendar->get( UCAL_DAY_OF_WEEK, success ) << endl;
+ * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( UCAL_DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ * cout << "AM_PM: " << calendar->get( UCAL_AM_PM, success ) << endl;
+ * cout << "HOUR: " << calendar->get( UCAL_HOUR, success ) << endl;
+ * cout << "HOUR_OF_DAY: " << calendar->get( UCAL_HOUR_OF_DAY, success ) << endl;
+ * cout << "MINUTE: " << calendar->get( UCAL_MINUTE, success ) << endl;
+ * cout << "SECOND: " << calendar->get( UCAL_SECOND, success ) << endl;
+ * cout << "MILLISECOND: " << calendar->get( UCAL_MILLISECOND, success ) << endl;
+ * cout << "ZONE_OFFSET: " << (calendar->get( UCAL_ZONE_OFFSET, success )/(60*60*1000)) << endl;
+ * cout << "DST_OFFSET: " << (calendar->get( UCAL_DST_OFFSET, success )/(60*60*1000)) << endl;
*
* cout << "Current Time, with hour reset to 3" << endl;
- * calendar->clear(Calendar::HOUR_OF_DAY); // so doesn't override
- * calendar->set(Calendar::HOUR, 3);
- * cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
- * cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
- * cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
- * cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
- * cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
- * cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
- * cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
- * cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
- * cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
- * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
- * cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
- * cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
- * cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
- * cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
- * cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
- * cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
- * cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl; // in hours
- * cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ * calendar->clear(UCAL_HOUR_OF_DAY); // so doesn't override
+ * calendar->set(UCAL_HOUR, 3);
+ * cout << "ERA: " << calendar->get( UCAL_ERA, success ) << endl;
+ * cout << "YEAR: " << calendar->get( UCAL_YEAR, success ) << endl;
+ * cout << "MONTH: " << calendar->get( UCAL_MONTH, success ) << endl;
+ * cout << "WEEK_OF_YEAR: " << calendar->get( UCAL_WEEK_OF_YEAR, success ) << endl;
+ * cout << "WEEK_OF_MONTH: " << calendar->get( UCAL_WEEK_OF_MONTH, success ) << endl;
+ * cout << "DATE: " << calendar->get( UCAL_DATE, success ) << endl;
+ * cout << "DAY_OF_MONTH: " << calendar->get( UCAL_DAY_OF_MONTH, success ) << endl;
+ * cout << "DAY_OF_YEAR: " << calendar->get( UCAL_DAY_OF_YEAR, success ) << endl;
+ * cout << "DAY_OF_WEEK: " << calendar->get( UCAL_DAY_OF_WEEK, success ) << endl;
+ * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( UCAL_DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ * cout << "AM_PM: " << calendar->get( UCAL_AM_PM, success ) << endl;
+ * cout << "HOUR: " << calendar->get( UCAL_HOUR, success ) << endl;
+ * cout << "HOUR_OF_DAY: " << calendar->get( UCAL_HOUR_OF_DAY, success ) << endl;
+ * cout << "MINUTE: " << calendar->get( UCAL_MINUTE, success ) << endl;
+ * cout << "SECOND: " << calendar->get( UCAL_SECOND, success ) << endl;
+ * cout << "MILLISECOND: " << calendar->get( UCAL_MILLISECOND, success ) << endl;
+ * cout << "ZONE_OFFSET: " << (calendar->get( UCAL_ZONE_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ * cout << "DST_OFFSET: " << (calendar->get( UCAL_DST_OFFSET, success )/(60*60*1000)) << endl; // in hours
*
* if (U_FAILURE(success)) {
* cout << "An error occured. success=" << u_errorName(success) << endl;
*/
virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
+#ifndef U_HIDE_DEPRECATED_API
/**
* Return the minimum value that this field could have, given the current date.
* For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum().
* @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field) instead. (Added to ICU 3.0 for signature consistency)
*/
int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
+#endif /* U_HIDE_DEPRECATED_API */
/**
* Return the minimum value that this field could have, given the current date.
*/
int32_t getActualMinimum(UCalendarDateFields field, UErrorCode &status) const;
+#ifndef U_HIDE_DEPRECATED_API
/**
* Return the maximum value that this field could have, given the current date.
* For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual
* @deprecated ICU 2.6. Use getActualMaximum(UCalendarDateFields field) instead.
*/
int32_t getActualMaximum(EDateFields field) const;
+#endif /* U_HIDE_DEPRECATED_API */
/**
* Return the maximum value that this field could have, given the current date.
static UClassID U_EXPORT2 getStaticClassID(void);
/**
- * Get the calendar type, "gregorian", for use in DateFormatSymbols.
+ * Returns the calendar type name string for this Calendar object.
+ * The returned string is the legacy ICU calendar attribute value,
+ * for example, "gregorian" or "japanese".
*
- * @return calendar type
- * @internal
+ * For more details see the Calendar::getType() documentation.
+ *
+ * @return legacy calendar type name string
+ * @stable ICU 49
*/
virtual const char * getType() const;
-protected:
-
- /**
- * (Overrides Calendar) Converts GMT as milliseconds to time field values.
- * @param status Fill-in parameter which receives the status of this operation.
- * @stable ICU 2.0
- */
-
private:
GregorianCalendar(); // default constructor not implemented
* @internal
*/
virtual int32_t monthLength(int32_t month, int32_t year) const;
-
+
+#ifndef U_HIDE_INTERNAL_API
/**
* return the length of the given year.
* @param year the given year.
* @internal
*/
void pinDayOfMonth(void);
+#endif /* U_HIDE_INTERNAL_API */
/**
* Return the day number with respect to the epoch. January 1, 1970 (Gregorian)
* (Gregorian) 00:00:00 UTC, that is, October 4, 1582 (Julian) is followed
* by October 15, 1582 (Gregorian). This corresponds to Julian day number
* 2299161. This is measured from the standard epoch, not in Julian Days.
- * @internal
*/
UDate fGregorianCutover;
public: // internal implementation
/**
- * @internal
* @return TRUE if this calendar has the notion of a default century
+ * @internal
*/
virtual UBool haveDefaultCentury() const;
/**
- * @internal
* @return the start of the default century
+ * @internal
*/
virtual UDate defaultCenturyStart() const;
/**
- * @internal
* @return the beginning year of the default century
+ * @internal
*/
virtual int32_t defaultCenturyStartYear() const;
-
- private:
- /**
- * The system maintains a static default century start date. This is initialized
- * the first time it is used. Before then, it is set to SYSTEM_DEFAULT_CENTURY to
- * indicate an uninitialized state. Once the system default century date and year
- * are set, they do not change.
- */
- static UDate fgSystemDefaultCenturyStart;
-
- /**
- * See documentation for systemDefaultCenturyStart.
- */
- static int32_t fgSystemDefaultCenturyStartYear;
-
- /**
- * Default value that indicates the defaultCenturyStartYear is unitialized
- */
- static const int32_t fgSystemDefaultCenturyYear;
-
- /**
- * Default value that indicates the UDate of the beginning of the system default century
- */
- static const UDate fgSystemDefaultCentury;
-
- /**
- * Returns the beginning date of the 100-year window that dates with 2-digit years
- * are considered to fall within.
- * @return the beginning date of the 100-year window that dates with 2-digit years
- * are considered to fall within.
- */
- UDate internalGetDefaultCenturyStart(void) const;
-
- /**
- * Returns the first year of the 100-year window that dates with 2-digit years
- * are considered to fall within.
- * @return the first year of the 100-year window that dates with 2-digit years
- * are considered to fall within.
- */
- int32_t internalGetDefaultCenturyStartYear(void) const;
-
- /**
- * Initializes the 100-year window that dates with 2-digit years are considered
- * to fall within so that its start date is 80 years before the current time.
- */
- static void initializeSystemDefaultCentury(void);
-
};
U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
#endif /* #if !UCONFIG_NO_FORMATTING */