intl/icu/source/i18n/ethpccal.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /*
     2 *******************************************************************************
     3 * Copyright (C) 2003 - 2013, International Business Machines Corporation and  *
     4 * others. All Rights Reserved.                                                *
     5 *******************************************************************************
     6 */
     8 #ifndef ETHPCCAL_H
     9 #define ETHPCCAL_H
    11 #include "unicode/utypes.h"
    13 #if !UCONFIG_NO_FORMATTING
    15 #include "unicode/calendar.h"
    16 #include "cecal.h"
    18 U_NAMESPACE_BEGIN
    20 /**
    21  * Implement the Ethiopic calendar system.
    22  * @internal
    23  */
    24 class EthiopicCalendar : public CECalendar {
    26 public:
    27     /**
    28      * Calendar type - use Amete Alem era for all the time or not
    29      * @internal 
    30      */
    31     enum EEraType {
    32         AMETE_MIHRET_ERA,
    33         AMETE_ALEM_ERA
    34     };
    36     /**
    37      * Useful constants for EthiopicCalendar.
    38      * @internal
    39      */
    40     enum EMonths {
    41         /** 
    42          * Constant for &#x1218;&#x1235;&#x12a8;&#x1228;&#x121d;, the 1st month of the Ethiopic year.
    43          */
    44         MESKEREM,
    46         /** 
    47          * Constant for &#x1325;&#x1245;&#x121d;&#x1275;, the 2nd month of the Ethiopic year.
    48          */
    49         TEKEMT,
    51         /** 
    52          * Constant for &#x1285;&#x12f3;&#x122d;, the 3rd month of the Ethiopic year. 
    53          */
    54         HEDAR,
    56         /** 
    57          * Constant for &#x1273;&#x1285;&#x1223;&#x1225;, the 4th month of the Ethiopic year. 
    58          */
    59         TAHSAS,
    61         /** 
    62          * Constant for &#x1325;&#x122d;, the 5th month of the Ethiopic year. 
    63          */
    64         TER,
    66         /** 
    67          * Constant for &#x12e8;&#x12ab;&#x1272;&#x1275;, the 6th month of the Ethiopic year. 
    68          */
    69         YEKATIT,
    71         /** 
    72          * Constant for &#x1218;&#x130b;&#x1262;&#x1275;, the 7th month of the Ethiopic year. 
    73          */
    74         MEGABIT,
    76         /** 
    77          * Constant for &#x121a;&#x12eb;&#x12dd;&#x12eb;, the 8th month of the Ethiopic year. 
    78          */
    79         MIAZIA,
    81         /** 
    82          * Constant for &#x130d;&#x1295;&#x1266;&#x1275;, the 9th month of the Ethiopic year. 
    83          */
    84         GENBOT,
    86         /** 
    87          * Constant for &#x1230;&#x1294;, the 10th month of the Ethiopic year. 
    88          */
    89         SENE,
    91         /** 
    92          * Constant for &#x1210;&#x121d;&#x120c;, the 11th month of the Ethiopic year. 
    93          */
    94         HAMLE,
    96         /** 
    97          * Constant for &#x1290;&#x1210;&#x1234;, the 12th month of the Ethiopic year. 
    98          */
    99         NEHASSA,
   101         /** 
   102          * Constant for &#x1333;&#x1309;&#x121c;&#x1295;, the 13th month of the Ethiopic year. 
   103          */
   104         PAGUMEN
   105     };
   107     enum EEras {
   108         AMETE_ALEM,     // Before the epoch
   109         AMETE_MIHRET    // After the epoch
   110     };
   112     /**
   113      * Constructs a EthiopicCalendar based on the current time in the default time zone
   114      * with the given locale.
   115      *
   116      * @param aLocale  The given locale.
   117      * @param success  Indicates the status of EthiopicCalendar object construction.
   118      *                 Returns U_ZERO_ERROR if constructed successfully.
   119      * @param type     Whether this Ethiopic calendar use Amete Mihrret (default) or
   120      *                 only use Amete Alem for all the time.
   121      * @internal
   122      */
   123     EthiopicCalendar(const Locale& aLocale, UErrorCode& success, EEraType type = AMETE_MIHRET_ERA);
   125     /**
   126      * Copy Constructor
   127      * @internal
   128      */
   129     EthiopicCalendar(const EthiopicCalendar& other);
   131     /**
   132      * Destructor.
   133      * @internal
   134      */
   135     virtual ~EthiopicCalendar();
   137     /**
   138      * Create and return a polymorphic copy of this calendar.
   139      * @return    return a polymorphic copy of this calendar.
   140      * @internal
   141      */
   142     virtual Calendar* clone() const;
   144     /**
   145      * return the calendar type, "ethiopic"
   146      * @return calendar type
   147      * @internal
   148      */
   149     virtual const char * getType() const;
   151     /**
   152      * Set Alem or Mihret era.
   153      * @param onOff Set Amete Alem era if true, otherwise set Amete Mihret era.
   154      * @internal
   155      */
   156     void setAmeteAlemEra (UBool onOff);
   158     /**
   159      * Return true if this calendar is set to the Amete Alem era.
   160      * @return true if set to the Amete Alem era.
   161      * @internal
   162      */
   163     UBool isAmeteAlemEra() const;
   165 protected:
   166     //-------------------------------------------------------------------------
   167     // Calendar framework
   168     //-------------------------------------------------------------------------
   170     /**
   171      * Return the extended year defined by the current fields.
   172      * @internal
   173      */
   174     virtual int32_t handleGetExtendedYear();
   176     /**
   177      * Compute fields from the JD
   178      * @internal
   179      */
   180     virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
   182     /**
   183      * Calculate the limit for a specified type of limit and field
   184      * @internal
   185      */
   186     virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
   188     /**
   189      * Returns the date of the start of the default century
   190      * @return start of century - in milliseconds since epoch, 1970
   191      * @internal
   192      */
   193     virtual UDate defaultCenturyStart() const;
   195     /**
   196      * Returns the year in which the default century begins
   197      * @internal
   198      */
   199     virtual int32_t defaultCenturyStartYear() const;
   201     /**
   202      * Return the date offset from Julian
   203      * @internal
   204      */
   205     virtual int32_t getJDEpochOffset() const;
   207 private:
   208     /**
   209      * When eraType is AMETE_ALEM_ERA, then this calendar use only AMETE_ALEM
   210      * for the era. Otherwise (default), this calendar uses both AMETE_ALEM
   211      * and AMETE_MIHRET.
   212      *
   213      * EXTENDED_YEAR        AMETE_ALEM_ERA     AMETE_MIHRET_ERA
   214      *             0       Amete Alem 5500      Amete Alem 5500
   215      *             1        Amete Mihret 1      Amete Alem 5501
   216      */
   217     EEraType eraType;
   219 public:
   220     /**
   221      * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual
   222      * override. This method is to implement a simple version of RTTI, since not all C++
   223      * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
   224      * this method.
   225      *
   226      * @return   The class ID for this object. All objects of a given class have the
   227      *           same class ID. Objects of other classes have different class IDs.
   228      * @internal
   229      */
   230     virtual UClassID getDynamicClassID(void) const;
   232     /**
   233      * Return the class ID for this class. This is useful only for comparing to a return
   234      * value from getDynamicClassID(). For example:
   235      *
   236      *      Base* polymorphic_pointer = createPolymorphicObject();
   237      *      if (polymorphic_pointer->getDynamicClassID() ==
   238      *          Derived::getStaticClassID()) ...
   239      *
   240      * @return   The class ID for all objects of this class.
   241      * @internal
   242      */
   243     U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);  
   245 #if 0
   246 // We do not want to introduce this API in ICU4C.
   247 // It was accidentally introduced in ICU4J as a public API.
   249 public:
   250     //-------------------------------------------------------------------------
   251     // Calendar system Conversion methods...
   252     //-------------------------------------------------------------------------
   254     /**
   255      * Convert an Ethiopic year, month, and day to a Julian day.
   256      *
   257      * @param year the extended year
   258      * @param month the month
   259      * @param day the day
   260      * @return Julian day
   261      * @internal
   262      */
   263     int32_t ethiopicToJD(int32_t year, int32_t month, int32_t day);
   264 #endif
   265 };
   267 U_NAMESPACE_END
   268 #endif /* #if !UCONFIG_NO_FORMATTING */
   269 #endif /* ETHPCCAL_H */
   270 //eof

mercurial