Debian Codegraph @

intl/icu/source/i18n/cecal.h

raw
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 - 2008, International Business Machines Corporation and *
6 * others. All Rights Reserved. *
7 *******************************************************************************
8 */
9
10 #ifndef CECAL_H
11 #define CECAL_H
12
13 #include "unicode/utypes.h"
14
15 #if !UCONFIG_NO_FORMATTING
16
17 #include "unicode/calendar.h"
18
19 U_NAMESPACE_BEGIN
20
21 /**
22 * Base class for EthiopicCalendar and CopticCalendar.
23 * @internal
24 */
25 class U_I18N_API CECalendar : public Calendar {
26
27 public:
28
29 /**
30 * Gets The Temporal monthCode value corresponding to the month for the date.
31 * The value is a string identifier that starts with the literal grapheme
32 * "M" followed by two graphemes representing the zero-padded month number
33 * of the current month in a normal (non-leap) year. For the short thirteen
34 * month in each year in the CECalendar, the value is "M13".
35 *
36 * @param status ICU Error Code
37 * @return One of 13 possible strings in {"M01".. "M12", "M13"}.
38 * @draft ICU 73
39 */
40 virtual const char* getTemporalMonthCode(UErrorCode& status) const override;
41
42 /**
43 * Sets The Temporal monthCode which is a string identifier that starts
44 * with the literal grapheme "M" followed by two graphemes representing
45 * the zero-padded month number of the current month in a normal
46 * (non-leap) year. For CECalendar calendar, the values
47 * are "M01" .. "M13" while the "M13" is represent the short thirteen month
48 * in each year.
49 *
50 * @param temporalMonth The value to be set for temporal monthCode.
51 * @param status ICU Error Code
52 *
53 * @draft ICU 73
54 */
55 virtual void setTemporalMonthCode(const char* code, UErrorCode& status) override;
56
57 protected:
58 //-------------------------------------------------------------------------
59 // Constructors...
60 //-------------------------------------------------------------------------
61
62 /**
63 * Constructs a CECalendar based on the current time in the default time zone
64 * with the given locale with the Julian epoch offiset
65 *
66 * @param aLocale The given locale.
67 * @param success Indicates the status of CECalendar object construction.
68 * Returns U_ZERO_ERROR if constructed successfully.
69 * @internal
70 */
71 CECalendar(const Locale& aLocale, UErrorCode& success);
72
73 /**
74 * Copy Constructor
75 * @internal
76 */
77 CECalendar (const CECalendar& other);
78
79 /**
80 * Destructor.
81 * @internal
82 */
83 virtual ~CECalendar();
84
85 protected:
86 //-------------------------------------------------------------------------
87 // Calendar framework
88 //-------------------------------------------------------------------------
89
90 /**
91 * Return JD of start of given month/extended year
92 * @internal
93 */
94 virtual int64_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth, UErrorCode& status) const override;
95
96 /**
97 * Calculate the limit for a specified type of limit and field
98 * @internal
99 */
100 virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override;
101
102 protected:
103 /**
104 * The Coptic and Ethiopic calendars differ only in their epochs.
105 * This method must be implemented by CECalendar subclasses to
106 * return the date offset from Julian
107 * @internal
108 */
109 virtual int32_t getJDEpochOffset() const = 0;
110
111 /**
112 * Convert a Julian day to an Coptic/Ethiopic year, month and day
113 *
114 * @param julianDay the Julian day
115 * @param jdEpochOffset the epoch offset from Julian epoch
116 * @param year receives the extended year
117 * @param month receives the month
118 * @param date receives the day
119 * @internal
120 */
121 static void jdToCE(int32_t julianDay, int32_t jdEpochOffset,
122 int32_t& year, int32_t& month, int32_t& day, UErrorCode& status);
123 };
124
125 U_NAMESPACE_END
126
127 #endif /* #if !UCONFIG_NO_FORMATTING */
128 #endif
129 //eof