michael@0: /* michael@0: ******************************************************************************* michael@0: * Copyright (C) 2003 - 2013, International Business Machines Corporation and * michael@0: * others. All Rights Reserved. * michael@0: ******************************************************************************* michael@0: */ michael@0: michael@0: #ifndef COPTCCAL_H michael@0: #define COPTCCAL_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: michael@0: #if !UCONFIG_NO_FORMATTING michael@0: michael@0: #include "unicode/calendar.h" michael@0: #include "cecal.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /** michael@0: * Implement the Coptic calendar system. michael@0: * @internal michael@0: */ michael@0: class CopticCalendar : public CECalendar { michael@0: michael@0: public: michael@0: /** michael@0: * Useful constants for CopticCalendar. michael@0: * @internal michael@0: */ michael@0: enum EMonths { michael@0: /** michael@0: * Constant for ωογτ/تﻮﺗ, michael@0: * the 1st month of the Coptic year. michael@0: */ michael@0: TOUT, michael@0: michael@0: /** michael@0: * Constant for Παοπι/ﻪﺑﺎﺑ, michael@0: * the 2nd month of the Coptic year. michael@0: */ michael@0: BABA, michael@0: michael@0: /** michael@0: * Constant for Αθορ/رﻮﺗﺎﻫ, michael@0: * the 3rd month of the Coptic year. michael@0: */ michael@0: HATOR, michael@0: michael@0: /** michael@0: * Constant for Χοιακ/ﻚﻬﻴﻛ, michael@0: * the 4th month of the Coptic year. michael@0: */ michael@0: KIAHK, michael@0: michael@0: /** michael@0: * Constant for Τωβι/طﻮﺒﻫ, michael@0: * the 5th month of the Coptic year. michael@0: */ michael@0: TOBA, michael@0: michael@0: /** michael@0: * Constant for Μεϣιρ/ﺮﻴﺸﻣأ, michael@0: * the 6th month of the Coptic year. michael@0: */ michael@0: AMSHIR, michael@0: michael@0: /** michael@0: * Constant for Παρεμϩατ/تﺎﻬﻣﺮﺑ, michael@0: * the 7th month of the Coptic year. michael@0: */ michael@0: BARAMHAT, michael@0: michael@0: /** michael@0: * Constant for Φαρμοθι/هدﻮﻣﺮﺑ, michael@0: * the 8th month of the Coptic year. michael@0: */ michael@0: BARAMOUDA, michael@0: michael@0: /** michael@0: * Constant for Παϣαν/ﺲﻨﺸﺑ, michael@0: * the 9th month of the Coptic year. michael@0: */ michael@0: BASHANS, michael@0: michael@0: /** michael@0: * Constant for Παωνι/ﻪﻧؤﻮﺑ, michael@0: * the 10th month of the Coptic year. michael@0: */ michael@0: PAONA, michael@0: michael@0: /** michael@0: * Constant for Επηπ/ﺐﻴﺑأ, michael@0: * the 11th month of the Coptic year. michael@0: */ michael@0: EPEP, michael@0: michael@0: /** michael@0: * Constant for Μεϲωρη/ىﺮﺴﻣ, michael@0: * the 12th month of the Coptic year. michael@0: */ michael@0: MESRA, michael@0: michael@0: /** michael@0: * Constant for Πικογϫι michael@0: * μαβοτ/ﺮﻴﻐﺼﻟا michael@0: * ﺮﻬﺸﻟا, michael@0: * the 13th month of the Coptic year. michael@0: */ michael@0: NASIE michael@0: }; michael@0: michael@0: enum EEras { michael@0: BCE, // Before the epoch michael@0: CE // After the epoch michael@0: }; michael@0: michael@0: /** michael@0: * Constructs a CopticCalendar based on the current time in the default time zone michael@0: * with the given locale. michael@0: * michael@0: * @param aLocale The given locale. michael@0: * @param success Indicates the status of CopticCalendar object construction. michael@0: * Returns U_ZERO_ERROR if constructed successfully. michael@0: * @internal michael@0: */ michael@0: CopticCalendar(const Locale& aLocale, UErrorCode& success); michael@0: michael@0: /** michael@0: * Copy Constructor michael@0: * @internal michael@0: */ michael@0: CopticCalendar (const CopticCalendar& other); michael@0: michael@0: /** michael@0: * Destructor. michael@0: * @internal michael@0: */ michael@0: virtual ~CopticCalendar(); michael@0: michael@0: /** michael@0: * Create and return a polymorphic copy of this calendar. michael@0: * @return return a polymorphic copy of this calendar. michael@0: * @internal michael@0: */ michael@0: virtual Calendar* clone(void) const; michael@0: michael@0: /** michael@0: * return the calendar type, "coptic" michael@0: * @return calendar type michael@0: * @internal michael@0: */ michael@0: const char * getType() const; michael@0: michael@0: protected: michael@0: //------------------------------------------------------------------------- michael@0: // Calendar framework michael@0: //------------------------------------------------------------------------- michael@0: michael@0: /** michael@0: * Return the extended year defined by the current fields. michael@0: * @internal michael@0: */ michael@0: virtual int32_t handleGetExtendedYear(); michael@0: michael@0: /** michael@0: * Compute fields from the JD michael@0: * @internal michael@0: */ michael@0: virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); michael@0: michael@0: /** michael@0: * Returns the date of the start of the default century michael@0: * @return start of century - in milliseconds since epoch, 1970 michael@0: * @internal michael@0: */ michael@0: virtual UDate defaultCenturyStart() const; michael@0: michael@0: /** michael@0: * Returns the year in which the default century begins michael@0: * @internal michael@0: */ michael@0: virtual int32_t defaultCenturyStartYear() const; michael@0: michael@0: /** michael@0: * Return the date offset from Julian michael@0: * @internal michael@0: */ michael@0: virtual int32_t getJDEpochOffset() const; michael@0: michael@0: michael@0: public: michael@0: /** michael@0: * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual michael@0: * override. This method is to implement a simple version of RTTI, since not all C++ michael@0: * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call michael@0: * this method. michael@0: * michael@0: * @return The class ID for this object. All objects of a given class have the michael@0: * same class ID. Objects of other classes have different class IDs. michael@0: * @internal michael@0: */ michael@0: virtual UClassID getDynamicClassID(void) const; michael@0: michael@0: /** michael@0: * Return the class ID for this class. This is useful only for comparing to a return michael@0: * value from getDynamicClassID(). For example: michael@0: * michael@0: * Base* polymorphic_pointer = createPolymorphicObject(); michael@0: * if (polymorphic_pointer->getDynamicClassID() == michael@0: * Derived::getStaticClassID()) ... michael@0: * michael@0: * @return The class ID for all objects of this class. michael@0: * @internal michael@0: */ michael@0: U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); michael@0: michael@0: #if 0 michael@0: // We do not want to introduce this API in ICU4C. michael@0: // It was accidentally introduced in ICU4J as a public API. michael@0: public: michael@0: //------------------------------------------------------------------------- michael@0: // Calendar system Conversion methods... michael@0: //------------------------------------------------------------------------- michael@0: /** michael@0: * Convert an Coptic year, month, and day to a Julian day. michael@0: * michael@0: * @param year the extended year michael@0: * @param month the month michael@0: * @param day the day michael@0: * @return Julian day michael@0: * @internal michael@0: */ michael@0: static int32_t copticToJD(int32_t year, int32_t month, int32_t day); michael@0: #endif michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif /* #if !UCONFIG_NO_FORMATTING */ michael@0: #endif /* COPTCCAL_H */ michael@0: //eof