1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 28393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius* Copyright (C) 1997-2013, International Business Machines Corporation and others. 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* All Rights Reserved. 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* File GREGOCAL.H 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Modification History: 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Date Name Description 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 04/22/97 aliu Overhauled header. 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 07/28/98 stephen Sync with JDK 1.2 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 09/04/98 stephen Re-sync with JDK 8/31 putback 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 09/14/98 stephen Changed type of kOneDay, kOneWeek to double. 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Fixed bug in roll() 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 10/15/99 aliu Fixed j31, incorrect WEEK_OF_YEAR computation. 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Added documentation of WEEK_OF_YEAR computation. 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 10/15/99 aliu Fixed j32, cannot set date to Feb 29 2000 AD. 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* {JDK bug 4210209 4209272} 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 11/07/2003 srl Update, clean up documentation. 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef GREGOCAL_H 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define GREGOCAL_H 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/calendar.h" 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Concrete class which provides the standard calendar. 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Concrete class which provides the standard calendar used by most of the world. 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The standard (Gregorian) calendar has 2 eras, BC and AD. 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This implementation handles a single discontinuity, which corresponds by default to 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the date the Gregorian calendar was originally instituted (October 15, 1582). Not all 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * countries adopted the Gregorian calendar then, so this cutover date may be changed by 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the caller. 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Prior to the institution of the Gregorian Calendar, New Year's Day was March 25. To 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * avoid confusion, this Calendar always uses January 1. A manual adjustment may be made 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if desired for dates that are prior to the Gregorian changeover and which fall 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * between January 1 and March 24. 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Values calculated for the <code>WEEK_OF_YEAR</code> field range from 1 to 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 53. Week 1 for a year is the first week that contains at least 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getMinimalDaysInFirstWeek()</code> days from that year. It thus 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * depends on the values of <code>getMinimalDaysInFirstWeek()</code>, 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getFirstDayOfWeek()</code>, and the day of the week of January 1. 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Weeks between week 1 of one year and week 1 of the following year are 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * numbered sequentially from 2 to 52 or 53 (as needed). 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>For example, January 1, 1998 was a Thursday. If 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getFirstDayOfWeek()</code> is <code>MONDAY</code> and 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getMinimalDaysInFirstWeek()</code> is 4 (these are the values 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * reflecting ISO 8601 and many national standards), then week 1 of 1998 starts 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * on December 29, 1997, and ends on January 4, 1998. If, however, 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getFirstDayOfWeek()</code> is <code>SUNDAY</code>, then week 1 of 1998 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * starts on January 4, 1998, and ends on January 10, 1998; the first three days 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of 1998 then are part of week 53 of 1997. 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Example for using GregorianCalendar: 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \code 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // get the supported ids for GMT-08:00 (Pacific Standard Time) 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UErrorCode success = U_ZERO_ERROR; 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * const StringEnumeration *ids = TimeZone::createEnumeration(-8 * 60 * 60 * 1000); 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // if no ids were returned, something is wrong. get out. 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if (ids == 0 || ids->count(success) == 0) { 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return; 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * } 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // begin output 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cout << "Current Time" << endl; 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // create a Pacific Standard Time time zone 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids->unext(NULL, success))); 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // set up rules for daylight savings time 9085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * pdt->setStartRule(UCAL_MARCH, 1, UCAL_SUNDAY, 2 * 60 * 60 * 1000); 9185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * pdt->setEndRule(UCAL_NOVEMBER, 2, UCAL_SUNDAY, 2 * 60 * 60 * 1000); 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // create a GregorianCalendar with the Pacific Daylight time zone 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // and the current date and time 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Calendar* calendar = new GregorianCalendar( pdt, success ); 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // print out a bunch of interesting things 9885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "ERA: " << calendar->get( UCAL_ERA, success ) << endl; 9985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "YEAR: " << calendar->get( UCAL_YEAR, success ) << endl; 10085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "MONTH: " << calendar->get( UCAL_MONTH, success ) << endl; 10185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "WEEK_OF_YEAR: " << calendar->get( UCAL_WEEK_OF_YEAR, success ) << endl; 10285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "WEEK_OF_MONTH: " << calendar->get( UCAL_WEEK_OF_MONTH, success ) << endl; 10385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DATE: " << calendar->get( UCAL_DATE, success ) << endl; 10485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_MONTH: " << calendar->get( UCAL_DAY_OF_MONTH, success ) << endl; 10585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_YEAR: " << calendar->get( UCAL_DAY_OF_YEAR, success ) << endl; 10685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_WEEK: " << calendar->get( UCAL_DAY_OF_WEEK, success ) << endl; 10785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( UCAL_DAY_OF_WEEK_IN_MONTH, success ) << endl; 10885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "AM_PM: " << calendar->get( UCAL_AM_PM, success ) << endl; 10985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "HOUR: " << calendar->get( UCAL_HOUR, success ) << endl; 11085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "HOUR_OF_DAY: " << calendar->get( UCAL_HOUR_OF_DAY, success ) << endl; 11185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "MINUTE: " << calendar->get( UCAL_MINUTE, success ) << endl; 11285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "SECOND: " << calendar->get( UCAL_SECOND, success ) << endl; 11385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "MILLISECOND: " << calendar->get( UCAL_MILLISECOND, success ) << endl; 11485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "ZONE_OFFSET: " << (calendar->get( UCAL_ZONE_OFFSET, success )/(60*60*1000)) << endl; 11585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DST_OFFSET: " << (calendar->get( UCAL_DST_OFFSET, success )/(60*60*1000)) << endl; 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cout << "Current Time, with hour reset to 3" << endl; 11885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * calendar->clear(UCAL_HOUR_OF_DAY); // so doesn't override 11985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * calendar->set(UCAL_HOUR, 3); 12085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "ERA: " << calendar->get( UCAL_ERA, success ) << endl; 12185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "YEAR: " << calendar->get( UCAL_YEAR, success ) << endl; 12285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "MONTH: " << calendar->get( UCAL_MONTH, success ) << endl; 12385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "WEEK_OF_YEAR: " << calendar->get( UCAL_WEEK_OF_YEAR, success ) << endl; 12485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "WEEK_OF_MONTH: " << calendar->get( UCAL_WEEK_OF_MONTH, success ) << endl; 12585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DATE: " << calendar->get( UCAL_DATE, success ) << endl; 12685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_MONTH: " << calendar->get( UCAL_DAY_OF_MONTH, success ) << endl; 12785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_YEAR: " << calendar->get( UCAL_DAY_OF_YEAR, success ) << endl; 12885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_WEEK: " << calendar->get( UCAL_DAY_OF_WEEK, success ) << endl; 12985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( UCAL_DAY_OF_WEEK_IN_MONTH, success ) << endl; 13085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "AM_PM: " << calendar->get( UCAL_AM_PM, success ) << endl; 13185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "HOUR: " << calendar->get( UCAL_HOUR, success ) << endl; 13285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "HOUR_OF_DAY: " << calendar->get( UCAL_HOUR_OF_DAY, success ) << endl; 13385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "MINUTE: " << calendar->get( UCAL_MINUTE, success ) << endl; 13485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "SECOND: " << calendar->get( UCAL_SECOND, success ) << endl; 13585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "MILLISECOND: " << calendar->get( UCAL_MILLISECOND, success ) << endl; 13685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "ZONE_OFFSET: " << (calendar->get( UCAL_ZONE_OFFSET, success )/(60*60*1000)) << endl; // in hours 13785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "DST_OFFSET: " << (calendar->get( UCAL_DST_OFFSET, success )/(60*60*1000)) << endl; // in hours 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if (U_FAILURE(success)) { 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cout << "An error occured. success=" << u_errorName(success) << endl; 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * } 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * delete ids; 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * delete calendar; // also deletes pdt 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \endcode 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API GregorianCalendar: public Calendar { 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Useful constants for GregorianCalendar and TimeZone. 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru enum EEras { 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru BC, 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru AD 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru }; 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a default GregorianCalendar using the current time in the default time 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * zone with the default locale. 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(UErrorCode& success); 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar based on the current time in the given time zone 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * with the default locale. Clients are no longer responsible for deleting the given 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * time zone object after it's adopted. 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param zoneToAdopt The given timezone. 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(TimeZone* zoneToAdopt, UErrorCode& success); 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar based on the current time in the given time zone 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * with the default locale. 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param zone The given timezone. 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(const TimeZone& zone, UErrorCode& success); 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar based on the current time in the default time zone 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * with the given locale. 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param aLocale The given locale. 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(const Locale& aLocale, UErrorCode& success); 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar based on the current time in the given time zone 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * with the given locale. Clients are no longer responsible for deleting the given 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * time zone object after it's adopted. 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param zoneToAdopt The given timezone. 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param aLocale The given locale. 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success); 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar based on the current time in the given time zone 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * with the given locale. 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param zone The given timezone. 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param aLocale The given locale. 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success); 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar with the given AD date set in the default time 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * zone with the default locale. 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param year The value used to set the YEAR time field in the calendar. 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param month The value used to set the MONTH time field in the calendar. Month 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value is 0-based. e.g., 0 for January. 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param date The value used to set the DATE time field in the calendar. 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(int32_t year, int32_t month, int32_t date, UErrorCode& success); 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar with the given AD date and time set for the 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * default time zone with the default locale. 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param year The value used to set the YEAR time field in the calendar. 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param month The value used to set the MONTH time field in the calendar. Month 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value is 0-based. e.g., 0 for January. 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param date The value used to set the DATE time field in the calendar. 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param hour The value used to set the HOUR_OF_DAY time field in the calendar. 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param minute The value used to set the MINUTE time field in the calendar. 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, UErrorCode& success); 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constructs a GregorianCalendar with the given AD date and time set for the 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * default time zone with the default locale. 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param year The value used to set the YEAR time field in the calendar. 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param month The value used to set the MONTH time field in the calendar. Month 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value is 0-based. e.g., 0 for January. 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param date The value used to set the DATE time field in the calendar. 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param hour The value used to set the HOUR_OF_DAY time field in the calendar. 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param minute The value used to set the MINUTE time field in the calendar. 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param second The value used to set the SECOND time field in the calendar. 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Indicates the status of GregorianCalendar object construction. 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns U_ZERO_ERROR if constructed successfully. 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second, UErrorCode& success); 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Destructor 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~GregorianCalendar(); 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Copy constructor 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param source the object to be copied. 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(const GregorianCalendar& source); 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Default assignment operator 292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param right the object to be copied. 293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar& operator=(const GregorianCalendar& right); 296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create and return a polymorphic copy of this calendar. 299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return return a polymorphic copy of this calendar. 300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual Calendar* clone(void) const; 303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the GregorianCalendar change date. This is the point when the switch from 306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October 307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 15, 1582. Previous to this time and date will be Julian dates. 308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param date The given Gregorian cutover date. 310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Output param set to success/failure code on exit. 311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setGregorianChange(UDate date, UErrorCode& success); 314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Gets the Gregorian Calendar change date. This is the point when the switch from 317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October 318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 15, 1582. Previous to this time and date will be Julian dates. 319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The Gregorian cutover time for this calendar. 321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UDate getGregorianChange(void) const; 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return true if the given year is a leap year. Determination of whether a year is 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a leap year is actually very complicated. We do something crude and mostly 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * correct here, but for a real determination you need a lot of contextual 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * information. For example, in Sweden, the change from Julian to Gregorian happened 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in a complex way resulting in missed leap years and double leap years between 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1700 and 1753. Another example is that after the start of the Julian calendar in 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 45 B.C., the leap years did not regularize until 8 A.D. This method ignores these 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * quirks, and pays attention only to the Julian onset date and the Gregorian 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cutover (which can be changed). 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param year The given year. 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return True if the given year is a leap year; false otherwise. 338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isLeapYear(int32_t year) const; 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns TRUE if the given Calendar object is equivalent to this 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * one. Calendar override. 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param other the Calendar to be compared with this Calendar 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool isEquivalentTo(const Calendar& other) const; 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (Overrides Calendar) Rolls up or down by the given amount in the specified field. 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For more information, see the documentation for Calendar::roll(). 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field The time field. 356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param amount Indicates amount to roll. 357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on exit. If any value 358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * previously set in the time field is invalid, this will be set to 359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * an error status. 360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void roll(EDateFields field, int32_t amount, UErrorCode& status); 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (Overrides Calendar) Rolls up or down by the given amount in the specified field. 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For more information, see the documentation for Calendar::roll(). 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field The time field. 369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param amount Indicates amount to roll. 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on exit. If any value 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * previously set in the time field is invalid, this will be set to 372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * an error status. 373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.6. 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status); 376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 377103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_DEPRECATED_API 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the minimum value that this field could have, given the current date. 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field the time field. 382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the minimum value that this field could have, given the current date. 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field) instead. 384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getActualMinimum(EDateFields field) const; 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the minimum value that this field could have, given the current date. 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field the time field. 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the minimum value that this field could have, given the current date. 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field) instead. (Added to ICU 3.0 for signature consistency) 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getActualMinimum(EDateFields field, UErrorCode& status) const; 396103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_DEPRECATED_API */ 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the minimum value that this field could have, given the current date. 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field the time field. 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status error result. 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the minimum value that this field could have, given the current date. 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getActualMinimum(UCalendarDateFields field, UErrorCode &status) const; 407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 408103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_DEPRECATED_API 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the maximum value that this field could have, given the current date. 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar, 413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for some years the actual maximum for MONTH is 12, and for others 13. 414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field the time field. 415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the maximum value that this field could have, given the current date. 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 2.6. Use getActualMaximum(UCalendarDateFields field) instead. 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getActualMaximum(EDateFields field) const; 419103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_DEPRECATED_API */ 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the maximum value that this field could have, given the current date. 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar, 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for some years the actual maximum for MONTH is 12, and for others 13. 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field the time field. 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status returns any errors that may result from this function call. 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the maximum value that this field could have, given the current date. 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.6 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const; 432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (Overrides Calendar) Return true if the current date for this Calendar is in 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Fill-in parameter which receives the status of this operation. 438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return True if the current date for this Calendar is in Daylight Savings Time, 439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * false, otherwise. 440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool inDaylightTime(UErrorCode& status) const; 443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual 448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * override. This method is to implement a simple version of RTTI, since not all C++ 449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call 450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this method. 451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The class ID for this object. All objects of a given class have the 453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * same class ID. Objects of other classes have different class IDs. 454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UClassID getDynamicClassID(void) const; 457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the class ID for this class. This is useful only for comparing to a return 460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value from getDynamicClassID(). For example: 461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Base* polymorphic_pointer = createPolymorphicObject(); 463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if (polymorphic_pointer->getDynamicClassID() == 464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Derived::getStaticClassID()) ... 465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The class ID for all objects of this class. 467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UClassID U_EXPORT2 getStaticClassID(void); 470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 472103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * Returns the calendar type name string for this Calendar object. 473103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * The returned string is the legacy ICU calendar attribute value, 474103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * for example, "gregorian" or "japanese". 475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 476103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * For more details see the Calendar::getType() documentation. 477103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 478103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @return legacy calendar type name string 4798393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @stable ICU 49 480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const char * getType() const; 482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: 484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GregorianCalendar(); // default constructor not implemented 485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru protected: 487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the ERA. We need a special method for this because the 489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * default ERA is AD, but a zero (unset) ERA is BC. 490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the ERA. 491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t internalGetEra() const; 494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the Julian day number of day before the first day of the 497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * given month in the given extended year. Subclasses should override 498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this method to implement their calendar system. 499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param eyear the extended year 500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param month the zero-based month, or 0 if useMonth is false 501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param useMonth if false, compute the day before the first day of 502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the given year, otherwise, compute the day before the first day of 503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the given month 504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the Julian day number of the day before the first 505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * day of the given month and year 506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, 509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool useMonth) const; 510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses may override this. This method calls 513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * handleGetMonthLength() to obtain the calendar-specific month 514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * length. 515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param bestField which field to use to calculate the date 516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return julian day specified by calendar fields. 517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField) ; 520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the number of days in the given month of the given extended 523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * year of this calendar system. Subclasses should override this 524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method if they can provide a more correct or more efficient 525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * implementation than the default implementation in Calendar. 526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const; 529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the number of days in the given extended year of this 532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * calendar system. Subclasses should override this method if they can 533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * provide a more correct or more efficient implementation than the 534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * default implementation in Calendar. 535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t handleGetYearLength(int32_t eyear) const; 538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return the length of the given month. 541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param month the given month. 542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the length of the given month. 543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t monthLength(int32_t month) const; 546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return the length of the month according to the given year. 549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param month the given month. 550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param year the given year. 551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the length of the month 552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t monthLength(int32_t month, int32_t year) const; 555103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 556103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_INTERNAL_API 557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return the length of the given year. 559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param year the given year. 560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the length of the given year. 561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t yearLength(int32_t year) const; 564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return the length of the year field. 567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the length of the year field 568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t yearLength(void) const; 571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * After adjustments such as add(MONTH), add(YEAR), we don't want the 574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * month to jump around. E.g., we don't want Jan 31 + 1 month to go to Mar 575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 3, we want it to go to Feb 28. Adjustments which might run into this 576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * problem call this method to retain the proper month. 577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void pinDayOfMonth(void); 580103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_INTERNAL_API */ 581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the day number with respect to the epoch. January 1, 1970 (Gregorian) 584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is day zero. 585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Fill-in parameter which receives the status of this operation. 586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the day number with respect to the epoch. 587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UDate getEpochDay(UErrorCode& status); 590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclass API for defining limits of different types. 593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses must implement this method to return limits for the 594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * following fields: 595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre>UCAL_ERA 597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_YEAR 598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_MONTH 599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_WEEK_OF_YEAR 600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_WEEK_OF_MONTH 601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_DATE (DAY_OF_MONTH on Java) 602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_DAY_OF_YEAR 603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_DAY_OF_WEEK_IN_MONTH 604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_YEAR_WOY 605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UCAL_EXTENDED_YEAR</pre> 606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param field one of the above field numbers 608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>, 609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code> 610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; 613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the extended year defined by the current fields. This will 616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such 617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * as UCAL_ERA) specific to the calendar system, depending on which set of 618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fields is newer. 619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the extended year 620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t handleGetExtendedYear(); 623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses may override this to convert from week fields 626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (YEAR_WOY and WEEK_OF_YEAR) to an extended year in the case 627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * where YEAR, EXTENDED_YEAR are not set. 628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The Gregorian implementation assumes a yearWoy in gregorian format, according to the current era. 629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the extended year, UCAL_EXTENDED_YEAR 630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy); 633ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 634ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 635ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses may override this method to compute several fields 637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specific to each calendar system. These are: 638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul><li>ERA 640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>YEAR 641ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>MONTH 642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>DAY_OF_MONTH 643ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>DAY_OF_YEAR 644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>EXTENDED_YEAR</ul> 645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>The GregorianCalendar implementation implements 647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a calendar with the specified Julian/Gregorian cutover date. 648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); 651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: 653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Compute the julian day number of the given year. 655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param isGregorian if true, using Gregorian calendar, otherwise using Julian calendar 656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param year the given year. 657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param isLeap true if the year is a leap year. 658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return 659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static double computeJulianDayOfYear(UBool isGregorian, int32_t year, 661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool& isLeap); 662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Validates the values of the set time fields. True if they're all valid. 665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return True if the set time fields are all valid. 666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool validateFields(void) const; 668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Validates the value of the given time field. True if it's valid. 671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool boundsCheck(int32_t value, UCalendarDateFields field) const; 673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the pseudo-time-stamp for two fields, given their 676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * individual pseudo-time-stamps. If either of the fields 677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is unset, then the aggregate is unset. Otherwise, the 678ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * aggregate is the later of the two stamps. 679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param stamp_a One given field. 680ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param stamp_b Another given field. 681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the pseudo-time-stamp for two fields 682ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t aggregateStamp(int32_t stamp_a, int32_t stamp_b); 684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The point at which the Gregorian calendar rules are used, measured in 687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * milliseconds from the standard epoch. Default is October 15, 1582 688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (Gregorian) 00:00:00 UTC, that is, October 4, 1582 (Julian) is followed 689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by October 15, 1582 (Gregorian). This corresponds to Julian day number 690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 2299161. This is measured from the standard epoch, not in Julian Days. 691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UDate fGregorianCutover; 694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Julian day number of the Gregorian cutover 697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fCutoverJulianDay; 699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 701ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Midnight, local time (using this Calendar's TimeZone) at or before the 702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * gregorianCutover. This is a pure date value with no time of day or 703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * timezone component. 704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UDate fNormalizedGregorianCutover;// = gregorianCutover; 706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The year of the gregorianCutover, with 0 representing 709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1 BC, -1 representing 2 BC, etc. 710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fGregorianCutoverYear;// = 1582; 712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The year of the gregorianCutover, with 0 representing 715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1 BC, -1 representing 2 BC, etc. 716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fGregorianCutoverJulianDay;// = 2299161; 718ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Converts time as milliseconds to Julian date. The Julian date used here is not a 721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * true Julian date, since it is measured from midnight, not noon. 722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param millis The given milliseconds. 724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The Julian date number. 725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static double millisToJulianDay(UDate millis); 727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Converts Julian date to time as milliseconds. The Julian date used here is not a 730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * true Julian date, since it is measured from midnight, not noon. 731ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param julian The given Julian date number. 733ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Time as milliseconds. 734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 735ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UDate julianDayToMillis(double julian); 736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Used by handleComputeJulianDay() and handleComputeMonthStart(). 739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Temporary field indicating whether the calendar is currently Gregorian as opposed to Julian. 740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fIsGregorian; 742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 744ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Used by handleComputeJulianDay() and handleComputeMonthStart(). 745ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Temporary field indicating that the sense of the gregorian cutover should be inverted 746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to handle certain calculations on and around the cutover date. 747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fInvertGregorian; 749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: // internal implementation 752ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return TRUE if this calendar has the notion of a default century 756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool haveDefaultCentury() const; 758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 759ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 760ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the start of the default century 762ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 763ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UDate defaultCenturyStart() const; 764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the beginning year of the default century 768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t defaultCenturyStartYear() const; 770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 771ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: 772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 773ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The system maintains a static default century start date. This is initialized 774ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the first time it is used. Before then, it is set to SYSTEM_DEFAULT_CENTURY to 775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indicate an uninitialized state. Once the system default century date and year 776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are set, they do not change. 777ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UDate fgSystemDefaultCenturyStart; 779ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * See documentation for systemDefaultCenturyStart. 782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 783ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t fgSystemDefaultCenturyStartYear; 784ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 785ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Default value that indicates the defaultCenturyStartYear is unitialized 787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t fgSystemDefaultCenturyYear; 789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 791ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Default value that indicates the UDate of the beginning of the system default century 792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const UDate fgSystemDefaultCentury; 794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 795ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the beginning date of the 100-year window that dates with 2-digit years 797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are considered to fall within. 798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the beginning date of the 100-year window that dates with 2-digit years 799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are considered to fall within. 800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UDate internalGetDefaultCenturyStart(void) const; 802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 803ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the first year of the 100-year window that dates with 2-digit years 805ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are considered to fall within. 806ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the first year of the 100-year window that dates with 2-digit years 807ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are considered to fall within. 808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t internalGetDefaultCenturyStartYear(void) const; 810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Initializes the 100-year window that dates with 2-digit years are considered 813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to fall within so that its start date is 80 years before the current time. 814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static void initializeSystemDefaultCentury(void); 816ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 817ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 818ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */ 822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // _GREGOCAL 824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof 825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 826