intl/icu/source/i18n/buddhcal.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/i18n/buddhcal.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,200 @@
     1.4 +/*
     1.5 + ********************************************************************************
     1.6 + * Copyright (C) 2003-2013, International Business Machines Corporation
     1.7 + * and others. All Rights Reserved.
     1.8 + ********************************************************************************
     1.9 + *
    1.10 + * File BUDDHCAL.H
    1.11 + *
    1.12 + * Modification History:
    1.13 + *
    1.14 + *   Date        Name        Description
    1.15 + *   05/13/2003  srl          copied from gregocal.h
    1.16 + ********************************************************************************
    1.17 + */
    1.18 +
    1.19 +#ifndef BUDDHCAL_H
    1.20 +#define BUDDHCAL_H
    1.21 +
    1.22 +#include "unicode/utypes.h"
    1.23 +
    1.24 +#if !UCONFIG_NO_FORMATTING
    1.25 +
    1.26 +#include "unicode/calendar.h"
    1.27 +#include "unicode/gregocal.h"
    1.28 +
    1.29 +U_NAMESPACE_BEGIN
    1.30 +
    1.31 +/**
    1.32 + * Concrete class which provides the Buddhist calendar.
    1.33 + * <P>
    1.34 + * <code>BuddhistCalendar</code> is a subclass of <code>GregorianCalendar</code>
    1.35 + * that numbers years since the birth of the Buddha.  This is the civil calendar
    1.36 + * in some predominantly Buddhist countries such as Thailand, and it is used for
    1.37 + * religious purposes elsewhere.
    1.38 + * <p>
    1.39 + * The Buddhist calendar is identical to the Gregorian calendar in all respects
    1.40 + * except for the year and era.  Years are numbered since the birth of the
    1.41 + * Buddha in 543 BC (Gregorian), so that 1 AD (Gregorian) is equivalent to 544
    1.42 + * BE (Buddhist Era) and 1998 AD is 2541 BE.
    1.43 + * <p>
    1.44 + * The Buddhist Calendar has only one allowable era: <code>BE</code>.  If the
    1.45 + * calendar is not in lenient mode (see <code>setLenient</code>), dates before
    1.46 + * 1/1/1 BE are rejected as an illegal argument.
    1.47 + * <p>
    1.48 + * @internal
    1.49 + */
    1.50 +class BuddhistCalendar : public GregorianCalendar {
    1.51 +public:
    1.52 +
    1.53 +    /**
    1.54 +     * Useful constants for BuddhistCalendar.  Only one Era.
    1.55 +     * @internal
    1.56 +     */
    1.57 +    enum EEras {
    1.58 +       BE
    1.59 +    };
    1.60 +
    1.61 +    /**
    1.62 +     * Constructs a BuddhistCalendar based on the current time in the default time zone
    1.63 +     * with the given locale.
    1.64 +     *
    1.65 +     * @param aLocale  The given locale.
    1.66 +     * @param success  Indicates the status of BuddhistCalendar object construction.
    1.67 +     *                 Returns U_ZERO_ERROR if constructed successfully.
    1.68 +     * @internal
    1.69 +     */
    1.70 +    BuddhistCalendar(const Locale& aLocale, UErrorCode& success);
    1.71 +
    1.72 +
    1.73 +    /**
    1.74 +     * Destructor
    1.75 +     * @internal
    1.76 +     */
    1.77 +    virtual ~BuddhistCalendar();
    1.78 +
    1.79 +    /**
    1.80 +     * Copy constructor
    1.81 +     * @param source    the object to be copied.
    1.82 +     * @internal
    1.83 +     */
    1.84 +    BuddhistCalendar(const BuddhistCalendar& source);
    1.85 +
    1.86 +    /**
    1.87 +     * Default assignment operator
    1.88 +     * @param right    the object to be copied.
    1.89 +     * @internal
    1.90 +     */
    1.91 +    BuddhistCalendar& operator=(const BuddhistCalendar& right);
    1.92 +
    1.93 +    /**
    1.94 +     * Create and return a polymorphic copy of this calendar.
    1.95 +     * @return    return a polymorphic copy of this calendar.
    1.96 +     * @internal
    1.97 +     */
    1.98 +    virtual Calendar* clone(void) const;
    1.99 +
   1.100 +public:
   1.101 +    /**
   1.102 +     * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual
   1.103 +     * override. This method is to implement a simple version of RTTI, since not all C++
   1.104 +     * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
   1.105 +     * this method.
   1.106 +     *
   1.107 +     * @return   The class ID for this object. All objects of a given class have the
   1.108 +     *           same class ID. Objects of other classes have different class IDs.
   1.109 +     * @internal
   1.110 +     */
   1.111 +    virtual UClassID getDynamicClassID(void) const;
   1.112 +
   1.113 +    /**
   1.114 +     * Return the class ID for this class. This is useful only for comparing to a return
   1.115 +     * value from getDynamicClassID(). For example:
   1.116 +     *
   1.117 +     *      Base* polymorphic_pointer = createPolymorphicObject();
   1.118 +     *      if (polymorphic_pointer->getDynamicClassID() ==
   1.119 +     *          Derived::getStaticClassID()) ...
   1.120 +     *
   1.121 +     * @return   The class ID for all objects of this class.
   1.122 +     * @internal
   1.123 +     */
   1.124 +    U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);
   1.125 +
   1.126 +    /**
   1.127 +     * return the calendar type, "buddhist".
   1.128 +     *
   1.129 +     * @return calendar type
   1.130 +     * @internal
   1.131 +     */
   1.132 +    virtual const char * getType() const;
   1.133 +
   1.134 +private:
   1.135 +    BuddhistCalendar(); // default constructor not implemented
   1.136 +
   1.137 + protected:
   1.138 +    /**
   1.139 +     * Return the extended year defined by the current fields.  This will
   1.140 +     * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such
   1.141 +     * as UCAL_ERA) specific to the calendar system, depending on which set of
   1.142 +     * fields is newer.
   1.143 +     * @return the extended year
   1.144 +     * @internal
   1.145 +     */
   1.146 +    virtual int32_t handleGetExtendedYear();
   1.147 +    /**
   1.148 +     * Subclasses may override this method to compute several fields
   1.149 +     * specific to each calendar system.  
   1.150 +     * @internal
   1.151 +     */
   1.152 +    virtual void handleComputeFields(int32_t julianDay, UErrorCode& status);
   1.153 +    /**
   1.154 +     * Subclass API for defining limits of different types.
   1.155 +     * @param field one of the field numbers
   1.156 +     * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>,
   1.157 +     * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code>
   1.158 +     * @internal
   1.159 +     */
   1.160 +    virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
   1.161 +        /**
   1.162 +     * Return the Julian day number of day before the first day of the
   1.163 +     * given month in the given extended year.  Subclasses should override
   1.164 +     * this method to implement their calendar system.
   1.165 +     * @param eyear the extended year
   1.166 +     * @param month the zero-based month, or 0 if useMonth is false
   1.167 +     * @param useMonth if false, compute the day before the first day of
   1.168 +     * the given year, otherwise, compute the day before the first day of
   1.169 +     * the given month
   1.170 +     * @param return the Julian day number of the day before the first
   1.171 +     * day of the given month and year
   1.172 +     * @internal
   1.173 +     */
   1.174 +    virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
   1.175 +                                            UBool useMonth) const;
   1.176 +
   1.177 +    /**
   1.178 +     * Returns TRUE because the Buddhist Calendar does have a default century
   1.179 +     * @internal
   1.180 +     */
   1.181 +    virtual UBool haveDefaultCentury() const;
   1.182 +
   1.183 +    /**
   1.184 +     * Returns the date of the start of the default century
   1.185 +     * @return start of century - in milliseconds since epoch, 1970
   1.186 +     * @internal
   1.187 +     */
   1.188 +    virtual UDate defaultCenturyStart() const;
   1.189 +
   1.190 +    /**
   1.191 +     * Returns the year in which the default century begins
   1.192 +     * @internal
   1.193 +     */
   1.194 +    virtual int32_t defaultCenturyStartYear() const;
   1.195 +};
   1.196 +
   1.197 +U_NAMESPACE_END
   1.198 +
   1.199 +#endif /* #if !UCONFIG_NO_FORMATTING */
   1.200 +
   1.201 +#endif // _GREGOCAL
   1.202 +//eof
   1.203 +

mercurial