coptccal.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2003 - 2013, International Business Machines Corporation and *
  6. * others. All Rights Reserved. *
  7. *******************************************************************************
  8. */
  9. #ifndef COPTCCAL_H
  10. #define COPTCCAL_H
  11. #include "unicode/utypes.h"
  12. #if !UCONFIG_NO_FORMATTING
  13. #include "unicode/calendar.h"
  14. #include "cecal.h"
  15. U_NAMESPACE_BEGIN
  16. /**
  17. * Implement the Coptic calendar system.
  18. * @internal
  19. */
  20. class CopticCalendar : public CECalendar {
  21. public:
  22. /**
  23. * Useful constants for CopticCalendar.
  24. * @internal
  25. */
  26. enum EMonths {
  27. /**
  28. * Constant for ωογτ/تﻮﺗ,
  29. * the 1st month of the Coptic year.
  30. */
  31. TOUT,
  32. /**
  33. * Constant for Παοπι/ﻪﺑﺎﺑ,
  34. * the 2nd month of the Coptic year.
  35. */
  36. BABA,
  37. /**
  38. * Constant for Αθορ/رﻮﺗﺎﻫ,
  39. * the 3rd month of the Coptic year.
  40. */
  41. HATOR,
  42. /**
  43. * Constant for Χοιακ/ﻚﻬﻴﻛ,
  44. * the 4th month of the Coptic year.
  45. */
  46. KIAHK,
  47. /**
  48. * Constant for Τωβι/طﻮﺒﻫ,
  49. * the 5th month of the Coptic year.
  50. */
  51. TOBA,
  52. /**
  53. * Constant for Μεϣιρ/ﺮﻴﺸﻣأ,
  54. * the 6th month of the Coptic year.
  55. */
  56. AMSHIR,
  57. /**
  58. * Constant for Παρεμϩατ/تﺎﻬﻣﺮﺑ,
  59. * the 7th month of the Coptic year.
  60. */
  61. BARAMHAT,
  62. /**
  63. * Constant for Φαρμοθι/هدﻮﻣﺮﺑ,
  64. * the 8th month of the Coptic year.
  65. */
  66. BARAMOUDA,
  67. /**
  68. * Constant for Παϣαν/ﺲﻨﺸﺑ,
  69. * the 9th month of the Coptic year.
  70. */
  71. BASHANS,
  72. /**
  73. * Constant for Παωνι/ﻪﻧؤﻮﺑ,
  74. * the 10th month of the Coptic year.
  75. */
  76. PAONA,
  77. /**
  78. * Constant for Επηπ/ﺐﻴﺑأ,
  79. * the 11th month of the Coptic year.
  80. */
  81. EPEP,
  82. /**
  83. * Constant for Μεϲωρη/ىﺮﺴﻣ,
  84. * the 12th month of the Coptic year.
  85. */
  86. MESRA,
  87. /**
  88. * Constant for Πικογϫι
  89. * μαβοτ/ﺮﻴﻐﺼﻟا
  90. * ﺮﻬﺸﻟا,
  91. * the 13th month of the Coptic year.
  92. */
  93. NASIE
  94. };
  95. enum EEras {
  96. BCE, // Before the epoch
  97. CE // After the epoch
  98. };
  99. /**
  100. * Constructs a CopticCalendar based on the current time in the default time zone
  101. * with the given locale.
  102. *
  103. * @param aLocale The given locale.
  104. * @param success Indicates the status of CopticCalendar object construction.
  105. * Returns U_ZERO_ERROR if constructed successfully.
  106. * @internal
  107. */
  108. CopticCalendar(const Locale& aLocale, UErrorCode& success);
  109. /**
  110. * Copy Constructor
  111. * @internal
  112. */
  113. CopticCalendar (const CopticCalendar& other);
  114. /**
  115. * Destructor.
  116. * @internal
  117. */
  118. virtual ~CopticCalendar();
  119. /**
  120. * Create and return a polymorphic copy of this calendar.
  121. * @return return a polymorphic copy of this calendar.
  122. * @internal
  123. */
  124. virtual CopticCalendar* clone() const;
  125. /**
  126. * return the calendar type, "coptic"
  127. * @return calendar type
  128. * @internal
  129. */
  130. const char * getType() const;
  131. protected:
  132. //-------------------------------------------------------------------------
  133. // Calendar framework
  134. //-------------------------------------------------------------------------
  135. /**
  136. * Return the extended year defined by the current fields.
  137. * @internal
  138. */
  139. virtual int32_t handleGetExtendedYear();
  140. /**
  141. * Compute fields from the JD
  142. * @internal
  143. */
  144. virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
  145. /**
  146. * Returns the date of the start of the default century
  147. * @return start of century - in milliseconds since epoch, 1970
  148. * @internal
  149. */
  150. virtual UDate defaultCenturyStart() const;
  151. /**
  152. * Returns the year in which the default century begins
  153. * @internal
  154. */
  155. virtual int32_t defaultCenturyStartYear() const;
  156. /**
  157. * Return the date offset from Julian
  158. * @internal
  159. */
  160. virtual int32_t getJDEpochOffset() const;
  161. public:
  162. /**
  163. * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual
  164. * override. This method is to implement a simple version of RTTI, since not all C++
  165. * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
  166. * this method.
  167. *
  168. * @return The class ID for this object. All objects of a given class have the
  169. * same class ID. Objects of other classes have different class IDs.
  170. * @internal
  171. */
  172. virtual UClassID getDynamicClassID(void) const;
  173. /**
  174. * Return the class ID for this class. This is useful only for comparing to a return
  175. * value from getDynamicClassID(). For example:
  176. *
  177. * Base* polymorphic_pointer = createPolymorphicObject();
  178. * if (polymorphic_pointer->getDynamicClassID() ==
  179. * Derived::getStaticClassID()) ...
  180. *
  181. * @return The class ID for all objects of this class.
  182. * @internal
  183. */
  184. U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);
  185. #if 0
  186. // We do not want to introduce this API in ICU4C.
  187. // It was accidentally introduced in ICU4J as a public API.
  188. public:
  189. //-------------------------------------------------------------------------
  190. // Calendar system Conversion methods...
  191. //-------------------------------------------------------------------------
  192. /**
  193. * Convert an Coptic year, month, and day to a Julian day.
  194. *
  195. * @param year the extended year
  196. * @param month the month
  197. * @param day the day
  198. * @return Julian day
  199. * @internal
  200. */
  201. static int32_t copticToJD(int32_t year, int32_t month, int32_t day);
  202. #endif
  203. };
  204. U_NAMESPACE_END
  205. #endif /* #if !UCONFIG_NO_FORMATTING */
  206. #endif /* COPTCCAL_H */
  207. //eof