intl/icu/source/i18n/ethpccal.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial