Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: source/i18n/unicode/smpdtfmt.h

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/i18n/unicode/scientificformathelper.h ('k') | source/i18n/unicode/sortkey.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/unicode/smpdtfmt.h
diff --git a/source/i18n/unicode/smpdtfmt.h b/source/i18n/unicode/smpdtfmt.h
index 0ce2161efc5f0a81290fb2cbe0c960b5f0e8af2e..d41fb59f713ff9323885fb8c0e2468af1690b53e 100644
--- a/source/i18n/unicode/smpdtfmt.h
+++ b/source/i18n/unicode/smpdtfmt.h
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 1997-2013, International Business Machines Corporation and
+* Copyright (C) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@@ -35,6 +35,8 @@
#include "unicode/datefmt.h"
#include "unicode/udisplaycontext.h"
+#include "unicode/tzfmt.h" /* for UTimeZoneFormatTimeType */
+#include "unicode/brkiter.h"
U_NAMESPACE_BEGIN
@@ -69,7 +71,8 @@ class TimeZoneFormat;
* <a href="http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table">UTS#35
* Unicode Locale Data Markup Language (LDML)</a> and further documented for ICU in the
* <a href="https://sites.google.com/site/icuprojectuserguide/formatparse/datetime?pli=1#TOC-Date-Field-Symbol-Table">ICU
- * User Guide</a>. The following pattern letters are currently available:</p>
+ * User Guide</a>. The following pattern letters are currently available (note that the actual
+ * values depend on CLDR and may change from the examples shown here):</p>
*
* <table border="1">
* <tr>
@@ -85,7 +88,7 @@ class TimeZoneFormat;
* <td style="text-align: center">1..3</td>
* <td>AD</td>
* <td rowspan="3">Era - Replaced with the Era string for the current date. One to three letters for the
- * abbreviated form, four letters for the long form, five for the narrow form.</td>
+ * abbreviated form, four letters for the long (wide) form, five for the narrow form.</td>
* </tr>
* <tr>
* <td style="text-align: center">4</td>
@@ -180,7 +183,7 @@ class TimeZoneFormat;
* <td>&#30002;&#23376;</td>
* <td rowspan="3">Cyclic year name. Calendars such as the Chinese lunar calendar (and related calendars)
* and the Hindu calendars use 60-year cycles of year names. Use one through three letters for the abbreviated
- * name, four for the full name, or five for the narrow name (currently the data only provides abbreviated names,
+ * name, four for the full (wide) name, or five for the narrow name (currently the data only provides abbreviated names,
* which will be used for all requested name widths). If the calendar does not provide cyclic year name data,
* or if the year value to be formatted is out of the range of years for which cyclic name data is provided,
* then numeric formatting is used (behaves like 'y').</td>
@@ -198,8 +201,8 @@ class TimeZoneFormat;
* <td rowspan="3" style="text-align: center">Q</td>
* <td style="text-align: center">1..2</td>
* <td>02</td>
- * <td rowspan="3">Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four
- * for the full name.</td>
+ * <td rowspan="3">Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the
+ * full (wide) name (five for the narrow name is not yet supported).</td>
* </tr>
* <tr>
* <td style="text-align: center">3</td>
@@ -214,7 +217,7 @@ class TimeZoneFormat;
* <td style="text-align: center">1..2</td>
* <td>02</td>
* <td rowspan="3"><b>Stand-Alone</b> Quarter - Use one or two for the numerical quarter, three for the abbreviation,
- * or four for the full name.</td>
+ * or four for the full name (five for the narrow name is not yet supported).</td>
* </tr>
* <tr>
* <td style="text-align: center">3</td>
@@ -230,11 +233,12 @@ class TimeZoneFormat;
* <td style="text-align: center">1..2</td>
* <td>09</td>
* <td rowspan="4">Month - Use one or two for the numerical month, three for the abbreviation, four for
- * the full name, or five for the narrow name.</td>
+ * the full (wide) name, or five for the narrow name. With two ("MM"), the month number is zero-padded
+ * if necessary (e.g. "08")</td>
* </tr>
* <tr>
* <td style="text-align: center">3</td>
- * <td>Sept</td>
+ * <td>Sep</td>
* </tr>
* <tr>
* <td style="text-align: center">4</td>
@@ -249,11 +253,12 @@ class TimeZoneFormat;
* <td style="text-align: center">1..2</td>
* <td>09</td>
* <td rowspan="4"><b>Stand-Alone</b> Month - Use one or two for the numerical month, three for the abbreviation,
- * or four for the full name, or 5 for the narrow name.</td>
+ * four for the full (wide) name, or 5 for the narrow name. With two ("LL"), the month number is zero-padded if
+ * necessary (e.g. "08")</td>
* </tr>
* <tr>
* <td style="text-align: center">3</td>
- * <td>Sept</td>
+ * <td>Sep</td>
* </tr>
* <tr>
* <td style="text-align: center">4</td>
@@ -268,7 +273,8 @@ class TimeZoneFormat;
* <td style="text-align: center">w</td>
* <td style="text-align: center">1..2</td>
* <td>27</td>
- * <td>Week of Year.</td>
+ * <td>Week of Year. Use "w" to show the minimum number of digits, or "ww" to always show two digits
+ * (zero-padding if necessary, e.g. "08").</td>
* </tr>
* <tr>
* <td style="text-align: center">W</td>
@@ -281,7 +287,8 @@ class TimeZoneFormat;
* <td style="text-align: center">d</td>
* <td style="text-align: center">1..2</td>
* <td>1</td>
- * <td>Date - Day of the month</td>
+ * <td>Date - Day of the month. Use "d" to show the minimum number of digits, or "dd" to always show
+ * two digits (zero-padding if necessary, e.g. "08").</td>
* </tr>
* <tr>
* <td style="text-align: center">D</td>
@@ -309,8 +316,8 @@ class TimeZoneFormat;
* day</th>
* <td rowspan="4" style="text-align: center">E</td>
* <td style="text-align: center">1..3</td>
- * <td>Tues</td>
- * <td rowspan="4">Day of week - Use one through three letters for the short day, or four for the full name,
+ * <td>Tue</td>
+ * <td rowspan="4">Day of week - Use one through three letters for the short day, four for the full (wide) name,
* five for the narrow name, or six for the short name.</td>
* </tr>
* <tr>
@@ -334,7 +341,7 @@ class TimeZoneFormat;
* </tr>
* <tr>
* <td style="text-align: center">3</td>
- * <td>Tues</td>
+ * <td>Tue</td>
* </tr>
* <tr>
* <td style="text-align: center">4</td>
@@ -353,12 +360,12 @@ class TimeZoneFormat;
* <td style="text-align: center">1</td>
* <td>2</td>
* <td rowspan="5"><b>Stand-Alone</b> local day of week - Use one letter for the local numeric value (same
- * as 'e'), three for the short day, four for the full name, five for the narrow name, or six for
+ * as 'e'), three for the short day, four for the full (wide) name, five for the narrow name, or six for
* the short name.</td>
* </tr>
* <tr>
* <td style="text-align: center">3</td>
- * <td>Tues</td>
+ * <td>Tue</td>
* </tr>
* <tr>
* <td style="text-align: center">4</td>
@@ -413,20 +420,23 @@ class TimeZoneFormat;
* <td style="text-align: center">m</td>
* <td style="text-align: center">1..2</td>
* <td>59</td>
- * <td>Minute. Use one or two for zero padding.</td>
+ * <td>Minute. Use "m" to show the minimum number of digits, or "mm" to always show two digits
+ * (zero-padding if necessary, e.g. "08").</td>
* </tr>
* <tr>
* <th rowspan="3">second</th>
* <td style="text-align: center">s</td>
* <td style="text-align: center">1..2</td>
* <td>12</td>
- * <td>Second. Use one or two for zero padding.</td>
+ * <td>Second. Use "s" to show the minimum number of digits, or "ss" to always show two digits
+ * (zero-padding if necessary, e.g. "08").</td>
* </tr>
* <tr>
* <td style="text-align: center">S</td>
* <td style="text-align: center">1..n</td>
- * <td>3456</td>
- * <td>Fractional Second - truncates (like other time fields) to the count of letters.
+ * <td>3450</td>
+ * <td>Fractional Second - truncates (like other time fields) to the count of letters when formatting.
+ * Appends zeros if more than 3 letters specified. Truncates at three significant digits when parsing.
* (example shows display using pattern SSSS for seconds value 12.34567)</td>
* </tr>
* <tr>
@@ -1083,31 +1093,6 @@ public:
*/
virtual void adoptCalendar(Calendar* calendarToAdopt);
- /* 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 51
- */
- 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 51
- */
- virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const;
-
/* Cannot use #ifndef U_HIDE_INTERNAL_API for the following methods since they are virtual */
/**
* Sets the TimeZoneFormat to be used by this date/time formatter.
@@ -1132,6 +1117,54 @@ public:
*/
virtual const TimeZoneFormat* getTimeZoneFormat(void) const;
+ /* 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. Note: For getContext, see
+ * DateFormat.
+ * @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);
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Overrides base class method and
+ * This method clears per field NumberFormat instances
+ * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)}
+ * @param adoptNF the NumbeferFormat used
+ * @draft ICU 54
+ */
+ void adoptNumberFormat(NumberFormat *formatToAdopt);
+
+ /**
+ * Allow the user to set the NumberFormat for several fields
+ * 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)
+ * Per field NumberFormat can also be cleared in {@see DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)}
+ *
+ * @param fields the fields to override(like y)
+ * @param adoptNF the NumbeferFormat used
+ * @param status Receives a status code, which will be U_ZERO_ERROR
+ * if the operation succeeds.
+ * @draft ICU 54
+ */
+ void adoptNumberFormat(const UnicodeString& fields, NumberFormat *formatToAdopt, UErrorCode &status);
+
+ /**
+ * Get the numbering system to be used for a particular field.
+ * @param field The UDateFormatField to get
+ * @draft ICU 54
+ */
+ const NumberFormat * getNumberFormatForField(UChar field) const;
+#endif /* U_HIDE_DRAFT_API */
+
#ifndef U_HIDE_INTERNAL_API
/**
* This is for ICU internal use only. Please do not use.
@@ -1176,6 +1209,8 @@ private:
void initializeDefaultCentury(void);
+ void initializeBooleanAttributes(void);
+
SimpleDateFormat(); // default constructor not implemented
/**
@@ -1340,12 +1375,15 @@ private:
* @param text the text being parsed
* @param textOffset the starting offset into the text. On output
* will be set to the offset of the character after the match
- * @param lenient <code>TRUE</code> if the parse is lenient, <code>FALSE</code> otherwise.
+ * @param whitespaceLenient <code>TRUE</code> if whitespace parse is lenient, <code>FALSE</code> otherwise.
+ * @param partialMatchLenient <code>TRUE</code> if partial match parse is lenient, <code>FALSE</code> otherwise.
+ * @param oldLeniency <code>TRUE</code> if old leniency control is lenient, <code>FALSE</code> otherwise.
*
* @return <code>TRUE</code> if the literal text could be matched, <code>FALSE</code> otherwise.
*/
static UBool matchLiterals(const UnicodeString &pattern, int32_t &patternOffset,
- const UnicodeString &text, int32_t &textOffset, UBool lenient);
+ const UnicodeString &text, int32_t &textOffset,
+ UBool whitespaceLenient, UBool partialMatchLenient, UBool oldLeniency);
/**
* Private member function that converts the parsed date strings into
@@ -1362,12 +1400,14 @@ private:
* into a date/time string.
* @param patLoc
* @param numericLeapMonthFormatter If non-null, used to parse numeric leap months.
+ * @param tzTimeType the type of parsed time zone - standard, daylight or unknown (output).
+ * This parameter can be NULL if caller does not need the information.
* @return the new start position if matching succeeded; a negative number
* indicating matching failure, otherwise.
*/
int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count,
UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
- int32_t patLoc, MessageFormat * numericLeapMonthFormatter) const;
+ int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType) const;
void parseInt(const UnicodeString& text,
Formattable& number,
@@ -1523,8 +1563,6 @@ private:
*/
/*transient*/ int32_t fDefaultCenturyStartYear;
- int32_t tztype; // here to avoid api change
-
typedef struct NSOverride {
NumberFormat *nf;
int32_t hash;
@@ -1537,7 +1575,7 @@ private:
UBool fHaveDefaultCentury;
- UDisplayContext fCapitalizationContext;
+ BreakIterator* fCapitalizationBrkIter;
};
inline UDate
« no previous file with comments | « source/i18n/unicode/scientificformathelper.h ('k') | source/i18n/unicode/sortkey.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698