]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/japancal.h
ICU-461.18.tar.gz
[apple/icu.git] / icuSources / i18n / japancal.h
index 445878395c159e9da4b8c50eb65e8c8d723167e3..4219d6a5231acd8f17d11303f7d0b3e8392f15d1 100644 (file)
@@ -1,15 +1,17 @@
 /*
-* Copyright (C) 2003, International Business Machines Corporation and others. All Rights Reserved.
-********************************************************************************
-*
-* File JAPANCAL.H
-*
-* Modification History:
-*
-*   Date        Name        Description
-*   05/13/2003  srl         copied from gregocal.h
-********************************************************************************
-*/
+ ********************************************************************************
+ * Copyright (C) 2003-2008, International Business Machines Corporation
+ * and others. All Rights Reserved.
+ ********************************************************************************
+ *
+ * File JAPANCAL.H
+ *
+ * Modification History:
+ *
+ *   Date        Name        Description
+ *   05/13/2003  srl         copied from gregocal.h
+ ********************************************************************************
+ */
 
 #ifndef JAPANCAL_H
 #define JAPANCAL_H
@@ -51,14 +53,14 @@ U_NAMESPACE_BEGIN
  * <p>
  * @internal
  */
-class U_I18N_API JapaneseCalendar : public GregorianCalendar {
+class JapaneseCalendar : public GregorianCalendar {
 public:
 
     /**
      * Useful constants for JapaneseCalendar.  
      * @internal
      */
-    static const uint32_t kCurrentEra; // the current era
+    U_I18N_API static uint32_t U_EXPORT2 getCurrentEra(void); // the current era
 
     /**
      * Constructs a JapaneseCalendar based on the current time in the default time zone
@@ -99,10 +101,21 @@ public:
      */
     virtual Calendar* clone(void) const;
 
-    
+    /**
+     * Return the extended year defined by the current fields.  In the 
+     * Japanese calendar case, this is equal to the equivalent extended Gregorian year.
+     * @internal
+     */
+    virtual int32_t handleGetExtendedYear();
+
+    /**
+     * Return the maximum value that this field could have, given the current date.
+     * @internal
+     */
+    virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
 
-public:
 
+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++
@@ -126,7 +139,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, "japanese".
@@ -137,74 +150,68 @@ public:
     virtual const char * getType() const;
 
     /**
+     * @return FALSE - no default century in Japanese
      * @internal 
-     * @return TRUE if this calendar has the notion of a default century
      */
     virtual UBool haveDefaultCentury() const;
-    virtual UDate defaultCenturyStart() const;
-    virtual int32_t defaultCenturyStartYear() const;
 
-    /** 
+    /**
+     * Not used - no default century.
+     * @internal
+     */
+    virtual UDate defaultCenturyStart() const;
+    /**
+     * Not used - no default century.
      * @internal
-     * API overrides
      */
-    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); }
+    virtual int32_t defaultCenturyStartYear() const;
 
 private:
     JapaneseCalendar(); // 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;
+    /** 
+     * Calculate the era for internal computation
+     * @internal
+     */
     virtual int32_t internalGetEra() const;
-    virtual void timeToFields(UDate theTime, UBool quick, UErrorCode& status);
 
     /**
-     * (Overrides Calendar) Converts Calendar's time field values to GMT as
-     * milliseconds. In this case, we have to be concerned with filling in inconsistent
-     * information. For example, if the year and era only are set, need to make sure
-     * month & date are set correctly.  Ex, 'Heisei 1' starts Jan 8th, not Jan 1st.  
-     * Default month and date values will end up giving the wrong Era.
-     *
-     * @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.
-     * @stable ICU 2.0
+     * Compute fields from the JD
+     * @internal
+     */
+    virtual void handleComputeFields(int32_t julianDay, UErrorCode& status);
+
+    /**
+     * Calculate the limit for a specified type of limit and field
+     * @internal
      */
+    virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
 
     /***
      * Called by computeJulianDay.  Returns the default month (0-based) for the year,
-     * taking year and era into account.  Defaults to 0 for Gregorian, which doesn't care.
+     * taking year and era into account.  Will return the first month of the given era, if 
+     * the current year is an ascension year.
+     * @param eyear the extended year
+     * @internal
      */
-    virtual int32_t getDefaultMonthInYear() const;
-
+    virtual int32_t getDefaultMonthInYear(int32_t eyear);
 
     /***
      * Called by computeJulianDay.  Returns the default day (1-based) for the month,
-     * taking currently-set year and era into account.  Defaults to 1 for Gregorian, which doesn't care. 
+     * taking currently-set year and era into account.  Will return the first day of the given
+     * era, if the current month is an ascension year and month.
+     * @param eyear the extended year
+     * @param mon the month in the year
+     * @internal
      */
-    virtual int32_t getDefaultDayInMonth(int32_t month) const;
+    virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
 };
 
-inline UClassID
-JapaneseCalendar::getStaticClassID(void)
-{ return (UClassID)&fgClassID; }
-
-inline UClassID
-JapaneseCalendar::getDynamicClassID(void) const
-{ return JapaneseCalendar::getStaticClassID(); }
-
-
 U_NAMESPACE_END
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
 
-#endif // _GREGOCAL
+#endif
 //eof