1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/coptccal.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,242 @@ 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 COPTCCAL_H 1.12 +#define COPTCCAL_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 Coptic calendar system. 1.25 + * @internal 1.26 + */ 1.27 +class CopticCalendar : public CECalendar { 1.28 + 1.29 +public: 1.30 + /** 1.31 + * Useful constants for CopticCalendar. 1.32 + * @internal 1.33 + */ 1.34 + enum EMonths { 1.35 + /** 1.36 + * Constant for ωογτ/تﻮﺗ, 1.37 + * the 1st month of the Coptic year. 1.38 + */ 1.39 + TOUT, 1.40 + 1.41 + /** 1.42 + * Constant for Παοπι/ﻪﺑﺎﺑ, 1.43 + * the 2nd month of the Coptic year. 1.44 + */ 1.45 + BABA, 1.46 + 1.47 + /** 1.48 + * Constant for Αθορ/رﻮﺗﺎﻫ, 1.49 + * the 3rd month of the Coptic year. 1.50 + */ 1.51 + HATOR, 1.52 + 1.53 + /** 1.54 + * Constant for Χοιακ/ﻚﻬﻴﻛ, 1.55 + * the 4th month of the Coptic year. 1.56 + */ 1.57 + KIAHK, 1.58 + 1.59 + /** 1.60 + * Constant for Τωβι/طﻮﺒﻫ, 1.61 + * the 5th month of the Coptic year. 1.62 + */ 1.63 + TOBA, 1.64 + 1.65 + /** 1.66 + * Constant for Μεϣιρ/ﺮﻴﺸﻣأ, 1.67 + * the 6th month of the Coptic year. 1.68 + */ 1.69 + AMSHIR, 1.70 + 1.71 + /** 1.72 + * Constant for Παρεμϩατ/تﺎﻬﻣﺮﺑ, 1.73 + * the 7th month of the Coptic year. 1.74 + */ 1.75 + BARAMHAT, 1.76 + 1.77 + /** 1.78 + * Constant for Φαρμοθι/هدﻮﻣﺮﺑ, 1.79 + * the 8th month of the Coptic year. 1.80 + */ 1.81 + BARAMOUDA, 1.82 + 1.83 + /** 1.84 + * Constant for Παϣαν/ﺲﻨﺸﺑ, 1.85 + * the 9th month of the Coptic year. 1.86 + */ 1.87 + BASHANS, 1.88 + 1.89 + /** 1.90 + * Constant for Παωνι/ﻪﻧؤﻮﺑ, 1.91 + * the 10th month of the Coptic year. 1.92 + */ 1.93 + PAONA, 1.94 + 1.95 + /** 1.96 + * Constant for Επηπ/ﺐﻴﺑأ, 1.97 + * the 11th month of the Coptic year. 1.98 + */ 1.99 + EPEP, 1.100 + 1.101 + /** 1.102 + * Constant for Μεϲωρη/ىﺮﺴﻣ, 1.103 + * the 12th month of the Coptic year. 1.104 + */ 1.105 + MESRA, 1.106 + 1.107 + /** 1.108 + * Constant for Πικογϫι 1.109 + * μαβοτ/ﺮﻴﻐﺼﻟا 1.110 + * ﺮﻬﺸﻟا, 1.111 + * the 13th month of the Coptic year. 1.112 + */ 1.113 + NASIE 1.114 + }; 1.115 + 1.116 + enum EEras { 1.117 + BCE, // Before the epoch 1.118 + CE // After the epoch 1.119 + }; 1.120 + 1.121 + /** 1.122 + * Constructs a CopticCalendar based on the current time in the default time zone 1.123 + * with the given locale. 1.124 + * 1.125 + * @param aLocale The given locale. 1.126 + * @param success Indicates the status of CopticCalendar object construction. 1.127 + * Returns U_ZERO_ERROR if constructed successfully. 1.128 + * @internal 1.129 + */ 1.130 + CopticCalendar(const Locale& aLocale, UErrorCode& success); 1.131 + 1.132 + /** 1.133 + * Copy Constructor 1.134 + * @internal 1.135 + */ 1.136 + CopticCalendar (const CopticCalendar& other); 1.137 + 1.138 + /** 1.139 + * Destructor. 1.140 + * @internal 1.141 + */ 1.142 + virtual ~CopticCalendar(); 1.143 + 1.144 + /** 1.145 + * Create and return a polymorphic copy of this calendar. 1.146 + * @return return a polymorphic copy of this calendar. 1.147 + * @internal 1.148 + */ 1.149 + virtual Calendar* clone(void) const; 1.150 + 1.151 + /** 1.152 + * return the calendar type, "coptic" 1.153 + * @return calendar type 1.154 + * @internal 1.155 + */ 1.156 + const char * getType() const; 1.157 + 1.158 +protected: 1.159 + //------------------------------------------------------------------------- 1.160 + // Calendar framework 1.161 + //------------------------------------------------------------------------- 1.162 + 1.163 + /** 1.164 + * Return the extended year defined by the current fields. 1.165 + * @internal 1.166 + */ 1.167 + virtual int32_t handleGetExtendedYear(); 1.168 + 1.169 + /** 1.170 + * Compute fields from the JD 1.171 + * @internal 1.172 + */ 1.173 + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); 1.174 + 1.175 + /** 1.176 + * Returns the date of the start of the default century 1.177 + * @return start of century - in milliseconds since epoch, 1970 1.178 + * @internal 1.179 + */ 1.180 + virtual UDate defaultCenturyStart() const; 1.181 + 1.182 + /** 1.183 + * Returns the year in which the default century begins 1.184 + * @internal 1.185 + */ 1.186 + virtual int32_t defaultCenturyStartYear() const; 1.187 + 1.188 + /** 1.189 + * Return the date offset from Julian 1.190 + * @internal 1.191 + */ 1.192 + virtual int32_t getJDEpochOffset() const; 1.193 + 1.194 + 1.195 +public: 1.196 + /** 1.197 + * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual 1.198 + * override. This method is to implement a simple version of RTTI, since not all C++ 1.199 + * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call 1.200 + * this method. 1.201 + * 1.202 + * @return The class ID for this object. All objects of a given class have the 1.203 + * same class ID. Objects of other classes have different class IDs. 1.204 + * @internal 1.205 + */ 1.206 + virtual UClassID getDynamicClassID(void) const; 1.207 + 1.208 + /** 1.209 + * Return the class ID for this class. This is useful only for comparing to a return 1.210 + * value from getDynamicClassID(). For example: 1.211 + * 1.212 + * Base* polymorphic_pointer = createPolymorphicObject(); 1.213 + * if (polymorphic_pointer->getDynamicClassID() == 1.214 + * Derived::getStaticClassID()) ... 1.215 + * 1.216 + * @return The class ID for all objects of this class. 1.217 + * @internal 1.218 + */ 1.219 + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); 1.220 + 1.221 +#if 0 1.222 + // We do not want to introduce this API in ICU4C. 1.223 + // It was accidentally introduced in ICU4J as a public API. 1.224 +public: 1.225 + //------------------------------------------------------------------------- 1.226 + // Calendar system Conversion methods... 1.227 + //------------------------------------------------------------------------- 1.228 + /** 1.229 + * Convert an Coptic year, month, and day to a Julian day. 1.230 + * 1.231 + * @param year the extended year 1.232 + * @param month the month 1.233 + * @param day the day 1.234 + * @return Julian day 1.235 + * @internal 1.236 + */ 1.237 + static int32_t copticToJD(int32_t year, int32_t month, int32_t day); 1.238 +#endif 1.239 +}; 1.240 + 1.241 +U_NAMESPACE_END 1.242 + 1.243 +#endif /* #if !UCONFIG_NO_FORMATTING */ 1.244 +#endif /* COPTCCAL_H */ 1.245 +//eof