Index: source/i18n/unicode/udat.h |
diff --git a/source/i18n/unicode/udat.h b/source/i18n/unicode/udat.h |
index e8f0664e5915cbf74ab152d0122091b01651dfe3..5bbe5aa0736c81bc52beb436c5b0c9f48586c5f6 100644 |
--- a/source/i18n/unicode/udat.h |
+++ b/source/i18n/unicode/udat.h |
@@ -1,6 +1,6 @@ |
/* |
******************************************************************************* |
- * Copyright (C) 1996-2013, International Business Machines |
+ * Copyright (C) 1996-2014, International Business Machines |
* Corporation and others. All Rights Reserved. |
******************************************************************************* |
*/ |
@@ -186,8 +186,10 @@ typedef enum UDateFormatStyle { |
*/ |
UDAT_PATTERN = -2, |
+#ifndef U_HIDE_INTERNAL_API |
/** @internal alias to UDAT_PATTERN */ |
UDAT_IGNORE = UDAT_PATTERN |
+#endif /* U_HIDE_INTERNAL_API */ |
} UDateFormatStyle; |
/* Skeletons for dates. */ |
@@ -197,18 +199,16 @@ typedef enum UDateFormatStyle { |
* @stable ICU 4.0 |
*/ |
#define UDAT_YEAR "y" |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Constant for date skeleton with quarter. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_QUARTER "QQQQ" |
/** |
* Constant for date skeleton with abbreviated quarter. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_ABBR_QUARTER "QQQ" |
-#endif /* U_HIDE_DRAFT_API */ |
/** |
* Constant for date skeleton with year and quarter. |
* @stable ICU 4.0 |
@@ -272,18 +272,16 @@ typedef enum UDateFormatStyle { |
* @stable ICU 4.0 |
*/ |
#define UDAT_YEAR_NUM_MONTH_DAY "yMd" |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Constant for date skeleton with weekday. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_WEEKDAY "EEEE" |
/** |
* Constant for date skeleton with abbreviated weekday. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_ABBR_WEEKDAY "E" |
-#endif /* U_HIDE_DRAFT_API */ |
/** |
* Constant for date skeleton with year, month, weekday, and day. |
* Used in combinations date + time, date + time + zone, or time + zone. |
@@ -346,18 +344,16 @@ typedef enum UDateFormatStyle { |
* @stable ICU 4.0 |
*/ |
#define UDAT_HOUR "j" |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Constant for date skeleton with hour in 24-hour presentation. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_HOUR24 "H" |
/** |
* Constant for date skeleton with minute. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_MINUTE "m" |
-#endif /* U_HIDE_DRAFT_API */ |
/** |
* Constant for date skeleton with hour and minute, with the locale's preferred hour format (12 or 24). |
* Used in combinations date + time, date + time + zone, or time + zone. |
@@ -370,13 +366,11 @@ typedef enum UDateFormatStyle { |
* @stable ICU 4.0 |
*/ |
#define UDAT_HOUR24_MINUTE "Hm" |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Constant for date skeleton with second. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_SECOND "s" |
-#endif /* U_HIDE_DRAFT_API */ |
/** |
* Constant for date skeleton with hour, minute, and second, |
* with the locale's preferred hour format (12 or 24). |
@@ -400,13 +394,12 @@ typedef enum UDateFormatStyle { |
/* Skeletons for time zones. */ |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Constant for <i>generic location format</i>, such as Los Angeles Time; |
* used in combinations date + time + zone, or time + zone. |
* @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> |
* @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_LOCATION_TZ "VVVV" |
/** |
@@ -414,7 +407,7 @@ typedef enum UDateFormatStyle { |
* used in combinations date + time + zone, or time + zone. |
* @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> |
* @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_GENERIC_TZ "vvvv" |
/** |
@@ -422,7 +415,7 @@ typedef enum UDateFormatStyle { |
* used in combinations date + time + zone, or time + zone. |
* @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> |
* @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_ABBR_GENERIC_TZ "v" |
/** |
@@ -430,7 +423,7 @@ typedef enum UDateFormatStyle { |
* used in combinations date + time + zone, or time + zone. |
* @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> |
* @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_SPECIFIC_TZ "zzzz" |
/** |
@@ -438,7 +431,7 @@ typedef enum UDateFormatStyle { |
* used in combinations date + time + zone, or time + zone. |
* @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> |
* @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_ABBR_SPECIFIC_TZ "z" |
/** |
@@ -446,10 +439,9 @@ typedef enum UDateFormatStyle { |
* used in combinations date + time + zone, or time + zone. |
* @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> |
* @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
#define UDAT_ABBR_UTC_TZ "ZZZZ" |
-#endif /* U_HIDE_DRAFT_API */ |
/* deprecated skeleton constants */ |
@@ -735,12 +727,11 @@ typedef enum UDateFormatField { |
*/ |
UDAT_YEAR_NAME_FIELD = 30, |
-#ifndef U_HIDE_DRAFT_API |
/** |
* FieldPosition selector for 'O' field alignment, |
* corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. |
* This displays the localized GMT format. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31, |
@@ -748,20 +739,28 @@ typedef enum UDateFormatField { |
* FieldPosition selector for 'X' field alignment, |
* corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. |
* This displays the ISO 8601 local time offset format or UTC indicator ("Z"). |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
UDAT_TIMEZONE_ISO_FIELD = 32, |
/** |
* FieldPosition selector for 'x' field alignment, |
- * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. |
+ * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSET fields. |
* This displays the ISO 8601 local time offset format. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33, |
-#endif /* U_HIDE_DRAFT_API */ |
+#ifndef U_HIDE_INTERNAL_API |
/** |
+ * FieldPosition and UFieldPosition selector for 'r' field alignment, |
+ * no directly corresponding UCAL_ field. |
+ * @internal ICU 53 |
+ */ |
+ UDAT_RELATED_YEAR_FIELD = 34, |
+#endif /* U_HIDE_INTERNAL_API */ |
+ |
+ /** |
* Number of FieldPosition and UFieldPosition selectors for |
* DateFormat and UDateFormat. |
* Valid selectors range from 0 to UDAT_FIELD_COUNT-1. |
@@ -769,7 +768,7 @@ typedef enum UDateFormatField { |
* in the future. |
* @stable ICU 3.0 |
*/ |
- UDAT_FIELD_COUNT = 34 |
+ UDAT_FIELD_COUNT = 35 |
} UDateFormatField; |
@@ -835,30 +834,46 @@ U_STABLE void U_EXPORT2 |
udat_close(UDateFormat* format); |
+/* Dont hide UDateFormatBooleanAttribute type with #ifndef U_HIDE_DRAFT_API, needed by virtual methods */ |
+/* Also don't hide UDAT_BOOLEAN_ATTRIBUTE_COUNT, needed by template class EnumSet<UDateFormatBooleanAttribute,...> */ |
/** |
* DateFormat boolean attributes |
- * @internal ICU technology preview |
+ * |
+ * @draft ICU 53 |
*/ |
typedef enum UDateFormatBooleanAttribute { |
- /** |
+#ifndef U_HIDE_DRAFT_API |
+ /** |
* indicates whether whitespace is allowed. Includes trailing dot tolerance. |
- * @internal ICU technology preview |
+ * @draft ICU 53 |
*/ |
- UDAT_PARSE_ALLOW_WHITESPACE, |
+ UDAT_PARSE_ALLOW_WHITESPACE = 0, |
/** |
* indicates tolerance of numeric data when String data may be assumed. eg: UDAT_YEAR_NAME_FIELD, |
- * UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD |
- * @internal ICU technology preview |
+ * UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD |
+ * @draft ICU 53 |
*/ |
- UDAT_PARSE_ALLOW_NUMERIC, |
+ UDAT_PARSE_ALLOW_NUMERIC = 1, |
+ /** |
+ * indicates tolerance of a partial literal match |
+ * @draft ICU 53 |
+ */ |
+ UDAT_PARSE_PARTIAL_MATCH = 2, |
+ /** |
+ * indicates tolerance of pattern mismatch between input data and specified format pattern. |
+ * e.g. accepting "September" for a month pattern of MMM ("Sep") |
+ * @draft ICU 53 |
+ */ |
+ UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3, |
+#endif /* U_HIDE_DRAFT_API */ |
/** |
* count boolean date format constants |
- * @internal ICU technology preview |
+ * @draft ICU 53 |
*/ |
- UDAT_BOOLEAN_ATTRIBUTE_COUNT |
+ UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4 |
} UDateFormatBooleanAttribute; |
-#ifndef U_HIDE_INTERNAL_API |
+#ifndef U_HIDE_DRAFT_API |
/** |
* Get a boolean attribute associated with a UDateFormat. |
* An example would be a true value for a key of UDAT_PARSE_ALLOW_WHITESPACE indicating allowing whitespace leniency. |
@@ -867,9 +882,9 @@ typedef enum UDateFormatBooleanAttribute { |
* @param attr The attribute to query; e.g. UDAT_PARSE_ALLOW_WHITESPACE. |
* @param status A pointer to an UErrorCode to receive any errors |
* @return The value of attr. |
- * @internal technology preview |
+ * @draft ICU 53 |
*/ |
-U_INTERNAL UBool U_EXPORT2 |
+U_DRAFT UBool U_EXPORT2 |
udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status); |
/** |
@@ -880,12 +895,12 @@ udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute att |
* @param attr The attribute to set; one of UDAT_PARSE_ALLOW_WHITESPACE or UDAT_PARSE_ALLOW_NUMERIC |
* @param newValue The new value of attr. |
* @param status A pointer to an UErrorCode to receive any errors |
- * @internal ICU technology preview |
+ * @draft ICU 53 |
*/ |
-U_INTERNAL void U_EXPORT2 |
-udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool, UErrorCode* status); |
+U_DRAFT void U_EXPORT2 |
+udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status); |
-#endif /* U_HIDE_INTERNAL_API */ |
+#endif /* U_HIDE_DRAFT_API */ |
@@ -1069,19 +1084,72 @@ udat_setCalendar( UDateFormat* fmt, |
U_STABLE const UNumberFormat* U_EXPORT2 |
udat_getNumberFormat(const UDateFormat* fmt); |
+#ifndef U_HIDE_DRAFT_API |
+/** |
+* Get the UNumberFormat for specific field associated with an UDateFormat. |
+* For example: 'y' for year and 'M' for month |
+* @param fmt The formatter to query. |
+* @param field the field to query |
+* @return A pointer to the UNumberFormat used by fmt to format field numbers. |
+* @see udat_setNumberFormatForField |
+* @draft ICU 54 |
+*/ |
+U_DRAFT const UNumberFormat* U_EXPORT2 |
+udat_getNumberFormatForField(const UDateFormat* fmt, UChar field); |
+ |
+/** |
+* Set the UNumberFormat for specific field associated with an UDateFormat. |
+* It can be a single field like: "y"(year) or "M"(month) |
+* It can be several field combined together: "yM"(year and month) |
+* Note: |
+* 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy") |
+* If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field) |
+* |
+* @param fields the fields to set |
+* @param fmt The formatter to set. |
+* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. |
+* @param status error code passed around (memory allocation or invalid fields) |
+* @see udat_getNumberFormatForField |
+* @draft ICU 54 |
+*/ |
+U_DRAFT void U_EXPORT2 |
+udat_adoptNumberFormatForFields( UDateFormat* fmt, |
+ const UChar* fields, |
+ UNumberFormat* numberFormatToSet, |
+ UErrorCode* status); |
+#endif /* U_HIDE_DRAFT_API */ |
+ |
/** |
* Set the UNumberFormat associated with an UDateFormat. |
* A UDateFormat uses a UNumberFormat to format numbers within a date, |
* for example the day number. |
+* This method also clears per field NumberFormat instances previously |
+* set by {@see udat_setNumberFormatForField} |
* @param fmt The formatter to set. |
* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. |
* @see udat_getNumberFormat |
+* @see udat_setNumberFormatForField |
* @stable ICU 2.0 |
*/ |
U_STABLE void U_EXPORT2 |
udat_setNumberFormat( UDateFormat* fmt, |
const UNumberFormat* numberFormatToSet); |
+#ifndef U_HIDE_DRAFT_API |
+/** |
+* Adopt the UNumberFormat associated with an UDateFormat. |
+* A UDateFormat uses a UNumberFormat to format numbers within a date, |
+* for example the day number. |
+* @param fmt The formatter to set. |
+* @param numberFormatToAdopt A pointer to the UNumberFormat to be used by fmt to format numbers. |
+* @see udat_getNumberFormat |
+* @draft ICU 54 |
+*/ |
+U_DRAFT void U_EXPORT2 |
+udat_adoptNumberFormat( UDateFormat* fmt, |
+ UNumberFormat* numberFormatToAdopt); |
+#endif /* U_HIDE_DRAFT_API */ |
+ |
/** |
* Get a locale for which date/time formatting patterns are available. |
* A UDateFormat in a locale returned by this function will perform the correct |
@@ -1217,20 +1285,55 @@ typedef enum UDateFormatSymbolType { |
/** Standalone context versions of quarters */ |
UDAT_STANDALONE_QUARTERS, |
UDAT_STANDALONE_SHORT_QUARTERS, |
-#ifndef U_HIDE_DRAFT_API |
/** |
* The CLDR-style short weekday names, e.g. "Su", Mo", etc. |
* These are named "SHORTER" to contrast with the constants using _SHORT_ |
* above, which actually get the CLDR-style *abbreviated* versions of the |
* corresponding names. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
UDAT_SHORTER_WEEKDAYS, |
/** |
* Standalone version of UDAT_SHORTER_WEEKDAYS. |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
UDAT_STANDALONE_SHORTER_WEEKDAYS |
+#ifndef U_HIDE_DRAFT_API |
+ , |
+ /** |
+ * Cyclic year names (only supported for some calendars, and only for FORMAT usage; |
+ * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_WIDE) |
+ * @draft ICU 54 |
+ */ |
+ UDAT_CYCLIC_YEARS_WIDE, |
+ /** |
+ * Cyclic year names (only supported for some calendars, and only for FORMAT usage) |
+ * @draft ICU 54 |
+ */ |
+ UDAT_CYCLIC_YEARS_ABBREVIATED, |
+ /** |
+ * Cyclic year names (only supported for some calendars, and only for FORMAT usage; |
+ * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_NARROW) |
+ * @draft ICU 54 |
+ */ |
+ UDAT_CYCLIC_YEARS_NARROW, |
+ /** |
+ * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; |
+ * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_WIDE) |
+ * @draft ICU 54 |
+ */ |
+ UDAT_ZODIAC_NAMES_WIDE, |
+ /** |
+ * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage) |
+ * @draft ICU 54 |
+ */ |
+ UDAT_ZODIAC_NAMES_ABBREVIATED, |
+ /** |
+ * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; |
+ * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_NARROW) |
+ * @draft ICU 54 |
+ */ |
+ UDAT_ZODIAC_NAMES_NARROW |
#endif /* U_HIDE_DRAFT_API */ |
} UDateFormatSymbolType; |
@@ -1318,18 +1421,18 @@ udat_getLocaleByType(const UDateFormat *fmt, |
ULocDataLocaleType type, |
UErrorCode* status); |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Set a particular UDisplayContext value in the formatter, such as |
* UDISPCTX_CAPITALIZATION_FOR_STANDALONE. |
* @param fmt The formatter for which to set a UDisplayContext value. |
* @param value The UDisplayContext value to set. |
* @param status A pointer to an UErrorCode to receive any errors |
- * @draft ICU 51 |
+ * @stable ICU 51 |
*/ |
U_DRAFT void U_EXPORT2 |
udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); |
+#ifndef U_HIDE_DRAFT_API |
/** |
* Get the formatter's UDisplayContext value for the specified UDisplayContextType, |
* such as UDISPCTX_TYPE_CAPITALIZATION. |
@@ -1337,10 +1440,10 @@ udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); |
* @param type The UDisplayContextType whose value to return |
* @param status A pointer to an UErrorCode to receive any errors |
* @return The UDisplayContextValue for the specified type. |
- * @draft ICU 51 |
+ * @draft ICU 53 |
*/ |
U_DRAFT UDisplayContext U_EXPORT2 |
-udat_getContext(UDateFormat* fmt, UDisplayContextType type, UErrorCode* status); |
+udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status); |
#endif /* U_HIDE_DRAFT_API */ |