1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/ethpccal.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,270 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* Copyright (C) 2003 - 2013, International Business Machines Corporation and * 1.7 +* others. All Rights Reserved. * 1.8 +******************************************************************************* 1.9 +*/ 1.10 + 1.11 +#ifndef ETHPCCAL_H 1.12 +#define ETHPCCAL_H 1.13 + 1.14 +#include "unicode/utypes.h" 1.15 + 1.16 +#if !UCONFIG_NO_FORMATTING 1.17 + 1.18 +#include "unicode/calendar.h" 1.19 +#include "cecal.h" 1.20 + 1.21 +U_NAMESPACE_BEGIN 1.22 + 1.23 +/** 1.24 + * Implement the Ethiopic calendar system. 1.25 + * @internal 1.26 + */ 1.27 +class EthiopicCalendar : public CECalendar { 1.28 + 1.29 +public: 1.30 + /** 1.31 + * Calendar type - use Amete Alem era for all the time or not 1.32 + * @internal 1.33 + */ 1.34 + enum EEraType { 1.35 + AMETE_MIHRET_ERA, 1.36 + AMETE_ALEM_ERA 1.37 + }; 1.38 + 1.39 + /** 1.40 + * Useful constants for EthiopicCalendar. 1.41 + * @internal 1.42 + */ 1.43 + enum EMonths { 1.44 + /** 1.45 + * Constant for መስከረም, the 1st month of the Ethiopic year. 1.46 + */ 1.47 + MESKEREM, 1.48 + 1.49 + /** 1.50 + * Constant for ጥቅምት, the 2nd month of the Ethiopic year. 1.51 + */ 1.52 + TEKEMT, 1.53 + 1.54 + /** 1.55 + * Constant for ኅዳር, the 3rd month of the Ethiopic year. 1.56 + */ 1.57 + HEDAR, 1.58 + 1.59 + /** 1.60 + * Constant for ታኅሣሥ, the 4th month of the Ethiopic year. 1.61 + */ 1.62 + TAHSAS, 1.63 + 1.64 + /** 1.65 + * Constant for ጥር, the 5th month of the Ethiopic year. 1.66 + */ 1.67 + TER, 1.68 + 1.69 + /** 1.70 + * Constant for የካቲት, the 6th month of the Ethiopic year. 1.71 + */ 1.72 + YEKATIT, 1.73 + 1.74 + /** 1.75 + * Constant for መጋቢት, the 7th month of the Ethiopic year. 1.76 + */ 1.77 + MEGABIT, 1.78 + 1.79 + /** 1.80 + * Constant for ሚያዝያ, the 8th month of the Ethiopic year. 1.81 + */ 1.82 + MIAZIA, 1.83 + 1.84 + /** 1.85 + * Constant for ግንቦት, the 9th month of the Ethiopic year. 1.86 + */ 1.87 + GENBOT, 1.88 + 1.89 + /** 1.90 + * Constant for ሰኔ, the 10th month of the Ethiopic year. 1.91 + */ 1.92 + SENE, 1.93 + 1.94 + /** 1.95 + * Constant for ሐምሌ, the 11th month of the Ethiopic year. 1.96 + */ 1.97 + HAMLE, 1.98 + 1.99 + /** 1.100 + * Constant for ነሐሴ, the 12th month of the Ethiopic year. 1.101 + */ 1.102 + NEHASSA, 1.103 + 1.104 + /** 1.105 + * Constant for ጳጉሜን, the 13th month of the Ethiopic year. 1.106 + */ 1.107 + PAGUMEN 1.108 + }; 1.109 + 1.110 + enum EEras { 1.111 + AMETE_ALEM, // Before the epoch 1.112 + AMETE_MIHRET // After the epoch 1.113 + }; 1.114 + 1.115 + /** 1.116 + * Constructs a EthiopicCalendar based on the current time in the default time zone 1.117 + * with the given locale. 1.118 + * 1.119 + * @param aLocale The given locale. 1.120 + * @param success Indicates the status of EthiopicCalendar object construction. 1.121 + * Returns U_ZERO_ERROR if constructed successfully. 1.122 + * @param type Whether this Ethiopic calendar use Amete Mihrret (default) or 1.123 + * only use Amete Alem for all the time. 1.124 + * @internal 1.125 + */ 1.126 + EthiopicCalendar(const Locale& aLocale, UErrorCode& success, EEraType type = AMETE_MIHRET_ERA); 1.127 + 1.128 + /** 1.129 + * Copy Constructor 1.130 + * @internal 1.131 + */ 1.132 + EthiopicCalendar(const EthiopicCalendar& other); 1.133 + 1.134 + /** 1.135 + * Destructor. 1.136 + * @internal 1.137 + */ 1.138 + virtual ~EthiopicCalendar(); 1.139 + 1.140 + /** 1.141 + * Create and return a polymorphic copy of this calendar. 1.142 + * @return return a polymorphic copy of this calendar. 1.143 + * @internal 1.144 + */ 1.145 + virtual Calendar* clone() const; 1.146 + 1.147 + /** 1.148 + * return the calendar type, "ethiopic" 1.149 + * @return calendar type 1.150 + * @internal 1.151 + */ 1.152 + virtual const char * getType() const; 1.153 + 1.154 + /** 1.155 + * Set Alem or Mihret era. 1.156 + * @param onOff Set Amete Alem era if true, otherwise set Amete Mihret era. 1.157 + * @internal 1.158 + */ 1.159 + void setAmeteAlemEra (UBool onOff); 1.160 + 1.161 + /** 1.162 + * Return true if this calendar is set to the Amete Alem era. 1.163 + * @return true if set to the Amete Alem era. 1.164 + * @internal 1.165 + */ 1.166 + UBool isAmeteAlemEra() const; 1.167 + 1.168 +protected: 1.169 + //------------------------------------------------------------------------- 1.170 + // Calendar framework 1.171 + //------------------------------------------------------------------------- 1.172 + 1.173 + /** 1.174 + * Return the extended year defined by the current fields. 1.175 + * @internal 1.176 + */ 1.177 + virtual int32_t handleGetExtendedYear(); 1.178 + 1.179 + /** 1.180 + * Compute fields from the JD 1.181 + * @internal 1.182 + */ 1.183 + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); 1.184 + 1.185 + /** 1.186 + * Calculate the limit for a specified type of limit and field 1.187 + * @internal 1.188 + */ 1.189 + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; 1.190 + 1.191 + /** 1.192 + * Returns the date of the start of the default century 1.193 + * @return start of century - in milliseconds since epoch, 1970 1.194 + * @internal 1.195 + */ 1.196 + virtual UDate defaultCenturyStart() const; 1.197 + 1.198 + /** 1.199 + * Returns the year in which the default century begins 1.200 + * @internal 1.201 + */ 1.202 + virtual int32_t defaultCenturyStartYear() const; 1.203 + 1.204 + /** 1.205 + * Return the date offset from Julian 1.206 + * @internal 1.207 + */ 1.208 + virtual int32_t getJDEpochOffset() const; 1.209 + 1.210 +private: 1.211 + /** 1.212 + * When eraType is AMETE_ALEM_ERA, then this calendar use only AMETE_ALEM 1.213 + * for the era. Otherwise (default), this calendar uses both AMETE_ALEM 1.214 + * and AMETE_MIHRET. 1.215 + * 1.216 + * EXTENDED_YEAR AMETE_ALEM_ERA AMETE_MIHRET_ERA 1.217 + * 0 Amete Alem 5500 Amete Alem 5500 1.218 + * 1 Amete Mihret 1 Amete Alem 5501 1.219 + */ 1.220 + EEraType eraType; 1.221 + 1.222 +public: 1.223 + /** 1.224 + * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual 1.225 + * override. This method is to implement a simple version of RTTI, since not all C++ 1.226 + * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call 1.227 + * this method. 1.228 + * 1.229 + * @return The class ID for this object. All objects of a given class have the 1.230 + * same class ID. Objects of other classes have different class IDs. 1.231 + * @internal 1.232 + */ 1.233 + virtual UClassID getDynamicClassID(void) const; 1.234 + 1.235 + /** 1.236 + * Return the class ID for this class. This is useful only for comparing to a return 1.237 + * value from getDynamicClassID(). For example: 1.238 + * 1.239 + * Base* polymorphic_pointer = createPolymorphicObject(); 1.240 + * if (polymorphic_pointer->getDynamicClassID() == 1.241 + * Derived::getStaticClassID()) ... 1.242 + * 1.243 + * @return The class ID for all objects of this class. 1.244 + * @internal 1.245 + */ 1.246 + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); 1.247 + 1.248 +#if 0 1.249 +// We do not want to introduce this API in ICU4C. 1.250 +// It was accidentally introduced in ICU4J as a public API. 1.251 + 1.252 +public: 1.253 + //------------------------------------------------------------------------- 1.254 + // Calendar system Conversion methods... 1.255 + //------------------------------------------------------------------------- 1.256 + 1.257 + /** 1.258 + * Convert an Ethiopic year, month, and day to a Julian day. 1.259 + * 1.260 + * @param year the extended year 1.261 + * @param month the month 1.262 + * @param day the day 1.263 + * @return Julian day 1.264 + * @internal 1.265 + */ 1.266 + int32_t ethiopicToJD(int32_t year, int32_t month, int32_t day); 1.267 +#endif 1.268 +}; 1.269 + 1.270 +U_NAMESPACE_END 1.271 +#endif /* #if !UCONFIG_NO_FORMATTING */ 1.272 +#endif /* ETHPCCAL_H */ 1.273 +//eof