1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/taiwncal.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,182 @@ 1.4 +/* 1.5 + ******************************************************************************** 1.6 + * Copyright (C) 2003-2013, International Business Machines Corporation 1.7 + * and others. All Rights Reserved. 1.8 + ******************************************************************************** 1.9 + * 1.10 + * File BUDDHCAL.H 1.11 + * 1.12 + * Modification History: 1.13 + * 1.14 + * Date Name Description 1.15 + * 05/13/2003 srl copied from gregocal.h 1.16 + * 06/29/2007 srl copied from buddhcal.h 1.17 + ******************************************************************************** 1.18 + */ 1.19 + 1.20 +#ifndef TAIWNCAL_H 1.21 +#define TAIWNCAL_H 1.22 + 1.23 +#include "unicode/utypes.h" 1.24 + 1.25 +#if !UCONFIG_NO_FORMATTING 1.26 + 1.27 +#include "unicode/calendar.h" 1.28 +#include "unicode/gregocal.h" 1.29 + 1.30 +U_NAMESPACE_BEGIN 1.31 + 1.32 +/** 1.33 + * Concrete class which provides the Taiwan calendar. 1.34 + * <P> 1.35 + * <code>TaiwanCalendar</code> is a subclass of <code>GregorianCalendar</code> 1.36 + * that numbers years since 1912 1.37 + * <p> 1.38 + * The Taiwan calendar is identical to the Gregorian calendar in all respects 1.39 + * except for the year and era. Years are numbered since 1912 AD (Gregorian), 1.40 + * so that 1912 AD (Gregorian) is equivalent to 1 MINGUO (Minguo Era) and 1998 AD is 87 MINGUO. 1.41 + * <p> 1.42 + * The Taiwan Calendar has two eras: <code>BEFORE_MINGUO</code> and <code>MINGUO</code>. 1.43 + * <p> 1.44 + * @internal 1.45 + */ 1.46 +class TaiwanCalendar : public GregorianCalendar { 1.47 +public: 1.48 + 1.49 + /** 1.50 + * Useful constants for TaiwanCalendar. Only one Era. 1.51 + * @internal 1.52 + */ 1.53 + enum EEras { 1.54 + BEFORE_MINGUO = 0, 1.55 + MINGUO = 1 1.56 + }; 1.57 + 1.58 + /** 1.59 + * Constructs a TaiwanCalendar based on the current time in the default time zone 1.60 + * with the given locale. 1.61 + * 1.62 + * @param aLocale The given locale. 1.63 + * @param success Indicates the status of TaiwanCalendar object construction. 1.64 + * Returns U_ZERO_ERROR if constructed successfully. 1.65 + * @internal 1.66 + */ 1.67 + TaiwanCalendar(const Locale& aLocale, UErrorCode& success); 1.68 + 1.69 + 1.70 + /** 1.71 + * Destructor 1.72 + * @internal 1.73 + */ 1.74 + virtual ~TaiwanCalendar(); 1.75 + 1.76 + /** 1.77 + * Copy constructor 1.78 + * @param source the object to be copied. 1.79 + * @internal 1.80 + */ 1.81 + TaiwanCalendar(const TaiwanCalendar& source); 1.82 + 1.83 + /** 1.84 + * Default assignment operator 1.85 + * @param right the object to be copied. 1.86 + * @internal 1.87 + */ 1.88 + TaiwanCalendar& operator=(const TaiwanCalendar& right); 1.89 + 1.90 + /** 1.91 + * Create and return a polymorphic copy of this calendar. 1.92 + * @return return a polymorphic copy of this calendar. 1.93 + * @internal 1.94 + */ 1.95 + virtual Calendar* clone(void) const; 1.96 + 1.97 +public: 1.98 + /** 1.99 + * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual 1.100 + * override. This method is to implement a simple version of RTTI, since not all C++ 1.101 + * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call 1.102 + * this method. 1.103 + * 1.104 + * @return The class ID for this object. All objects of a given class have the 1.105 + * same class ID. Objects of other classes have different class IDs. 1.106 + * @internal 1.107 + */ 1.108 + virtual UClassID getDynamicClassID(void) const; 1.109 + 1.110 + /** 1.111 + * Return the class ID for this class. This is useful only for comparing to a return 1.112 + * value from getDynamicClassID(). For example: 1.113 + * 1.114 + * Base* polymorphic_pointer = createPolymorphicObject(); 1.115 + * if (polymorphic_pointer->getDynamicClassID() == 1.116 + * Derived::getStaticClassID()) ... 1.117 + * 1.118 + * @return The class ID for all objects of this class. 1.119 + * @internal 1.120 + */ 1.121 + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); 1.122 + 1.123 + /** 1.124 + * return the calendar type, "Taiwan". 1.125 + * 1.126 + * @return calendar type 1.127 + * @internal 1.128 + */ 1.129 + virtual const char * getType() const; 1.130 + 1.131 +private: 1.132 + TaiwanCalendar(); // default constructor not implemented 1.133 + 1.134 + protected: 1.135 + /** 1.136 + * Return the extended year defined by the current fields. This will 1.137 + * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such 1.138 + * as UCAL_ERA) specific to the calendar system, depending on which set of 1.139 + * fields is newer. 1.140 + * @return the extended year 1.141 + * @internal 1.142 + */ 1.143 + virtual int32_t handleGetExtendedYear(); 1.144 + /** 1.145 + * Subclasses may override this method to compute several fields 1.146 + * specific to each calendar system. 1.147 + * @internal 1.148 + */ 1.149 + virtual void handleComputeFields(int32_t julianDay, UErrorCode& status); 1.150 + /** 1.151 + * Subclass API for defining limits of different types. 1.152 + * @param field one of the field numbers 1.153 + * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>, 1.154 + * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code> 1.155 + * @internal 1.156 + */ 1.157 + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; 1.158 + 1.159 + /** 1.160 + * Returns TRUE because the Taiwan Calendar does have a default century 1.161 + * @internal 1.162 + */ 1.163 + virtual UBool haveDefaultCentury() const; 1.164 + 1.165 + /** 1.166 + * Returns the date of the start of the default century 1.167 + * @return start of century - in milliseconds since epoch, 1970 1.168 + * @internal 1.169 + */ 1.170 + virtual UDate defaultCenturyStart() const; 1.171 + 1.172 + /** 1.173 + * Returns the year in which the default century begins 1.174 + * @internal 1.175 + */ 1.176 + virtual int32_t defaultCenturyStartYear() const; 1.177 +}; 1.178 + 1.179 +U_NAMESPACE_END 1.180 + 1.181 +#endif /* #if !UCONFIG_NO_FORMATTING */ 1.182 + 1.183 +#endif // _TAIWNCAL 1.184 +//eof 1.185 +