michael@0: /* michael@0: ******************************************************************************** michael@0: * Copyright (C) 2003-2013, International Business Machines Corporation michael@0: * and others. All Rights Reserved. michael@0: ******************************************************************************** michael@0: * michael@0: * File BUDDHCAL.H michael@0: * michael@0: * Modification History: michael@0: * michael@0: * Date Name Description michael@0: * 05/13/2003 srl copied from gregocal.h michael@0: * 06/29/2007 srl copied from buddhcal.h michael@0: ******************************************************************************** michael@0: */ michael@0: michael@0: #ifndef TAIWNCAL_H michael@0: #define TAIWNCAL_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 "unicode/gregocal.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /** michael@0: * Concrete class which provides the Taiwan calendar. michael@0: *
michael@0: * TaiwanCalendar
is a subclass of GregorianCalendar
michael@0: * that numbers years since 1912
michael@0: *
michael@0: * The Taiwan calendar is identical to the Gregorian calendar in all respects michael@0: * except for the year and era. Years are numbered since 1912 AD (Gregorian), michael@0: * so that 1912 AD (Gregorian) is equivalent to 1 MINGUO (Minguo Era) and 1998 AD is 87 MINGUO. michael@0: *
michael@0: * The Taiwan Calendar has two eras: BEFORE_MINGUO
and MINGUO
.
michael@0: *
michael@0: * @internal
michael@0: */
michael@0: class TaiwanCalendar : public GregorianCalendar {
michael@0: public:
michael@0:
michael@0: /**
michael@0: * Useful constants for TaiwanCalendar. Only one Era.
michael@0: * @internal
michael@0: */
michael@0: enum EEras {
michael@0: BEFORE_MINGUO = 0,
michael@0: MINGUO = 1
michael@0: };
michael@0:
michael@0: /**
michael@0: * Constructs a TaiwanCalendar 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 TaiwanCalendar object construction.
michael@0: * Returns U_ZERO_ERROR if constructed successfully.
michael@0: * @internal
michael@0: */
michael@0: TaiwanCalendar(const Locale& aLocale, UErrorCode& success);
michael@0:
michael@0:
michael@0: /**
michael@0: * Destructor
michael@0: * @internal
michael@0: */
michael@0: virtual ~TaiwanCalendar();
michael@0:
michael@0: /**
michael@0: * Copy constructor
michael@0: * @param source the object to be copied.
michael@0: * @internal
michael@0: */
michael@0: TaiwanCalendar(const TaiwanCalendar& source);
michael@0:
michael@0: /**
michael@0: * Default assignment operator
michael@0: * @param right the object to be copied.
michael@0: * @internal
michael@0: */
michael@0: TaiwanCalendar& operator=(const TaiwanCalendar& right);
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: 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: /**
michael@0: * return the calendar type, "Taiwan".
michael@0: *
michael@0: * @return calendar type
michael@0: * @internal
michael@0: */
michael@0: virtual const char * getType() const;
michael@0:
michael@0: private:
michael@0: TaiwanCalendar(); // default constructor not implemented
michael@0:
michael@0: protected:
michael@0: /**
michael@0: * Return the extended year defined by the current fields. This will
michael@0: * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such
michael@0: * as UCAL_ERA) specific to the calendar system, depending on which set of
michael@0: * fields is newer.
michael@0: * @return the extended year
michael@0: * @internal
michael@0: */
michael@0: virtual int32_t handleGetExtendedYear();
michael@0: /**
michael@0: * Subclasses may override this method to compute several fields
michael@0: * specific to each calendar system.
michael@0: * @internal
michael@0: */
michael@0: virtual void handleComputeFields(int32_t julianDay, UErrorCode& status);
michael@0: /**
michael@0: * Subclass API for defining limits of different types.
michael@0: * @param field one of the field numbers
michael@0: * @param limitType one of MINIMUM
, GREATEST_MINIMUM
,
michael@0: * LEAST_MAXIMUM
, or MAXIMUM
michael@0: * @internal
michael@0: */
michael@0: virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
michael@0:
michael@0: /**
michael@0: * Returns TRUE because the Taiwan Calendar does have a default century
michael@0: * @internal
michael@0: */
michael@0: virtual UBool haveDefaultCentury() const;
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: U_NAMESPACE_END
michael@0:
michael@0: #endif /* #if !UCONFIG_NO_FORMATTING */
michael@0:
michael@0: #endif // _TAIWNCAL
michael@0: //eof
michael@0: