X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..03115e547b9a040702fdddc7f9bf4c315a8c62a7:/icuSources/i18n/buddhcal.h diff --git a/icuSources/i18n/buddhcal.h b/icuSources/i18n/buddhcal.h index 13681324..bb3316b4 100644 --- a/icuSources/i18n/buddhcal.h +++ b/icuSources/i18n/buddhcal.h @@ -1,15 +1,16 @@ /* -* 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-2004, 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 @@ -60,7 +61,7 @@ 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); @@ -92,10 +93,7 @@ public: */ 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++ @@ -119,7 +117,7 @@ public: * @return The class ID for all objects of this class. * @internal */ - static inline UClassID getStaticClassID(void); + static UClassID U_EXPORT2 getStaticClassID(void); /** * return the calendar type, "buddhist". @@ -139,35 +137,126 @@ public: * @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. + * @draft ICU 2.6 */ virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status); /** - * API overrides - * @private + * Gets the maximum value for the given time field. e.g. for DAY_OF_MONTH, + * 31. + * + * @param field The given time field. + * @return The maximum value for the given time field. + * @draft ICU 2.6 */ int32_t getMaximum(UCalendarDateFields field) const; + + /** + * Gets the lowest maximum value for the given field if varies. Otherwise same as + * getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28. + * + * @param field The given time field. + * @return The lowest maximum value for the given time field. + * @draft ICU 2.6 + */ int32_t getLeastMaximum(UCalendarDateFields field) const; + + /** + * @deprecated ICU 2.6 use UCalendarDateFields instead of EDateFields + */ inline virtual int32_t getMaximum(EDateFields field) const { return getMaximum((UCalendarDateFields)field); } + /** + * @deprecated ICU 2.6 use UCalendarDateFields instead of EDateFields + */ inline virtual int32_t getLeastMaximum(EDateFields field) const { return getLeastMaximum((UCalendarDateFields)field); } + /** + * @deprecated ICU 2.6 use UCalendarDateFields instead of EDateFields + */ 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: + /** + * 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 MINIMUM, GREATEST_MINIMUM, + * LEAST_MAXIMUM, or MAXIMUM + * @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; + + /** + * month length of current month + * @internal + */ virtual int32_t monthLength(int32_t month) const; + /** + * month length of month + * @internal + */ virtual int32_t monthLength(int32_t month, int32_t year) const; + + /** + * month length of current month + * @internal + */ int32_t getGregorianYear(UErrorCode& status) const; + /** + * Calculate the era for internal computation + * @internal + */ 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. @@ -189,40 +278,31 @@ private: */ 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 */