// © 2016 and later: Unicode, Inc. and others.1// License & terms of use: http://www.unicode.org/copyright.html2/*3********************************************************************************4* Copyright (C) 2003-2013, International Business Machines Corporation5* and others. All Rights Reserved.6********************************************************************************7*8* File BUDDHCAL.H9*10* Modification History:11*12* Date Name Description13* 05/13/2003 srl copied from gregocal.h14********************************************************************************15*/1617#ifndef BUDDHCAL_H18#define BUDDHCAL_H1920#include "unicode/utypes.h"2122#if !UCONFIG_NO_FORMATTING2324#include "unicode/calendar.h"25#include "unicode/gregocal.h"2627U_NAMESPACE_BEGIN2829/**30* Concrete class which provides the Buddhist calendar.31* <P>32* <code>BuddhistCalendar</code> is a subclass of <code>GregorianCalendar</code>33* that numbers years since the birth of the Buddha. This is the civil calendar34* in some predominantly Buddhist countries such as Thailand, and it is used for35* religious purposes elsewhere.36* <p>37* The Buddhist calendar is identical to the Gregorian calendar in all respects38* except for the year and era. Years are numbered since the birth of the39* Buddha in 543 BC (Gregorian), so that 1 AD (Gregorian) is equivalent to 54440* BE (Buddhist Era) and 1998 AD is 2541 BE.41* <p>42* The Buddhist Calendar has only one allowable era: <code>BE</code>. If the43* calendar is not in lenient mode (see <code>setLenient</code>), dates before44* 1/1/1 BE are rejected as an illegal argument.45* <p>46* @internal47*/48class BuddhistCalendar : public GregorianCalendar {49public:5051/**52* Useful constants for BuddhistCalendar. Only one Era.53* @internal54*/55enum EEras {56BE57};5859/**60* Constructs a BuddhistCalendar based on the current time in the default time zone61* with the given locale.62*63* @param aLocale The given locale.64* @param success Indicates the status of BuddhistCalendar object construction.65* Returns U_ZERO_ERROR if constructed successfully.66* @internal67*/68BuddhistCalendar(const Locale& aLocale, UErrorCode& success);697071/**72* Destructor73* @internal74*/75virtual ~BuddhistCalendar();7677/**78* Copy constructor79* @param source the object to be copied.80* @internal81*/82BuddhistCalendar(const BuddhistCalendar& source);8384/**85* Default assignment operator86* @param right the object to be copied.87* @internal88*/89BuddhistCalendar& operator=(const BuddhistCalendar& right);9091/**92* Create and return a polymorphic copy of this calendar.93* @return return a polymorphic copy of this calendar.94* @internal95*/96virtual BuddhistCalendar* clone() const override;9798public:99/**100* Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual101* override. This method is to implement a simple version of RTTI, since not all C++102* compilers support genuine RTTI. Polymorphic operator==() and clone() methods call103* this method.104*105* @return The class ID for this object. All objects of a given class have the106* same class ID. Objects of other classes have different class IDs.107* @internal108*/109virtual UClassID getDynamicClassID(void) const override;110111/**112* Return the class ID for this class. This is useful only for comparing to a return113* value from getDynamicClassID(). For example:114*115* Base* polymorphic_pointer = createPolymorphicObject();116* if (polymorphic_pointer->getDynamicClassID() ==117* Derived::getStaticClassID()) ...118*119* @return The class ID for all objects of this class.120* @internal121*/122U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);123124/**125* return the calendar type, "buddhist".126*127* @return calendar type128* @internal129*/130virtual const char * getType() const override;131132private:133BuddhistCalendar(); // default constructor not implemented134135protected:136/**137* Return the extended year defined by the current fields. This will138* use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such139* as UCAL_ERA) specific to the calendar system, depending on which set of140* fields is newer.141* @return the extended year142* @internal143*/144virtual int32_t handleGetExtendedYear() override;145/**146* Subclasses may override this method to compute several fields147* specific to each calendar system.148* @internal149*/150virtual void handleComputeFields(int32_t julianDay, UErrorCode& status) override;151/**152* Subclass API for defining limits of different types.153* @param field one of the field numbers154* @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>,155* <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code>156* @internal157*/158virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override;159/**160* Return the Julian day number of day before the first day of the161* given month in the given extended year. Subclasses should override162* this method to implement their calendar system.163* @param eyear the extended year164* @param month the zero-based month, or 0 if useMonth is false165* @param useMonth if false, compute the day before the first day of166* the given year, otherwise, compute the day before the first day of167* the given month168* @param return the Julian day number of the day before the first169* day of the given month and year170* @internal171*/172virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,173UBool useMonth) const override;174175/**176* Returns true because the Buddhist Calendar does have a default century177* @internal178*/179virtual UBool haveDefaultCentury() const override;180181/**182* Returns the date of the start of the default century183* @return start of century - in milliseconds since epoch, 1970184* @internal185*/186virtual UDate defaultCenturyStart() const override;187188/**189* Returns the year in which the default century begins190* @internal191*/192virtual int32_t defaultCenturyStartYear() const override;193};194195U_NAMESPACE_END196197#endif /* #if !UCONFIG_NO_FORMATTING */198199#endif // _GREGOCAL200//eof201202203