]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/buddhcal.h
ICU-62141.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / buddhcal.h
index 13681324fced99c36a56d760fcafdcc2fd4394db..88509ba9037293131dec412668968ef33b7d0cd9 100644 (file)
@@ -1,15 +1,19 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
-* 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-2013, 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
@@ -42,7 +46,7 @@ U_NAMESPACE_BEGIN
  * <p>
  * @internal
  */
-class U_I18N_API BuddhistCalendar : public GregorianCalendar {
+class BuddhistCalendar : public GregorianCalendar {
 public:
 
     /**
@@ -60,7 +64,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 +96,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 +120,7 @@ public:
      * @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".
@@ -129,100 +130,69 @@ public:
      */
     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;
-
-    virtual int32_t internalGetEra() const;
-    virtual void timeToFields(UDate theTime, UBool quick, UErrorCode& status);
-    virtual UBool haveDefaultCentury() const;
-    virtual UDate defaultCenturyStart() const;
-    virtual int32_t defaultCenturyStartYear() const;
-
- private: // default century stuff.
     /**
-     * The system maintains a static default century start date.  This is initialized
-     * the first time it is used.  Before then, it is set to SYSTEM_DEFAULT_CENTURY to
-     * indicate an uninitialized state.  Once the system default century date and year
-     * are set, they do not change.
+     * 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
      */
-    static UDate         fgSystemDefaultCenturyStart;
-
+    virtual int32_t handleGetExtendedYear();
     /**
-     * See documentation for systemDefaultCenturyStart.
+     * Subclasses may override this method to compute several fields
+     * specific to each calendar system.  
+     * @internal
      */
-    static int32_t          fgSystemDefaultCenturyStartYear;
-
+    virtual void handleComputeFields(int32_t julianDay, UErrorCode& status);
     /**
-     * Default value that indicates the defaultCenturyStartYear is unitialized
+     * 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
      */
-    static const int32_t    fgSystemDefaultCenturyYear;
-
-    static const UDate        fgSystemDefaultCentury;
+    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;
 
     /**
-     * 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 TRUE because the Buddhist Calendar does have a default century
+     * @internal
      */
-    UDate         internalGetDefaultCenturyStart(void) const;
+    virtual UBool haveDefaultCentury() 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 date of the start of the default century
+     * @return start of century - in milliseconds since epoch, 1970
+     * @internal
      */
-    int32_t          internalGetDefaultCenturyStartYear(void) const;
+    virtual UDate defaultCenturyStart() 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.
+     * Returns the year in which the default century begins
+     * @internal
      */
-    static void  initializeSystemDefaultCentury(void);
+    virtual int32_t defaultCenturyStartYear() const;
 };
 
-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 */