ICU API Proposal: new fields in Calendar, change to getActualMaximum()
"Steven R. Loomis" <[email protected]> Thu, 6 Nov 2003 14:56:33 -0800
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <777EF334-10AC-11D8-9555-000393DC1A84__48290.9735096202$1068161828@jtcsv.com> |
Expiration: Thursday, Nov 13, 2003
**** Item #1 - getActualMaximum()
Motivation: Calendar vs. GregorianCalendar is inconsistent
in ICU 2.6, some C++ enums such as Calendar::EDateFields were
deprecated and replaced with the C enums, even in the C++ API. In the
base Calendar API this function was added:
int32_t Calendar::getActualMaximum(UCalendarDateFields field,
UErrorCode& error);
Calculating the actual maximum of a field can involve a lot of
processing, some of which can generate errors.
However, the subclass GregorianCalendar had this API (marked draft 2.6)
int32_t GregorianCalendar::getActualMaximum(UCalendarDateFields field);
This error hid the base getActualMaximum function from users of the
subclass.
I propose to remove the
GregorianCalendar::getActualMaximum(UCalendarDateFields) interface, and
replace it with one with the status code, as in the base class:
int32_t GregorianCalendar::getActualMaximum(UCalendarDateFields field,
UErrorCode& error);
**** Item #2 - new fields
Motivation: To complete the port from Java, I am adding three new
fields. Descriptions are below, from the javadoc.
/**
* Year of this calendar system, encompassing all supra-year fields.
For example, in Gregorian/Julian calendars, positive Extended Year
values indicate years AD, 1 BC = 0 extended, 2 BC = -1 extended, and
so on.
* @draft ICU 2.8
*/
UCAL_EXTENDED_YEAR,
/**
* Modified Julian day number, encompassing all date-related fields.
Demarcates at local midnight.
* @draft ICU 2.8
*/
UCAL_JULIAN_DAY,
/**
* Ranges from 0 to 23:59:59.999 (regardless of DST). This field
behaves <em>exactly</em> like a composite of all time-related fields,
not including the zone fields. As such, it also reflects
discontinuities of those fields on DST transition days. On a day of
DST onset, it will jump forward. On a day of DST cessation, it will
jump backward. This reflects the fact that is must be combined with
the DST_OFFSET field to obtain a unique local time value.
* @draft ICU 2.8
*/
UCAL_MILLISECONDS_IN_DAY,
Also, UCAL_DAY_OF_MONTH will be added as an alias to UCAL_DATE, for
compatibility with Java.
Furthermore, Calendar::FIELD_COUNT will be an alias to
UCAL_FIELD_COUNT so that Calendar::FIELD_COUNT will be correct, even
though there are not C++ enums for the new functions.