Home | History | Annotate | Download | only in i18n
      1 /*
      2 *******************************************************************************
      3 * Copyright (C) 2003 - 2013, International Business Machines Corporation and  *
      4 * others. All Rights Reserved.                                                *
      5 *******************************************************************************
      6 */
      7 
      8 #ifndef COPTCCAL_H
      9 #define COPTCCAL_H
     10 
     11 #include "unicode/utypes.h"
     12 
     13 #if !UCONFIG_NO_FORMATTING
     14 
     15 #include "unicode/calendar.h"
     16 #include "cecal.h"
     17 
     18 U_NAMESPACE_BEGIN
     19 
     20 /**
     21  * Implement the Coptic calendar system.
     22  * @internal
     23  */
     24 class CopticCalendar : public CECalendar {
     25 
     26 public:
     27     /**
     28      * Useful constants for CopticCalendar.
     29      * @internal
     30      */
     31     enum EMonths {
     32         /**
     33          * Constant for ωογτ/تﻮﺗ,
     34          * the 1st month of the Coptic year.
     35          */
     36         TOUT,
     37 
     38         /**
     39          * Constant for Παοπι/ﻪﺑﺎﺑ,
     40          * the 2nd month of the Coptic year.
     41          */
     42         BABA,
     43 
     44         /**
     45          * Constant for Αθορ/رﻮﺗﺎﻫ,
     46          * the 3rd month of the Coptic year.
     47          */
     48         HATOR,
     49 
     50         /**
     51          * Constant for Χοιακ/ﻚﻬﻴﻛ,
     52          * the 4th month of the Coptic year.
     53          */
     54         KIAHK,
     55 
     56         /**
     57          * Constant for Τωβι/طﻮﺒﻫ,
     58          * the 5th month of the Coptic year.
     59          */
     60         TOBA,
     61 
     62         /**
     63          * Constant for Μεϣιρ/ﺮﻴﺸﻣأ,
     64          * the 6th month of the Coptic year.
     65          */
     66         AMSHIR,
     67 
     68         /**
     69          * Constant for Παρεμϩατ/تﺎﻬﻣﺮﺑ,
     70          * the 7th month of the Coptic year.
     71          */
     72         BARAMHAT,
     73 
     74         /**
     75          * Constant for Φαρμοθι/هدﻮﻣﺮﺑ,
     76          * the 8th month of the Coptic year.
     77          */
     78         BARAMOUDA,
     79 
     80         /**
     81          * Constant for Παϣαν/ﺲﻨﺸﺑ,
     82          * the 9th month of the Coptic year.
     83          */
     84         BASHANS,
     85 
     86         /**
     87          * Constant for Παωνι/ﻪﻧؤﻮﺑ,
     88          * the 10th month of the Coptic year.
     89          */
     90         PAONA,
     91 
     92         /**
     93          * Constant for Επηπ/ﺐﻴﺑأ,
     94          * the 11th month of the Coptic year.
     95          */
     96         EPEP,
     97 
     98         /**
     99          * Constant for Μεϲωρη/ىﺮﺴﻣ,
    100          * the 12th month of the Coptic year.
    101          */
    102         MESRA,
    103 
    104         /**
    105          * Constant for Πικογϫι
    106          * μαβοτ/ﺮﻴﻐﺼﻟا
    107          * ﺮﻬﺸﻟا,
    108          * the 13th month of the Coptic year.
    109          */
    110         NASIE
    111     };
    112 
    113     enum EEras {
    114         BCE,    // Before the epoch
    115         CE      // After the epoch
    116     };
    117 
    118     /**
    119      * Constructs a CopticCalendar based on the current time in the default time zone
    120      * with the given locale.
    121      *
    122      * @param aLocale  The given locale.
    123      * @param success  Indicates the status of CopticCalendar object construction.
    124      *                 Returns U_ZERO_ERROR if constructed successfully.
    125      * @internal
    126      */
    127     CopticCalendar(const Locale& aLocale, UErrorCode& success);
    128 
    129     /**
    130      * Copy Constructor
    131      * @internal
    132      */
    133     CopticCalendar (const CopticCalendar& other);
    134 
    135     /**
    136      * Destructor.
    137      * @internal
    138      */
    139     virtual ~CopticCalendar();
    140 
    141     /**
    142      * Create and return a polymorphic copy of this calendar.
    143      * @return    return a polymorphic copy of this calendar.
    144      * @internal
    145      */
    146     virtual Calendar* clone(void) const;
    147 
    148     /**
    149      * return the calendar type, "coptic"
    150      * @return calendar type
    151      * @internal
    152      */
    153     const char * getType() const;
    154 
    155 protected:
    156     //-------------------------------------------------------------------------
    157     // Calendar framework
    158     //-------------------------------------------------------------------------
    159 
    160     /**
    161      * Return the extended year defined by the current fields.
    162      * @internal
    163      */
    164     virtual int32_t handleGetExtendedYear();
    165 
    166     /**
    167      * Compute fields from the JD
    168      * @internal
    169      */
    170     virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
    171 
    172     /**
    173      * Returns the date of the start of the default century
    174      * @return start of century - in milliseconds since epoch, 1970
    175      * @internal
    176      */
    177     virtual UDate defaultCenturyStart() const;
    178 
    179     /**
    180      * Returns the year in which the default century begins
    181      * @internal
    182      */
    183     virtual int32_t defaultCenturyStartYear() const;
    184 
    185     /**
    186      * Return the date offset from Julian
    187      * @internal
    188      */
    189     virtual int32_t getJDEpochOffset() const;
    190 
    191 
    192 public:
    193     /**
    194      * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual
    195      * override. This method is to implement a simple version of RTTI, since not all C++
    196      * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
    197      * this method.
    198      *
    199      * @return   The class ID for this object. All objects of a given class have the
    200      *           same class ID. Objects of other classes have different class IDs.
    201      * @internal
    202      */
    203     virtual UClassID getDynamicClassID(void) const;
    204 
    205     /**
    206      * Return the class ID for this class. This is useful only for comparing to a return
    207      * value from getDynamicClassID(). For example:
    208      *
    209      *      Base* polymorphic_pointer = createPolymorphicObject();
    210      *      if (polymorphic_pointer->getDynamicClassID() ==
    211      *          Derived::getStaticClassID()) ...
    212      *
    213      * @return   The class ID for all objects of this class.
    214      * @internal
    215      */
    216     U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);
    217 
    218 #if 0
    219     // We do not want to introduce this API in ICU4C.
    220     // It was accidentally introduced in ICU4J as a public API.
    221 public:
    222     //-------------------------------------------------------------------------
    223     // Calendar system Conversion methods...
    224     //-------------------------------------------------------------------------
    225     /**
    226      * Convert an Coptic year, month, and day to a Julian day.
    227      *
    228      * @param year the extended year
    229      * @param month the month
    230      * @param day the day
    231      * @return Julian day
    232      * @internal
    233      */
    234     static int32_t copticToJD(int32_t year, int32_t month, int32_t day);
    235 #endif
    236 };
    237 
    238 U_NAMESPACE_END
    239 
    240 #endif /* #if !UCONFIG_NO_FORMATTING */
    241 #endif /* COPTCCAL_H */
    242 //eof
    243