annotate modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/ethpccal.h @ 11038:20a8447c71c6

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