]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/islamcal.h
ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / islamcal.h
index fbcd9511a9f5cfb56b4a707f5bd0c0c9b27e486d..75f9656de94ce2ccdb50e79e834b7e1f4db936e8 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2003-2004, International Business Machines Corporation
+ ********************************************************************************
+ * Copyright (C) 2003-2013, International Business Machines Corporation
  * and others. All Rights Reserved.
  ******************************************************************************
  *
@@ -25,7 +26,7 @@ U_NAMESPACE_BEGIN
 
 /**
  * <code>IslamicCalendar</code> is a subclass of <code>Calendar</code>
- * that that implements the Islamic civil and religious calendars.  It
+ * that implements the Islamic civil and religious calendars.  It
  * is used as the civil calendar in most of the Arab world and the
  * liturgical calendar of the Islamic faith worldwide.  This calendar
  * is also known as the "Hijri" calendar, since it starts at the time
@@ -85,13 +86,16 @@ class U_I18N_API IslamicCalendar : public Calendar {
   //-------------------------------------------------------------------------
   // Constants...
   //-------------------------------------------------------------------------
+  
   /**
-   * Calendar type - civil or religious
+   * Calendar type - civil or religious or um alqura
    * @internal 
    */
-  enum ECivil {
+  enum ECalculationType {
     ASTRONOMICAL,
-    CIVIL
+    CIVIL,
+    UMALQURA,
+    TBLA
   };
   
   /**
@@ -175,7 +179,6 @@ class U_I18N_API IslamicCalendar : public Calendar {
   }; 
 
 
-
   //-------------------------------------------------------------------------
   // Constructors...
   //-------------------------------------------------------------------------
@@ -187,10 +190,10 @@ class U_I18N_API IslamicCalendar : public Calendar {
    * @param aLocale  The given locale.
    * @param success  Indicates the status of IslamicCalendar object construction.
    *                 Returns U_ZERO_ERROR if constructed successfully.
-   * @param beCivil  Whether the calendar should be civil (default-TRUE) or religious (FALSE)
+   * @param type     The Islamic calendar calculation type. The default value is CIVIL.
    * @internal
    */
-  IslamicCalendar(const Locale& aLocale, UErrorCode &success, ECivil beCivil = CIVIL);
+  IslamicCalendar(const Locale& aLocale, UErrorCode &success, ECalculationType type = CIVIL);
 
   /**
    * Copy Constructor
@@ -205,14 +208,13 @@ class U_I18N_API IslamicCalendar : public Calendar {
   virtual ~IslamicCalendar();
 
   /**
-   * Determines whether this object uses the fixed-cycle Islamic civil calendar
-   * or an approximation of the religious, astronomical calendar.
+   * Sets Islamic calendar calculation type used by this instance.
    *
-   * @param beCivil   <code>CIVIL</code> to use the civil calendar,
-   *                  <code>ASTRONOMICAL</code> to use the astronomical calendar.
+   * @param type    The calendar calculation type, <code>CIVIL</code> to use the civil
+   *                calendar, <code>ASTRONOMICAL</code> to use the astronomical calendar.
    * @internal
    */
-  void setCivil(ECivil beCivil, UErrorCode &status);
+  void setCalculationType(ECalculationType type, UErrorCode &status);
     
   /**
    * Returns <code>true</code> if this object is using the fixed-cycle civil
@@ -238,7 +240,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
    * Return the day # on which the given year starts.  Days are counted
    * from the Hijri epoch, origin 0.
    */
-  int32_t yearStart(int32_t year);
+  int32_t yearStart(int32_t year) const;
 
   /**
    * Return the day # on which the given month starts.  Days are counted
@@ -268,7 +270,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
    * @param time  The time at which the moon's age is desired,
    *              in millis since 1/1/1970.
    */
-  static double moonAge(UDate time);
+  static double moonAge(UDate time, UErrorCode &status);
 
   //-------------------------------------------------------------------------
   // Internal data....
@@ -279,7 +281,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
    * and <code>ASTRONOMICAL</code> if it approximates the true religious calendar using
    * astronomical calculations for the time of the new moon.
    */
-  ECivil civil;
+  ECalculationType cType;
 
   //----------------------------------------------------------------------
   // Calendar framework
@@ -362,7 +364,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
    * @return   The class ID for all objects of this class.
    * @internal
    */
-  static UClassID U_EXPORT2 getStaticClassID(void);
+  /*U_I18N_API*/ static UClassID U_EXPORT2 getStaticClassID(void);
 
   /**
    * return the calendar type, "buddhist".
@@ -409,42 +411,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
    */
   virtual int32_t defaultCenturyStartYear() const;
 
- private: // default century stuff.
-  /**
-   * The system maintains a static default century start date.  This is initialized
-   * the first time it is used.  Before then, it is set to SYSTEM_DEFAULT_CENTURY to
-   * indicate an uninitialized state.  Once the system default century date and year
-   * are set, they do not change.
-   */
-  static UDate         fgSystemDefaultCenturyStart;
-
-  /**
-   * See documentation for systemDefaultCenturyStart.
-   */
-  static int32_t          fgSystemDefaultCenturyStartYear;
-
-  /**
-   * Default value that indicates the defaultCenturyStartYear is unitialized
-   */
-  static const int32_t    fgSystemDefaultCenturyYear;
-
-  /**
-   * start of default century, as a date
-   */
-  static const UDate        fgSystemDefaultCentury;
-
-  /**
-   * Returns the beginning date of the 100-year window that dates 
-   * with 2-digit years are considered to fall within.
-   */
-  UDate         internalGetDefaultCenturyStart(void) const;
-
-  /**
-   * Returns the first year of the 100-year window that dates with 
-   * 2-digit years are considered to fall within.
-   */
-  int32_t          internalGetDefaultCenturyStartYear(void) const;
-
+ private:
   /**
    * Initializes the 100-year window that dates with 2-digit years
    * are considered to fall within so that its start date is 80 years