| 1 |
// © 2022 and later: Unicode, Inc. and others. |
| 2 |
// License & terms of use: http://www.unicode.org/copyright.html |
| 3 |
#ifndef ISO8601CAL_H |
| 4 |
#define ISO8601CAL_H |
| 5 |
|
| 6 |
#include "unicode/utypes.h" |
| 7 |
|
| 8 |
#if !UCONFIG_NO_FORMATTING |
| 9 |
|
| 10 |
#include "unicode/calendar.h" |
| 11 |
#include "unicode/gregocal.h" |
| 12 |
#include "unicode/timezone.h" |
| 13 |
|
| 14 |
U_NAMESPACE_BEGIN |
| 15 |
|
| 16 |
/** |
| 17 |
* Concrete class which provides the ISO8601 calendar. |
| 18 |
* <P> |
| 19 |
* <code>ISO8601Calendar</code> is a subclass of <code>GregorianCalendar</code> |
| 20 |
* that the first day of a week is Monday and the minimal days in the first |
| 21 |
* week of a year or month is four days. |
| 22 |
* <p> |
| 23 |
* The ISO8601 calendar is identical to the Gregorian calendar in all respects |
| 24 |
* except for the first day of week and the minimal days in the first week |
| 25 |
* of a year. |
| 26 |
* @internal |
| 27 |
*/ |
| 28 |
class ISO8601Calendar : public GregorianCalendar { |
| 29 |
public: |
| 30 |
//------------------------------------------------------------------------- |
| 31 |
// Constructors... |
| 32 |
//------------------------------------------------------------------------- |
| 33 |
|
| 34 |
/** |
| 35 |
* Constructs a DangiCalendar based on the current time in the default time zone |
| 36 |
* with the given locale. |
| 37 |
* |
| 38 |
* @param aLocale The given locale. |
| 39 |
* @param success Indicates the status of ISO8601Calendar object construction. |
| 40 |
* Returns U_ZERO_ERROR if constructed successfully. |
| 41 |
* @internal |
| 42 |
*/ |
| 43 |
ISO8601Calendar(const Locale& aLocale, UErrorCode &success); |
| 44 |
|
| 45 |
/** |
| 46 |
* Copy Constructor |
| 47 |
* @internal |
| 48 |
*/ |
| 49 |
ISO8601Calendar(const ISO8601Calendar& other) = default; |
| 50 |
|
| 51 |
/** |
| 52 |
* Destructor. |
| 53 |
* @internal |
| 54 |
*/ |
| 55 |
virtual ~ISO8601Calendar(); |
| 56 |
|
| 57 |
/** |
| 58 |
* Clone. |
| 59 |
* @internal |
| 60 |
*/ |
| 61 |
virtual ISO8601Calendar* clone() const override; |
| 62 |
|
| 63 |
// UObject stuff |
| 64 |
public: |
| 65 |
/** |
| 66 |
* @return The class ID for this object. All objects of a given class have the |
| 67 |
* same class ID. Objects of other classes have different class IDs. |
| 68 |
* @internal |
| 69 |
*/ |
| 70 |
virtual UClassID getDynamicClassID() const override; |
| 71 |
|
| 72 |
/** |
| 73 |
* Return the class ID for this class. This is useful only for comparing to a return |
| 74 |
* value from getDynamicClassID(). For example: |
| 75 |
* |
| 76 |
* Base* polymorphic_pointer = createPolymorphicObject(); |
| 77 |
* if (polymorphic_pointer->getDynamicClassID() == |
| 78 |
* Derived::getStaticClassID()) ... |
| 79 |
* |
| 80 |
* @return The class ID for all objects of this class. |
| 81 |
* @internal |
| 82 |
*/ |
| 83 |
U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); |
| 84 |
|
| 85 |
/** |
| 86 |
* return the calendar type, "iso8601". |
| 87 |
* |
| 88 |
* @return calendar type |
| 89 |
* @internal |
| 90 |
*/ |
| 91 |
virtual const char * getType() const override; |
| 92 |
|
| 93 |
protected: |
| 94 |
virtual bool isEra0CountingBackward() const override { return false; } |
| 95 |
|
| 96 |
private: |
| 97 |
|
| 98 |
ISO8601Calendar(); // default constructor not implemented |
| 99 |
}; |
| 100 |
|
| 101 |
U_NAMESPACE_END |
| 102 |
|
| 103 |
#endif |
| 104 |
#endif |