/*
-* Copyright (C) 2003, International Business Machines Corporation and others. All Rights Reserved.
-********************************************************************************
-*
-* File BUDDHCAL.H
-*
-* Modification History:
-*
-* Date Name Description
-* 05/13/2003 srl copied from gregocal.h
-********************************************************************************
-*/
+ ********************************************************************************
+ * Copyright (C) 2003-2007, International Business Machines Corporation
+ * and others. All Rights Reserved.
+ ********************************************************************************
+ *
+ * File BUDDHCAL.H
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ * 05/13/2003 srl copied from gregocal.h
+ ********************************************************************************
+ */
#ifndef BUDDHCAL_H
#define BUDDHCAL_H
* <p>
* @internal
*/
-class U_I18N_API BuddhistCalendar : public GregorianCalendar {
+class BuddhistCalendar : public GregorianCalendar {
public:
/**
* @param aLocale The given locale.
* @param success Indicates the status of BuddhistCalendar object construction.
* Returns U_ZERO_ERROR if constructed successfully.
- * @stable ICU 2.0
+ * @internal
*/
BuddhistCalendar(const Locale& aLocale, UErrorCode& success);
*/
virtual Calendar* clone(void) const;
-
-
public:
-
/**
* Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual
* override. This method is to implement a simple version of RTTI, since not all C++
* @return The class ID for all objects of this class.
* @internal
*/
- static inline UClassID getStaticClassID(void);
+ U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);
/**
* return the calendar type, "buddhist".
*/
virtual const char * getType() const;
- /**
- * (Overrides Calendar) UDate Arithmetic function. Adds the specified (signed) amount
- * of time to the given time field, based on the calendar's rules. For more
- * information, see the documentation for Calendar::add().
- *
- * @param field The time field.
- * @param amount The amount of date or time to be added to the field.
- * @param status Output param set to success/failure code on exit. If any value
- * previously set in the time field is invalid, this will be set to
- * an error status.
- * @draft ICU 2.6.
- */
- virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status);
-
- /**
- * API overrides
- * @private
- */
- int32_t getMaximum(UCalendarDateFields field) const;
- int32_t getLeastMaximum(UCalendarDateFields field) const;
- inline virtual int32_t getMaximum(EDateFields field) const { return getMaximum((UCalendarDateFields)field); }
- inline virtual int32_t getLeastMaximum(EDateFields field) const { return getLeastMaximum((UCalendarDateFields)field); }
- inline virtual void add(EDateFields field, int32_t amount, UErrorCode& status) { add((UCalendarDateFields)field, amount, status); }
-
-
private:
BuddhistCalendar(); // default constructor not implemented
- static const char fgClassID;
-
protected:
- virtual int32_t monthLength(int32_t month) const;
- virtual int32_t monthLength(int32_t month, int32_t year) const;
- int32_t getGregorianYear(UErrorCode& status) const;
+ /**
+ * Return the extended year defined by the current fields. This will
+ * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such
+ * as UCAL_ERA) specific to the calendar system, depending on which set of
+ * fields is newer.
+ * @return the extended year
+ * @internal
+ */
+ virtual int32_t handleGetExtendedYear();
+ /**
+ * Subclasses may override this method to compute several fields
+ * specific to each calendar system.
+ * @internal
+ */
+ virtual void handleComputeFields(int32_t julianDay, UErrorCode& status);
+ /**
+ * Subclass API for defining limits of different types.
+ * @param field one of the field numbers
+ * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>,
+ * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code>
+ * @internal
+ */
+ virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
+ /**
+ * Return the Julian day number of day before the first day of the
+ * given month in the given extended year. Subclasses should override
+ * this method to implement their calendar system.
+ * @param eyear the extended year
+ * @param month the zero-based month, or 0 if useMonth is false
+ * @param useMonth if false, compute the day before the first day of
+ * the given year, otherwise, compute the day before the first day of
+ * the given month
+ * @param return the Julian day number of the day before the first
+ * day of the given month and year
+ * @internal
+ */
+ virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
+ UBool useMonth) const;
- virtual int32_t internalGetEra() const;
- virtual void timeToFields(UDate theTime, UBool quick, UErrorCode& status);
+ /**
+ * Returns TRUE because the Buddhist Calendar does have a default century
+ * @internal
+ */
virtual UBool haveDefaultCentury() const;
+
+ /**
+ * Returns the date of the start of the default century
+ * @return start of century - in milliseconds since epoch, 1970
+ * @internal
+ */
virtual UDate defaultCenturyStart() const;
+
+ /**
+ * Returns the year in which the default century begins
+ * @internal
+ */
virtual int32_t defaultCenturyStartYear() const;
private: // default century stuff.
*/
static const int32_t fgSystemDefaultCenturyYear;
+ /**
+ * start of default century, as a date
+ */
static const UDate fgSystemDefaultCentury;
/**
- * Returns the beginning date of the 100-year window that dates with 2-digit years
- * are considered to fall within.
- * @return the beginning date of the 100-year window that dates with 2-digit years
- * are considered to fall within.
+ * Returns the beginning date of the 100-year window that dates
+ * with 2-digit years are considered to fall within.
*/
UDate internalGetDefaultCenturyStart(void) const;
/**
- * Returns the first year of the 100-year window that dates with 2-digit years
- * are considered to fall within.
- * @return the first year of the 100-year window that dates with 2-digit years
- * are considered to fall within.
+ * Returns the first year of the 100-year window that dates with
+ * 2-digit years are considered to fall within.
*/
int32_t internalGetDefaultCenturyStartYear(void) const;
/**
- * Initializes the 100-year window that dates with 2-digit years are considered
- * to fall within so that its start date is 80 years before the current time.
+ * Initializes the 100-year window that dates with 2-digit years
+ * are considered to fall within so that its start date is 80 years
+ * before the current time.
*/
static void initializeSystemDefaultCentury(void);
};
-inline UClassID
-BuddhistCalendar::getStaticClassID(void)
-{ return (UClassID)&fgClassID; }
-
-inline UClassID
-BuddhistCalendar::getDynamicClassID(void) const
-{ return BuddhistCalendar::getStaticClassID(); }
-
-
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */