tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

taiwncal.h (4932B)


      1 // © 2016 and later: Unicode, Inc. and others.
      2 // License & terms of use: http://www.unicode.org/copyright.html
      3 /*
      4 ********************************************************************************
      5 * Copyright (C) 2003-2013, International Business Machines Corporation
      6 * and others. All Rights Reserved.
      7 ********************************************************************************
      8 *
      9 * File BUDDHCAL.H
     10 *
     11 * Modification History:
     12 *
     13 *   Date        Name        Description
     14 *   05/13/2003  srl          copied from gregocal.h
     15 *   06/29/2007  srl          copied from buddhcal.h
     16 ********************************************************************************
     17 */
     18 
     19 #ifndef TAIWNCAL_H
     20 #define TAIWNCAL_H
     21 
     22 #include "unicode/utypes.h"
     23 
     24 #if !UCONFIG_NO_FORMATTING
     25 
     26 #include "unicode/calendar.h"
     27 #include "unicode/gregocal.h"
     28 
     29 U_NAMESPACE_BEGIN
     30 
     31 /**
     32 * Concrete class which provides the Taiwan calendar.
     33 * <P>
     34 * <code>TaiwanCalendar</code> is a subclass of <code>GregorianCalendar</code>
     35 * that numbers years since 1912
     36 * <p>
     37 * The Taiwan calendar is identical to the Gregorian calendar in all respects
     38 * except for the year and era.  Years are numbered since 1912 AD (Gregorian),
     39 * so that 1912 AD (Gregorian) is equivalent to 1 MINGUO (Minguo Era) and 1998 AD is 87 MINGUO.
     40 * <p>
     41 * The Taiwan Calendar has two eras: <code>BEFORE_MINGUO</code> and <code>MINGUO</code>.
     42 * <p>
     43 * @internal
     44 */
     45 class TaiwanCalendar : public GregorianCalendar {
     46 public:
     47 
     48    /**
     49     * Useful constants for TaiwanCalendar.  Only one Era.
     50     * @internal
     51     */
     52    enum EEras {
     53       BEFORE_MINGUO = 0,
     54       MINGUO  = 1
     55    };
     56 
     57    /**
     58     * Constructs a TaiwanCalendar based on the current time in the default time zone
     59     * with the given locale.
     60     *
     61     * @param aLocale  The given locale.
     62     * @param success  Indicates the status of TaiwanCalendar object construction.
     63     *                 Returns U_ZERO_ERROR if constructed successfully.
     64     * @internal
     65     */
     66    TaiwanCalendar(const Locale& aLocale, UErrorCode& success);
     67 
     68 
     69    /**
     70     * Destructor
     71     * @internal
     72     */
     73    virtual ~TaiwanCalendar();
     74 
     75    /**
     76     * Copy constructor
     77     * @param source    the object to be copied.
     78     * @internal
     79     */
     80    TaiwanCalendar(const TaiwanCalendar& source);
     81 
     82    /**
     83     * Create and return a polymorphic copy of this calendar.
     84     * @return    return a polymorphic copy of this calendar.
     85     * @internal
     86     */
     87    virtual TaiwanCalendar* clone() const override;
     88 
     89 public:
     90    /**
     91     * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual
     92     * override. This method is to implement a simple version of RTTI, since not all C++
     93     * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
     94     * this method.
     95     *
     96     * @return   The class ID for this object. All objects of a given class have the
     97     *           same class ID. Objects of other classes have different class IDs.
     98     * @internal
     99     */
    100    virtual UClassID getDynamicClassID() const override;
    101 
    102    /**
    103     * Return the class ID for this class. This is useful only for comparing to a return
    104     * value from getDynamicClassID(). For example:
    105     *
    106     *      Base* polymorphic_pointer = createPolymorphicObject();
    107     *      if (polymorphic_pointer->getDynamicClassID() ==
    108     *          Derived::getStaticClassID()) ...
    109     *
    110     * @return   The class ID for all objects of this class.
    111     * @internal
    112     */
    113    U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
    114 
    115    /**
    116     * return the calendar type, "Taiwan".
    117     *
    118     * @return calendar type
    119     * @internal
    120     */
    121    virtual const char * getType() const override;
    122 
    123 private:
    124    TaiwanCalendar(); // default constructor not implemented
    125 
    126 protected:
    127     /**
    128     * Return the extended year defined by the current fields.  This will
    129     * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such
    130     * as UCAL_ERA) specific to the calendar system, depending on which set of
    131     * fields is newer.
    132     * @return the extended year
    133     * @internal
    134     */
    135    virtual int32_t handleGetExtendedYear(UErrorCode& status) override;
    136    /**
    137     * Subclasses may override this method to compute several fields
    138     * specific to each calendar system.  
    139     * @internal
    140     */
    141    virtual void handleComputeFields(int32_t julianDay, UErrorCode& status) override;
    142    /**
    143     * Subclass API for defining limits of different types.
    144     * @param field one of the field numbers
    145     * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>,
    146     * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code>
    147     * @internal
    148     */
    149    virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override;
    150 
    151    DECLARE_OVERRIDE_SYSTEM_DEFAULT_CENTURY
    152 };
    153 
    154 U_NAMESPACE_END
    155 
    156 #endif /* #if !UCONFIG_NO_FORMATTING */
    157 
    158 #endif // _TAIWNCAL
    159 //eof