islamcal.h revision 85bf2e2fbc60a9f938064abc8127d61da7d19882
1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ********************************************************************************
385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Copyright (C) 2003-2009, International Business Machines Corporation
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and others. All Rights Reserved.
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ******************************************************************************
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * File ISLAMCAL.H
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Modification History:
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   Date        Name        Description
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   10/14/2003  srl         ported from java IslamicCalendar
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *****************************************************************************
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef ISLAMCAL_H
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define ISLAMCAL_H
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h"
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/calendar.h"
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>IslamicCalendar</code> is a subclass of <code>Calendar</code>
2985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * that implements the Islamic civil and religious calendars.  It
30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is used as the civil calendar in most of the Arab world and the
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * liturgical calendar of the Islamic faith worldwide.  This calendar
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is also known as the "Hijri" calendar, since it starts at the time
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of Mohammed's emigration (or "hijra") to Medinah on Thursday,
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * July 15, 622 AD (Julian).
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The Islamic calendar is strictly lunar, and thus an Islamic year of twelve
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * lunar months does not correspond to the solar year used by most other
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * calendar systems, including the Gregorian.  An Islamic year is, on average,
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * about 354 days long, so each successive Islamic year starts about 11 days
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * earlier in the corresponding Gregorian year.
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Each month of the calendar starts when the new moon's crescent is visible
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * at sunset.  However, in order to keep the time fields in this class
44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * synchronized with those of the other calendars and with local clock time,
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * we treat days and months as beginning at midnight,
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * roughly 6 hours after the corresponding sunset.
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * There are two main variants of the Islamic calendar in existence.  The first
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is the <em>civil</em> calendar, which uses a fixed cycle of alternating 29-
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and 30-day months, with a leap day added to the last month of 11 out of
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * every 30 years.  This calendar is easily calculated and thus predictable in
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * advance, so it is used as the civil calendar in a number of Arab countries.
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is the default behavior of a newly-created <code>IslamicCalendar</code>
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * object.
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The Islamic <em>religious</em> calendar, however, is based on the <em>observation</em>
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of the crescent moon.  It is thus affected by the position at which the
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * observations are made, seasonal variations in the time of sunset, the
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * eccentricities of the moon's orbit, and even the weather at the observation
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * site.  This makes it impossible to calculate in advance, and it causes the
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * start of a month in the religious calendar to differ from the civil calendar
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by up to three days.
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Using astronomical calculations for the position of the sun and moon, the
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * moon's illumination, and other factors, it is possible to determine the start
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of a lunar month with a fairly high degree of certainty.  However, these
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * calculations are extremely complicated and thus slow, so most algorithms,
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * including the one used here, are only approximations of the true astronical
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * calculations.  At present, the approximations used in this class are fairly
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * simplistic; they will be improved in later versions of the code.
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The {@link #setCivil setCivil} method determines
73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * which approach is used to determine the start of a month.  By default, the
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fixed-cycle civil calendar is used.  However, if <code>setCivil(false)</code>
75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is called, an approximation of the true lunar calendar will be used.
76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see GregorianCalendar
78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @author Laura Werner
80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @author Alan Liu
81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @author Steven R. Loomis
82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal
83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass IslamicCalendar : public Calendar {
85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public:
86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Constants...
88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Calendar type - civil or religious
91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  enum ECivil {
94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    ASTRONOMICAL,
95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    CIVIL
96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  };
97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Constants for the months
100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  enum EMonths {
103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Muharram, the 1st month of the Islamic year.
105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    MUHARRAM = 0,
108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Safar, the 2nd month of the Islamic year.
111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    SAFAR = 1,
114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Rabi' al-awwal (or Rabi' I), the 3rd month of the Islamic year.
117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    RABI_1 = 2,
120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Rabi' al-thani or (Rabi' II), the 4th month of the Islamic year.
123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    RABI_2 = 3,
126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Jumada al-awwal or (Jumada I), the 5th month of the Islamic year.
129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    JUMADA_1 = 4,
132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Jumada al-thani or (Jumada II), the 6th month of the Islamic year.
135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    JUMADA_2 = 5,
138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Rajab, the 7th month of the Islamic year.
141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    RAJAB = 6,
144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Sha'ban, the 8th month of the Islamic year.
147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    SHABAN = 7,
150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Ramadan, the 9th month of the Islamic year.
153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    RAMADAN = 8,
156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Shawwal, the 10th month of the Islamic year.
159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    SHAWWAL = 9,
162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Dhu al-Qi'dah, the 11th month of the Islamic year.
165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DHU_AL_QIDAH = 10,
168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constant for Dhu al-Hijjah, the 12th month of the Islamic year.
171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DHU_AL_HIJJAH = 11,
174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    ISLAMIC_MONTH_MAX
176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  };
177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Constructors...
182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Constructs an IslamicCalendar based on the current time in the default time zone
186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * with the given locale.
187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param aLocale  The given locale.
189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param success  Indicates the status of IslamicCalendar object construction.
190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *                 Returns U_ZERO_ERROR if constructed successfully.
191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param beCivil  Whether the calendar should be civil (default-TRUE) or religious (FALSE)
192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  IslamicCalendar(const Locale& aLocale, UErrorCode &success, ECivil beCivil = CIVIL);
195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Copy Constructor
198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  IslamicCalendar(const IslamicCalendar& other);
201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Destructor.
204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual ~IslamicCalendar();
207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Determines whether this object uses the fixed-cycle Islamic civil calendar
210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * or an approximation of the religious, astronomical calendar.
211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param beCivil   <code>CIVIL</code> to use the civil calendar,
213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *                  <code>ASTRONOMICAL</code> to use the astronomical calendar.
214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  void setCivil(ECivil beCivil, UErrorCode &status);
217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Returns <code>true</code> if this object is using the fixed-cycle civil
220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * calendar, or <code>false</code> if using the religious, astronomical
221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * calendar.
222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  UBool isCivil();
225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // TODO: copy c'tor, etc
228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // clone
230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual Calendar* clone() const;
231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private:
233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Determine whether a year is a leap year in the Islamic civil calendar
235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  static UBool civilLeapYear(int32_t year);
237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Return the day # on which the given year starts.  Days are counted
240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * from the Hijri epoch, origin 0.
241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  int32_t yearStart(int32_t year);
243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Return the day # on which the given month starts.  Days are counted
246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * from the Hijri epoch, origin 0.
247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param year  The hijri year
249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param year  The hijri month, 0-based
250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  int32_t monthStart(int32_t year, int32_t month) const;
252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Find the day number on which a particular month of the true/lunar
255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Islamic calendar starts.
256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param month The month in question, origin 0 from the Hijri epoch
258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @return The day number on which the given month starts.
260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  int32_t trueMonthStart(int32_t month) const;
262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Return the "age" of the moon at the given time; this is the difference
265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * in ecliptic latitude between the moon and the sun.  This method simply
266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * calls CalendarAstronomer.moonAge, converts to degrees,
267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * and adjusts the resultto be in the range [-180, 180].
268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param time  The time at which the moon's age is desired,
270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *              in millis since 1/1/1970.
271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
27285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho  static double moonAge(UDate time, UErrorCode &status);
273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Internal data....
276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //
277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * <code>CIVIL</code> if this object uses the fixed-cycle Islamic civil calendar,
280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * and <code>ASTRONOMICAL</code> if it approximates the true religious calendar using
281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * astronomical calculations for the time of the new moon.
282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  ECivil civil;
284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //----------------------------------------------------------------------
286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Calendar framework
287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //----------------------------------------------------------------------
288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru protected:
289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Return the length (in days) of the given month.
296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param year  The hijri year
298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param year  The hijri month, 0-based
299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const;
302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Return the number of days in the given Islamic year
305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual int32_t handleGetYearLength(int32_t extendedYear) const;
308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Functions for converting from field values to milliseconds....
311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Return JD of start of given month/year
314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const;
318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Functions for converting from milliseconds to field values
321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  //-------------------------------------------------------------------------
322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual int32_t handleGetExtendedYear();
327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Override Calendar to compute several fields specific to the Islamic
330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * calendar system.  These are:
331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * <ul><li>ERA
333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * <li>YEAR
334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * <li>MONTH
335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * <li>DAY_OF_MONTH
336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * <li>DAY_OF_YEAR
337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * <li>EXTENDED_YEAR</ul>
338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * The DAY_OF_WEEK and DOW_LOCAL fields are already set when this
340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * method is called. The getGregorianXxx() methods return Gregorian
341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * calendar equivalents for the given Julian day.
342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // UObject stuff
347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public:
348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @return   The class ID for this object. All objects of a given class have the
350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *           same class ID. Objects of other classes have different class IDs.
351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual UClassID getDynamicClassID(void) const;
354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Return the class ID for this class. This is useful only for comparing to a return
357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * value from getDynamicClassID(). For example:
358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *      Base* polymorphic_pointer = createPolymorphicObject();
360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *      if (polymorphic_pointer->getDynamicClassID() ==
361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *          Derived::getStaticClassID()) ...
362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @return   The class ID for all objects of this class.
364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);
367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * return the calendar type, "buddhist".
370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @return calendar type
372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual const char * getType() const;
375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private:
377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  IslamicCalendar(); // default constructor not implemented
378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  // Default century.
380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru protected:
381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * (Overrides Calendar) Return true if the current date for this Calendar is in
384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Daylight Savings Time. Recognizes DST_OFFSET, if it is set.
385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *
386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @param status Fill-in parameter which receives the status of this operation.
387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @return   True if the current date for this Calendar is in Daylight Savings Time,
388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   *           false, otherwise.
389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual UBool inDaylightTime(UErrorCode& status) const;
392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Returns TRUE because the Islamic Calendar does have a default century
396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual UBool haveDefaultCentury() const;
399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Returns the date of the start of the default century
402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @return start of century - in milliseconds since epoch, 1970
403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual UDate defaultCenturyStart() const;
406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Returns the year in which the default century begins
409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @internal
410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  virtual int32_t defaultCenturyStartYear() const;
412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: // default century stuff.
414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * The system maintains a static default century start date.  This is initialized
416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * the first time it is used.  Before then, it is set to SYSTEM_DEFAULT_CENTURY to
417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * indicate an uninitialized state.  Once the system default century date and year
418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * are set, they do not change.
419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  static UDate         fgSystemDefaultCenturyStart;
421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * See documentation for systemDefaultCenturyStart.
424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  static int32_t          fgSystemDefaultCenturyStartYear;
426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Default value that indicates the defaultCenturyStartYear is unitialized
429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  static const int32_t    fgSystemDefaultCenturyYear;
431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * start of default century, as a date
434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  static const UDate        fgSystemDefaultCentury;
436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Returns the beginning date of the 100-year window that dates
439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * with 2-digit years are considered to fall within.
440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  UDate         internalGetDefaultCenturyStart(void) const;
442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Returns the first year of the 100-year window that dates with
445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * 2-digit years are considered to fall within.
446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  int32_t          internalGetDefaultCenturyStartYear(void) const;
448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  /**
450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * Initializes the 100-year window that dates with 2-digit years
451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * are considered to fall within so that its start date is 80 years
452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * before the current time.
453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   */
454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  static void  initializeSystemDefaultCentury(void);
455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif
460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif
461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
464