Chromium Code Reviews

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

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « source/i18n/unicode/simpletz.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 e6e96ae30d2cde7b61e6a28bc9aed45066f30625..e6cf28d22be00d10498342ae7b2248c50c5053bc 100644
--- a/source/i18n/unicode/smpdtfmt.h
+++ b/source/i18n/unicode/smpdtfmt.h
@@ -1,5 +1,7 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
-* Copyright (C) 1997-2015, International Business Machines Corporation and
+* Copyright (C) 1997-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@@ -89,7 +91,7 @@ class SimpleDateFormatMutableNFs;
* <td style="text-align: center" rowspan="3">G</td>
* <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
+ * <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 (wide) form, five for the narrow form.</td>
* </tr>
* <tr>
@@ -218,7 +220,7 @@ class SimpleDateFormatMutableNFs;
* <td rowspan="3" style="text-align: center">q</td>
* <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,
+ * <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 (five for the narrow name is not yet supported).</td>
* </tr>
* <tr>
@@ -254,7 +256,7 @@ class SimpleDateFormatMutableNFs;
* <td rowspan="4" style="text-align: center">L</td>
* <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,
+ * <td rowspan="4"><b>Stand-Alone</b> Month - Use one or two for the numerical month, three for the abbreviation,
* 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>
@@ -310,7 +312,7 @@ class SimpleDateFormatMutableNFs;
* <td>2451334</td>
* <td>Modified Julian day. This is different from the conventional Julian day number in two regards.
* First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number;
- * that is, it depends on the local time zone. It can be thought of as a single number that encompasses
+ * that is, it depends on the local time zone. It can be thought of as a single number that encompasses
* all the date-related fields.</td>
* </tr>
* <tr>
@@ -319,7 +321,7 @@ class SimpleDateFormatMutableNFs;
* <td rowspan="4" style="text-align: center">E</td>
* <td style="text-align: center">1..3</td>
* <td>Tue</td>
- * <td rowspan="4">Day of week - Use one through three letters for the short day, four for the full (wide) name,
+ * <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>
@@ -539,7 +541,7 @@ class SimpleDateFormatMutableNFs;
* <td>The <i>generic location format</i>.
* Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO";
* Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)<br>
- * This is especially useful when presenting possible timezone choices for user selection,
+ * This is especially useful when presenting possible timezone choices for user selection,
* since the naming is more uniform than the "v" format.</td>
* </tr>
* <tr>
@@ -651,7 +653,7 @@ class SimpleDateFormatMutableNFs;
* = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success );
* GregorianCalendar cal(success);
* UDate currentTime_1 = cal.getTime(success);
- * FieldPosition fp(0);
+ * FieldPosition fp(FieldPosition::DONT_CARE);
* UnicodeString dateString;
* formatter->format( currentTime_1, dateString, fp );
* cout << "result: " << dateString << endl;
@@ -999,6 +1001,12 @@ public:
* (Presumably, letters that would be more mnemonic in that locale's
* language.) This function would produce a pattern using those
* letters.
+ * <p>
+ * <b>Note:</b> This implementation depends on DateFormatSymbols::getLocalPatternChars()
+ * to get localized format pattern characters. ICU does not include
+ * localized pattern character data, therefore, unless user sets localized
+ * pattern characters manually, this method returns the same result as
+ * toPattern().
*
* @param result Receives the localized pattern.
* @param status Output param set to success/failure code on
@@ -1126,15 +1134,15 @@ public:
* @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.
+ * updated with any new status from the function.
* @stable ICU 53
*/
virtual void setContext(UDisplayContext value, UErrorCode& status);
-
+
/**
* Overrides base class method and
- * This method clears per field NumberFormat instances
- * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)}
+ * This method clears per field NumberFormat instances
+ * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)}
* @param adoptNF the NumbeferFormat used
* @stable ICU 54
*/
@@ -1144,7 +1152,7 @@ public:
* 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:
+ * 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)}
@@ -1269,7 +1277,7 @@ private:
* having a number of digits between "minDigits" and
* "maxDigits". Uses the DateFormat's NumberFormat.
*
- * @param currentNumberFormat
+ * @param currentNumberFormat
* @param appendTo Output parameter to receive result.
* Formatted number is appended to existing contents.
* @param value Value to format.
@@ -1357,7 +1365,14 @@ private:
*/
int32_t matchQuarterString(const UnicodeString& text, int32_t start, UCalendarDateFields field,
const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const;
-
+
+ /**
+ * Used by subParse() to match localized day period strings.
+ */
+ int32_t matchDayPeriodStrings(const UnicodeString& text, int32_t start,
+ const UnicodeString* stringArray, int32_t stringArrayCount,
+ int32_t &dayPeriod) const;
+
/**
* Private function used by subParse to match literal pattern text.
*
@@ -1374,9 +1389,9 @@ private:
* @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,
+ const UnicodeString &text, int32_t &textOffset,
UBool whitespaceLenient, UBool partialMatchLenient, UBool oldLeniency);
-
+
/**
* Private member function that converts the parsed date strings into
* timeFields. Returns -start (for ParsePosition) if failed.
@@ -1399,7 +1414,8 @@ private:
*/
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, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs) const;
+ int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs,
+ int32_t *dayPeriod=NULL) const;
void parseInt(const UnicodeString& text,
Formattable& number,
@@ -1556,6 +1572,14 @@ private:
*/
UDate fDefaultCenturyStart;
+ UBool fHasMinute;
+ UBool fHasSecond;
+
+ /**
+ * Sets fHasMinutes and fHasSeconds.
+ */
+ void parsePattern();
+
/**
* See documentation for defaultCenturyStart.
*/
« no previous file with comments | « source/i18n/unicode/simpletz.h ('k') | source/i18n/unicode/sortkey.h » ('j') | no next file with comments »

Powered by Google App Engine