Index: source/i18n/unicode/datefmt.h |
diff --git a/source/i18n/unicode/datefmt.h b/source/i18n/unicode/datefmt.h |
index 736701accdc07bb8164893e6aba639990e3850f7..ce967a5db6f669612b167b0c2c1f4d195aef1e3a 100644 |
--- a/source/i18n/unicode/datefmt.h |
+++ b/source/i18n/unicode/datefmt.h |
@@ -1,6 +1,6 @@ |
/* |
******************************************************************************** |
- * Copyright (C) 1997-2013, International Business Machines |
+ * Copyright (C) 1997-2014, International Business Machines |
* Corporation and others. All Rights Reserved. |
******************************************************************************** |
* |
@@ -29,6 +29,7 @@ |
#include "unicode/format.h" |
#include "unicode/locid.h" |
#include "unicode/enumset.h" |
+#include "unicode/udisplaycontext.h" |
/** |
* \file |
@@ -580,28 +581,61 @@ public: |
static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); |
/** |
- * Returns true if the encapsulated Calendar object is set for lenient parsing. |
+ * Returns whether both date/time parsing in the encapsulated Calendar object and DateFormat whitespace & |
+ * numeric processing is lenient. |
* @stable ICU 2.0 |
*/ |
virtual UBool isLenient(void) const; |
/** |
- * Specify whether or not date/time parsing is to be lenient. With lenient |
- * parsing, the parser may use heuristics to interpret inputs that do not |
- * precisely match this object's format. With strict parsing, inputs must |
- * match this object's format. |
- * |
- * Note: This method is specific to the encapsulated Calendar object. DateFormat |
- * leniency aspects are controlled by setBooleanAttribute. |
+ * Specifies whether date/time parsing is to be lenient. With |
+ * lenient parsing, the parser may use heuristics to interpret inputs that |
+ * do not precisely match this object's format. Without lenient parsing, |
+ * inputs must match this object's format more closely. |
+ * |
+ * Note: ICU 53 introduced finer grained control of leniency (and added |
+ * new control points) making the preferred method a combination of |
+ * setCalendarLenient() & setBooleanAttribute() calls. |
+ * This method supports prior functionality but may not support all |
+ * future leniency control & behavior of DateFormat. For control of pre 53 leniency, |
+ * Calendar and DateFormat whitespace & numeric tolerance, this method is safe to |
+ * use. However, mixing leniency control via this method and modification of the |
+ * newer attributes via setBooleanAttribute() may produce undesirable |
+ * results. |
* |
* @param lenient True specifies date/time interpretation to be lenient. |
* @see Calendar::setLenient |
- * @stable ICU 2.0 |
+ * @stable ICU 2.0 |
*/ |
virtual void setLenient(UBool lenient); |
+ |
+ /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ |
+ /** |
+ * Returns whether date/time parsing in the encapsulated Calendar object processing is lenient. |
+ * @draft ICU 53 |
+ */ |
+ virtual UBool isCalendarLenient(void) const; |
+ |
+ |
+ /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ |
+ /** |
+ * Specifies whether encapsulated Calendar date/time parsing is to be lenient. With |
+ * lenient parsing, the parser may use heuristics to interpret inputs that |
+ * do not precisely match this object's format. Without lenient parsing, |
+ * inputs must match this object's format more closely. |
+ * @param lenient when true, parsing is lenient |
+ * @see com.ibm.icu.util.Calendar#setLenient |
+ * @draft ICU 53 |
+ */ |
+ virtual void setCalendarLenient(UBool lenient); |
+ |
+ |
/** |
* Gets the calendar associated with this date/time formatter. |
+ * The calendar is owned by the formatter and must not be modified. |
+ * Also, the calendar does not reflect the results of a parse operation. |
+ * To parse to a calendar, use {@link #parse(const UnicodeString&, Calendar& cal, ParsePosition&) const parse(const UnicodeString&, Calendar& cal, ParsePosition&)} |
* @return the calendar associated with this date/time formatter. |
* @stable ICU 2.0 |
*/ |
@@ -673,29 +707,56 @@ public: |
*/ |
virtual void setTimeZone(const TimeZone& zone); |
+ /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ |
+ /** |
+ * Set a particular UDisplayContext value in the formatter, such as |
+ * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. |
+ * @param value The UDisplayContext value to set. |
+ * @param status Input/output status. If at entry this indicates a failure |
+ * status, the function will do nothing; otherwise this will be |
+ * updated with any new status from the function. |
+ * @draft ICU 53 |
+ */ |
+ virtual void setContext(UDisplayContext value, UErrorCode& status); |
+ |
+ /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ |
+ /** |
+ * Get the formatter's UDisplayContext value for the specified UDisplayContextType, |
+ * such as UDISPCTX_TYPE_CAPITALIZATION. |
+ * @param type The UDisplayContextType whose value to return |
+ * @param status Input/output status. If at entry this indicates a failure |
+ * status, the function will do nothing; otherwise this will be |
+ * updated with any new status from the function. |
+ * @return The UDisplayContextValue for the specified type. |
+ * @draft ICU 53 |
+ */ |
+ virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const; |
+ |
+ /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ |
/** |
- * Set an boolean attribute on this DateFormat. |
+ * Sets an boolean attribute on this DateFormat. |
* May return U_UNSUPPORTED_ERROR if this instance does not support |
* the specified attribute. |
* @param attr the attribute to set |
* @param newvalue new value |
* @param status the error type |
* @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) ) |
- * @internal ICU technology preview |
+ * @draft ICU 53 |
*/ |
virtual DateFormat& U_EXPORT2 setBooleanAttribute(UDateFormatBooleanAttribute attr, |
UBool newvalue, |
UErrorCode &status); |
+ /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ |
/** |
- * Get an boolean from this DateFormat |
+ * Returns a boolean from this DateFormat |
* May return U_UNSUPPORTED_ERROR if this instance does not support |
* the specified attribute. |
* @param attr the attribute to set |
* @param status the error type |
* @return the attribute value. Undefined if there is an error. |
- * @internal ICU technology preview |
+ * @draft ICU 53 |
*/ |
virtual UBool U_EXPORT2 getBooleanAttribute(UDateFormatBooleanAttribute attr, UErrorCode &status) const; |
@@ -755,6 +816,8 @@ private: |
EnumSet<UDateFormatBooleanAttribute, 0, UDAT_BOOLEAN_ATTRIBUTE_COUNT> fBoolFlags; |
+ UDisplayContext fCapitalizationContext; |
+ |
public: |
#ifndef U_HIDE_OBSOLETE_API |
/** |