1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/unicode/smpdtfmt.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,1554 @@ 1.4 +/* 1.5 +* Copyright (C) 1997-2013, International Business Machines Corporation and 1.6 +* others. All Rights Reserved. 1.7 +******************************************************************************* 1.8 +* 1.9 +* File SMPDTFMT.H 1.10 +* 1.11 +* Modification History: 1.12 +* 1.13 +* Date Name Description 1.14 +* 02/19/97 aliu Converted from java. 1.15 +* 07/09/97 helena Make ParsePosition into a class. 1.16 +* 07/21/98 stephen Added GMT_PLUS, GMT_MINUS 1.17 +* Changed setTwoDigitStartDate to set2DigitYearStart 1.18 +* Changed getTwoDigitStartDate to get2DigitYearStart 1.19 +* Removed subParseLong 1.20 +* Removed getZoneIndex (added in DateFormatSymbols) 1.21 +* 06/14/99 stephen Removed fgTimeZoneDataSuffix 1.22 +* 10/14/99 aliu Updated class doc to describe 2-digit year parsing 1.23 +* {j28 4182066}. 1.24 +******************************************************************************* 1.25 +*/ 1.26 + 1.27 +#ifndef SMPDTFMT_H 1.28 +#define SMPDTFMT_H 1.29 + 1.30 +#include "unicode/utypes.h" 1.31 + 1.32 +/** 1.33 + * \file 1.34 + * \brief C++ API: Format and parse dates in a language-independent manner. 1.35 + */ 1.36 + 1.37 +#if !UCONFIG_NO_FORMATTING 1.38 + 1.39 +#include "unicode/datefmt.h" 1.40 +#include "unicode/udisplaycontext.h" 1.41 + 1.42 +U_NAMESPACE_BEGIN 1.43 + 1.44 +class DateFormatSymbols; 1.45 +class DateFormat; 1.46 +class MessageFormat; 1.47 +class FieldPositionHandler; 1.48 +class TimeZoneFormat; 1.49 + 1.50 +/** 1.51 + * 1.52 + * SimpleDateFormat is a concrete class for formatting and parsing dates in a 1.53 + * language-independent manner. It allows for formatting (millis -> text), 1.54 + * parsing (text -> millis), and normalization. Formats/Parses a date or time, 1.55 + * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970. 1.56 + * <P> 1.57 + * Clients are encouraged to create a date-time formatter using DateFormat::getInstance(), 1.58 + * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather than 1.59 + * explicitly constructing an instance of SimpleDateFormat. This way, the client 1.60 + * is guaranteed to get an appropriate formatting pattern for whatever locale the 1.61 + * program is running in. However, if the client needs something more unusual than 1.62 + * the default patterns in the locales, he can construct a SimpleDateFormat directly 1.63 + * and give it an appropriate pattern (or use one of the factory methods on DateFormat 1.64 + * and modify the pattern after the fact with toPattern() and applyPattern(). 1.65 + * 1.66 + * <p><strong>Date and Time Patterns:</strong></p> 1.67 + * 1.68 + * <p>Date and time formats are specified by <em>date and time pattern</em> strings. 1.69 + * Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved 1.70 + * as pattern letters representing calendar fields. <code>SimpleDateFormat</code> supports 1.71 + * the date and time formatting algorithm and pattern letters defined by 1.72 + * <a href="http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table">UTS#35 1.73 + * Unicode Locale Data Markup Language (LDML)</a> and further documented for ICU in the 1.74 + * <a href="https://sites.google.com/site/icuprojectuserguide/formatparse/datetime?pli=1#TOC-Date-Field-Symbol-Table">ICU 1.75 + * User Guide</a>. The following pattern letters are currently available:</p> 1.76 + * 1.77 + * <table border="1"> 1.78 + * <tr> 1.79 + * <th>Field</th> 1.80 + * <th style="text-align: center">Sym.</th> 1.81 + * <th style="text-align: center">No.</th> 1.82 + * <th>Example</th> 1.83 + * <th>Description</th> 1.84 + * </tr> 1.85 + * <tr> 1.86 + * <th rowspan="3">era</th> 1.87 + * <td style="text-align: center" rowspan="3">G</td> 1.88 + * <td style="text-align: center">1..3</td> 1.89 + * <td>AD</td> 1.90 + * <td rowspan="3">Era - Replaced with the Era string for the current date. One to three letters for the 1.91 + * abbreviated form, four letters for the long form, five for the narrow form.</td> 1.92 + * </tr> 1.93 + * <tr> 1.94 + * <td style="text-align: center">4</td> 1.95 + * <td>Anno Domini</td> 1.96 + * </tr> 1.97 + * <tr> 1.98 + * <td style="text-align: center">5</td> 1.99 + * <td>A</td> 1.100 + * </tr> 1.101 + * <tr> 1.102 + * <th rowspan="6">year</th> 1.103 + * <td style="text-align: center">y</td> 1.104 + * <td style="text-align: center">1..n</td> 1.105 + * <td>1996</td> 1.106 + * <td>Year. Normally the length specifies the padding, but for two letters it also specifies the maximum 1.107 + * length. Example:<div align="center"> 1.108 + * <center> 1.109 + * <table border="1" cellpadding="2" cellspacing="0"> 1.110 + * <tr> 1.111 + * <th>Year</th> 1.112 + * <th style="text-align: right">y</th> 1.113 + * <th style="text-align: right">yy</th> 1.114 + * <th style="text-align: right">yyy</th> 1.115 + * <th style="text-align: right">yyyy</th> 1.116 + * <th style="text-align: right">yyyyy</th> 1.117 + * </tr> 1.118 + * <tr> 1.119 + * <td>AD 1</td> 1.120 + * <td style="text-align: right">1</td> 1.121 + * <td style="text-align: right">01</td> 1.122 + * <td style="text-align: right">001</td> 1.123 + * <td style="text-align: right">0001</td> 1.124 + * <td style="text-align: right">00001</td> 1.125 + * </tr> 1.126 + * <tr> 1.127 + * <td>AD 12</td> 1.128 + * <td style="text-align: right">12</td> 1.129 + * <td style="text-align: right">12</td> 1.130 + * <td style="text-align: right">012</td> 1.131 + * <td style="text-align: right">0012</td> 1.132 + * <td style="text-align: right">00012</td> 1.133 + * </tr> 1.134 + * <tr> 1.135 + * <td>AD 123</td> 1.136 + * <td style="text-align: right">123</td> 1.137 + * <td style="text-align: right">23</td> 1.138 + * <td style="text-align: right">123</td> 1.139 + * <td style="text-align: right">0123</td> 1.140 + * <td style="text-align: right">00123</td> 1.141 + * </tr> 1.142 + * <tr> 1.143 + * <td>AD 1234</td> 1.144 + * <td style="text-align: right">1234</td> 1.145 + * <td style="text-align: right">34</td> 1.146 + * <td style="text-align: right">1234</td> 1.147 + * <td style="text-align: right">1234</td> 1.148 + * <td style="text-align: right">01234</td> 1.149 + * </tr> 1.150 + * <tr> 1.151 + * <td>AD 12345</td> 1.152 + * <td style="text-align: right">12345</td> 1.153 + * <td style="text-align: right">45</td> 1.154 + * <td style="text-align: right">12345</td> 1.155 + * <td style="text-align: right">12345</td> 1.156 + * <td style="text-align: right">12345</td> 1.157 + * </tr> 1.158 + * </table> 1.159 + * </center></div> 1.160 + * </td> 1.161 + * </tr> 1.162 + * <tr> 1.163 + * <td style="text-align: center">Y</td> 1.164 + * <td style="text-align: center">1..n</td> 1.165 + * <td>1997</td> 1.166 + * <td>Year (in "Week of Year" based calendars). Normally the length specifies the padding, 1.167 + * but for two letters it also specifies the maximum length. This year designation is used in ISO 1.168 + * year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems 1.169 + * where week date processing is desired. May not always be the same value as calendar year.</td> 1.170 + * </tr> 1.171 + * <tr> 1.172 + * <td style="text-align: center">u</td> 1.173 + * <td style="text-align: center">1..n</td> 1.174 + * <td>4601</td> 1.175 + * <td>Extended year. This is a single number designating the year of this calendar system, encompassing 1.176 + * all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an 1.177 + * era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE 1.178 + * years and negative values to BCE years, with 1 BCE being year 0.</td> 1.179 + * </tr> 1.180 + * <tr> 1.181 + * <td style="text-align: center" rowspan="3">U</td> 1.182 + * <td style="text-align: center">1..3</td> 1.183 + * <td>甲子</td> 1.184 + * <td rowspan="3">Cyclic year name. Calendars such as the Chinese lunar calendar (and related calendars) 1.185 + * and the Hindu calendars use 60-year cycles of year names. Use one through three letters for the abbreviated 1.186 + * name, four for the full name, or five for the narrow name (currently the data only provides abbreviated names, 1.187 + * which will be used for all requested name widths). If the calendar does not provide cyclic year name data, 1.188 + * or if the year value to be formatted is out of the range of years for which cyclic name data is provided, 1.189 + * then numeric formatting is used (behaves like 'y').</td> 1.190 + * </tr> 1.191 + * <tr> 1.192 + * <td style="text-align: center">4</td> 1.193 + * <td>(currently also 甲子)</td> 1.194 + * </tr> 1.195 + * <tr> 1.196 + * <td style="text-align: center">5</td> 1.197 + * <td>(currently also 甲子)</td> 1.198 + * </tr> 1.199 + * <tr> 1.200 + * <th rowspan="6">quarter</th> 1.201 + * <td rowspan="3" style="text-align: center">Q</td> 1.202 + * <td style="text-align: center">1..2</td> 1.203 + * <td>02</td> 1.204 + * <td rowspan="3">Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four 1.205 + * for the full name.</td> 1.206 + * </tr> 1.207 + * <tr> 1.208 + * <td style="text-align: center">3</td> 1.209 + * <td>Q2</td> 1.210 + * </tr> 1.211 + * <tr> 1.212 + * <td style="text-align: center">4</td> 1.213 + * <td>2nd quarter</td> 1.214 + * </tr> 1.215 + * <tr> 1.216 + * <td rowspan="3" style="text-align: center">q</td> 1.217 + * <td style="text-align: center">1..2</td> 1.218 + * <td>02</td> 1.219 + * <td rowspan="3"><b>Stand-Alone</b> Quarter - Use one or two for the numerical quarter, three for the abbreviation, 1.220 + * or four for the full name.</td> 1.221 + * </tr> 1.222 + * <tr> 1.223 + * <td style="text-align: center">3</td> 1.224 + * <td>Q2</td> 1.225 + * </tr> 1.226 + * <tr> 1.227 + * <td style="text-align: center">4</td> 1.228 + * <td>2nd quarter</td> 1.229 + * </tr> 1.230 + * <tr> 1.231 + * <th rowspan="8">month</th> 1.232 + * <td rowspan="4" style="text-align: center">M</td> 1.233 + * <td style="text-align: center">1..2</td> 1.234 + * <td>09</td> 1.235 + * <td rowspan="4">Month - Use one or two for the numerical month, three for the abbreviation, four for 1.236 + * the full name, or five for the narrow name.</td> 1.237 + * </tr> 1.238 + * <tr> 1.239 + * <td style="text-align: center">3</td> 1.240 + * <td>Sept</td> 1.241 + * </tr> 1.242 + * <tr> 1.243 + * <td style="text-align: center">4</td> 1.244 + * <td>September</td> 1.245 + * </tr> 1.246 + * <tr> 1.247 + * <td style="text-align: center">5</td> 1.248 + * <td>S</td> 1.249 + * </tr> 1.250 + * <tr> 1.251 + * <td rowspan="4" style="text-align: center">L</td> 1.252 + * <td style="text-align: center">1..2</td> 1.253 + * <td>09</td> 1.254 + * <td rowspan="4"><b>Stand-Alone</b> Month - Use one or two for the numerical month, three for the abbreviation, 1.255 + * or four for the full name, or 5 for the narrow name.</td> 1.256 + * </tr> 1.257 + * <tr> 1.258 + * <td style="text-align: center">3</td> 1.259 + * <td>Sept</td> 1.260 + * </tr> 1.261 + * <tr> 1.262 + * <td style="text-align: center">4</td> 1.263 + * <td>September</td> 1.264 + * </tr> 1.265 + * <tr> 1.266 + * <td style="text-align: center">5</td> 1.267 + * <td>S</td> 1.268 + * </tr> 1.269 + * <tr> 1.270 + * <th rowspan="2">week</th> 1.271 + * <td style="text-align: center">w</td> 1.272 + * <td style="text-align: center">1..2</td> 1.273 + * <td>27</td> 1.274 + * <td>Week of Year.</td> 1.275 + * </tr> 1.276 + * <tr> 1.277 + * <td style="text-align: center">W</td> 1.278 + * <td style="text-align: center">1</td> 1.279 + * <td>3</td> 1.280 + * <td>Week of Month</td> 1.281 + * </tr> 1.282 + * <tr> 1.283 + * <th rowspan="4">day</th> 1.284 + * <td style="text-align: center">d</td> 1.285 + * <td style="text-align: center">1..2</td> 1.286 + * <td>1</td> 1.287 + * <td>Date - Day of the month</td> 1.288 + * </tr> 1.289 + * <tr> 1.290 + * <td style="text-align: center">D</td> 1.291 + * <td style="text-align: center">1..3</td> 1.292 + * <td>345</td> 1.293 + * <td>Day of year</td> 1.294 + * </tr> 1.295 + * <tr> 1.296 + * <td style="text-align: center">F</td> 1.297 + * <td style="text-align: center">1</td> 1.298 + * <td>2</td> 1.299 + * <td>Day of Week in Month. The example is for the 2nd Wed in July</td> 1.300 + * </tr> 1.301 + * <tr> 1.302 + * <td style="text-align: center">g</td> 1.303 + * <td style="text-align: center">1..n</td> 1.304 + * <td>2451334</td> 1.305 + * <td>Modified Julian day. This is different from the conventional Julian day number in two regards. 1.306 + * First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; 1.307 + * that is, it depends on the local time zone. It can be thought of as a single number that encompasses 1.308 + * all the date-related fields.</td> 1.309 + * </tr> 1.310 + * <tr> 1.311 + * <th rowspan="14">week<br> 1.312 + * day</th> 1.313 + * <td rowspan="4" style="text-align: center">E</td> 1.314 + * <td style="text-align: center">1..3</td> 1.315 + * <td>Tues</td> 1.316 + * <td rowspan="4">Day of week - Use one through three letters for the short day, or four for the full name, 1.317 + * five for the narrow name, or six for the short name.</td> 1.318 + * </tr> 1.319 + * <tr> 1.320 + * <td style="text-align: center">4</td> 1.321 + * <td>Tuesday</td> 1.322 + * </tr> 1.323 + * <tr> 1.324 + * <td style="text-align: center">5</td> 1.325 + * <td>T</td> 1.326 + * </tr> 1.327 + * <tr> 1.328 + * <td style="text-align: center">6</td> 1.329 + * <td>Tu</td> 1.330 + * </tr> 1.331 + * <tr> 1.332 + * <td rowspan="5" style="text-align: center">e</td> 1.333 + * <td style="text-align: center">1..2</td> 1.334 + * <td>2</td> 1.335 + * <td rowspan="5">Local day of week. Same as E except adds a numeric value that will depend on the local 1.336 + * starting day of the week, using one or two letters. For this example, Monday is the first day of the week.</td> 1.337 + * </tr> 1.338 + * <tr> 1.339 + * <td style="text-align: center">3</td> 1.340 + * <td>Tues</td> 1.341 + * </tr> 1.342 + * <tr> 1.343 + * <td style="text-align: center">4</td> 1.344 + * <td>Tuesday</td> 1.345 + * </tr> 1.346 + * <tr> 1.347 + * <td style="text-align: center">5</td> 1.348 + * <td>T</td> 1.349 + * </tr> 1.350 + * <tr> 1.351 + * <td style="text-align: center">6</td> 1.352 + * <td>Tu</td> 1.353 + * </tr> 1.354 + * <tr> 1.355 + * <td rowspan="5" style="text-align: center">c</td> 1.356 + * <td style="text-align: center">1</td> 1.357 + * <td>2</td> 1.358 + * <td rowspan="5"><b>Stand-Alone</b> local day of week - Use one letter for the local numeric value (same 1.359 + * as 'e'), three for the short day, four for the full name, five for the narrow name, or six for 1.360 + * the short name.</td> 1.361 + * </tr> 1.362 + * <tr> 1.363 + * <td style="text-align: center">3</td> 1.364 + * <td>Tues</td> 1.365 + * </tr> 1.366 + * <tr> 1.367 + * <td style="text-align: center">4</td> 1.368 + * <td>Tuesday</td> 1.369 + * </tr> 1.370 + * <tr> 1.371 + * <td style="text-align: center">5</td> 1.372 + * <td>T</td> 1.373 + * </tr> 1.374 + * <tr> 1.375 + * <td style="text-align: center">6</td> 1.376 + * <td>Tu</td> 1.377 + * </tr> 1.378 + * <tr> 1.379 + * <th>period</th> 1.380 + * <td style="text-align: center">a</td> 1.381 + * <td style="text-align: center">1</td> 1.382 + * <td>AM</td> 1.383 + * <td>AM or PM</td> 1.384 + * </tr> 1.385 + * <tr> 1.386 + * <th rowspan="4">hour</th> 1.387 + * <td style="text-align: center">h</td> 1.388 + * <td style="text-align: center">1..2</td> 1.389 + * <td>11</td> 1.390 + * <td>Hour [1-12]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern 1.391 + * generation, it should match the 12-hour-cycle format preferred by the locale (h or K); it should not match 1.392 + * a 24-hour-cycle format (H or k). Use hh for zero padding.</td> 1.393 + * </tr> 1.394 + * <tr> 1.395 + * <td style="text-align: center">H</td> 1.396 + * <td style="text-align: center">1..2</td> 1.397 + * <td>13</td> 1.398 + * <td>Hour [0-23]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern 1.399 + * generation, it should match the 24-hour-cycle format preferred by the locale (H or k); it should not match a 1.400 + * 12-hour-cycle format (h or K). Use HH for zero padding.</td> 1.401 + * </tr> 1.402 + * <tr> 1.403 + * <td style="text-align: center">K</td> 1.404 + * <td style="text-align: center">1..2</td> 1.405 + * <td>0</td> 1.406 + * <td>Hour [0-11]. When used in a skeleton, only matches K or h, see above. Use KK for zero padding.</td> 1.407 + * </tr> 1.408 + * <tr> 1.409 + * <td style="text-align: center">k</td> 1.410 + * <td style="text-align: center">1..2</td> 1.411 + * <td>24</td> 1.412 + * <td>Hour [1-24]. When used in a skeleton, only matches k or H, see above. Use kk for zero padding.</td> 1.413 + * </tr> 1.414 + * <tr> 1.415 + * <th>minute</th> 1.416 + * <td style="text-align: center">m</td> 1.417 + * <td style="text-align: center">1..2</td> 1.418 + * <td>59</td> 1.419 + * <td>Minute. Use one or two for zero padding.</td> 1.420 + * </tr> 1.421 + * <tr> 1.422 + * <th rowspan="3">second</th> 1.423 + * <td style="text-align: center">s</td> 1.424 + * <td style="text-align: center">1..2</td> 1.425 + * <td>12</td> 1.426 + * <td>Second. Use one or two for zero padding.</td> 1.427 + * </tr> 1.428 + * <tr> 1.429 + * <td style="text-align: center">S</td> 1.430 + * <td style="text-align: center">1..n</td> 1.431 + * <td>3456</td> 1.432 + * <td>Fractional Second - truncates (like other time fields) to the count of letters. 1.433 + * (example shows display using pattern SSSS for seconds value 12.34567)</td> 1.434 + * </tr> 1.435 + * <tr> 1.436 + * <td style="text-align: center">A</td> 1.437 + * <td style="text-align: center">1..n</td> 1.438 + * <td>69540000</td> 1.439 + * <td>Milliseconds in day. This field behaves <i>exactly</i> like a composite of all time-related fields, 1.440 + * not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition 1.441 + * days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This 1.442 + * reflects the fact that is must be combined with the offset field to obtain a unique local time value.</td> 1.443 + * </tr> 1.444 + * <tr> 1.445 + * <th rowspan="23">zone</th> 1.446 + * <td rowspan="2" style="text-align: center">z</td> 1.447 + * <td style="text-align: center">1..3</td> 1.448 + * <td>PDT</td> 1.449 + * <td>The <i>short specific non-location format</i>. 1.450 + * Where that is unavailable, falls back to the <i>short localized GMT format</i> ("O").</td> 1.451 + * </tr> 1.452 + * <tr> 1.453 + * <td style="text-align: center">4</td> 1.454 + * <td>Pacific Daylight Time</td> 1.455 + * <td>The <i>long specific non-location format</i>. 1.456 + * Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO").</td> 1.457 + * </tr> 1.458 + * <tr> 1.459 + * <td rowspan="3" style="text-align: center">Z</td> 1.460 + * <td style="text-align: center">1..3</td> 1.461 + * <td>-0800</td> 1.462 + * <td>The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields. 1.463 + * The format is equivalent to RFC 822 zone format (when optional seconds field is absent). 1.464 + * This is equivalent to the "xxxx" specifier.</td> 1.465 + * </tr> 1.466 + * <tr> 1.467 + * <td style="text-align: center">4</td> 1.468 + * <td>GMT-8:00</td> 1.469 + * <td>The <i>long localized GMT format</i>. 1.470 + * This is equivalent to the "OOOO" specifier.</td> 1.471 + * </tr> 1.472 + * <tr> 1.473 + * <td style="text-align: center">5</td> 1.474 + * <td>-08:00<br> 1.475 + * -07:52:58</td> 1.476 + * <td>The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields. 1.477 + * The ISO8601 UTC indicator "Z" is used when local time offset is 0. 1.478 + * This is equivalent to the "XXXXX" specifier.</td> 1.479 + * </tr> 1.480 + * <tr> 1.481 + * <td rowspan="2" style="text-align: center">O</td> 1.482 + * <td style="text-align: center">1</td> 1.483 + * <td>GMT-8</td> 1.484 + * <td>The <i>short localized GMT format</i>.</td> 1.485 + * </tr> 1.486 + * <tr> 1.487 + * <td style="text-align: center">4</td> 1.488 + * <td>GMT-08:00</td> 1.489 + * <td>The <i>long localized GMT format</i>.</td> 1.490 + * </tr> 1.491 + * <tr> 1.492 + * <td rowspan="2" style="text-align: center">v</td> 1.493 + * <td style="text-align: center">1</td> 1.494 + * <td>PT</td> 1.495 + * <td>The <i>short generic non-location format</i>. 1.496 + * Where that is unavailable, falls back to the <i>generic location format</i> ("VVVV"), 1.497 + * then the <i>short localized GMT format</i> as the final fallback.</td> 1.498 + * </tr> 1.499 + * <tr> 1.500 + * <td style="text-align: center">4</td> 1.501 + * <td>Pacific Time</td> 1.502 + * <td>The <i>long generic non-location format</i>. 1.503 + * Where that is unavailable, falls back to <i>generic location format</i> ("VVVV"). 1.504 + * </tr> 1.505 + * <tr> 1.506 + * <td rowspan="4" style="text-align: center">V</td> 1.507 + * <td style="text-align: center">1</td> 1.508 + * <td>uslax</td> 1.509 + * <td>The short time zone ID. 1.510 + * Where that is unavailable, the special short time zone ID <i>unk</i> (Unknown Zone) is used.<br> 1.511 + * <i><b>Note</b>: This specifier was originally used for a variant of the short specific non-location format, 1.512 + * but it was deprecated in the later version of the LDML specification. In CLDR 23/ICU 51, the definition of 1.513 + * the specifier was changed to designate a short time zone ID.</i></td> 1.514 + * </tr> 1.515 + * <tr> 1.516 + * <td style="text-align: center">2</td> 1.517 + * <td>America/Los_Angeles</td> 1.518 + * <td>The long time zone ID.</td> 1.519 + * </tr> 1.520 + * <tr> 1.521 + * <td style="text-align: center">3</td> 1.522 + * <td>Los Angeles</td> 1.523 + * <td>The exemplar city (location) for the time zone. 1.524 + * Where that is unavailable, the localized exemplar city name for the special zone <i>Etc/Unknown</i> is used 1.525 + * as the fallback (for example, "Unknown City"). </td> 1.526 + * </tr> 1.527 + * <tr> 1.528 + * <td style="text-align: center">4</td> 1.529 + * <td>Los Angeles Time</td> 1.530 + * <td>The <i>generic location format</i>. 1.531 + * Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO"; 1.532 + * Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)<br> 1.533 + * This is especially useful when presenting possible timezone choices for user selection, 1.534 + * since the naming is more uniform than the "v" format.</td> 1.535 + * </tr> 1.536 + * <tr> 1.537 + * <td rowspan="5" style="text-align: center">X</td> 1.538 + * <td style="text-align: center">1</td> 1.539 + * <td>-08<br> 1.540 + * +0530<br> 1.541 + * Z</td> 1.542 + * <td>The <i>ISO8601 basic format</i> with hours field and optional minutes field. 1.543 + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td> 1.544 + * </tr> 1.545 + * <tr> 1.546 + * <td style="text-align: center">2</td> 1.547 + * <td>-0800<br> 1.548 + * Z</td> 1.549 + * <td>The <i>ISO8601 basic format</i> with hours and minutes fields. 1.550 + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td> 1.551 + * </tr> 1.552 + * <tr> 1.553 + * <td style="text-align: center">3</td> 1.554 + * <td>-08:00<br> 1.555 + * Z</td> 1.556 + * <td>The <i>ISO8601 extended format</i> with hours and minutes fields. 1.557 + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td> 1.558 + * </tr> 1.559 + * <tr> 1.560 + * <td style="text-align: center">4</td> 1.561 + * <td>-0800<br> 1.562 + * -075258<br> 1.563 + * Z</td> 1.564 + * <td>The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields. 1.565 + * (Note: The seconds field is not supported by the ISO8601 specification.) 1.566 + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td> 1.567 + * </tr> 1.568 + * <tr> 1.569 + * <td style="text-align: center">5</td> 1.570 + * <td>-08:00<br> 1.571 + * -07:52:58<br> 1.572 + * Z</td> 1.573 + * <td>The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields. 1.574 + * (Note: The seconds field is not supported by the ISO8601 specification.) 1.575 + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td> 1.576 + * </tr> 1.577 + * <tr> 1.578 + * <td rowspan="5" style="text-align: center">x</td> 1.579 + * <td style="text-align: center">1</td> 1.580 + * <td>-08<br> 1.581 + * +0530</td> 1.582 + * <td>The <i>ISO8601 basic format</i> with hours field and optional minutes field.</td> 1.583 + * </tr> 1.584 + * <tr> 1.585 + * <td style="text-align: center">2</td> 1.586 + * <td>-0800</td> 1.587 + * <td>The <i>ISO8601 basic format</i> with hours and minutes fields.</td> 1.588 + * </tr> 1.589 + * <tr> 1.590 + * <td style="text-align: center">3</td> 1.591 + * <td>-08:00</td> 1.592 + * <td>The <i>ISO8601 extended format</i> with hours and minutes fields.</td> 1.593 + * </tr> 1.594 + * <tr> 1.595 + * <td style="text-align: center">4</td> 1.596 + * <td>-0800<br> 1.597 + * -075258</td> 1.598 + * <td>The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields. 1.599 + * (Note: The seconds field is not supported by the ISO8601 specification.)</td> 1.600 + * </tr> 1.601 + * <tr> 1.602 + * <td style="text-align: center">5</td> 1.603 + * <td>-08:00<br> 1.604 + * -07:52:58</td> 1.605 + * <td>The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields. 1.606 + * (Note: The seconds field is not supported by the ISO8601 specification.)</td> 1.607 + * </tr> 1.608 + * </table> 1.609 + * 1.610 + * <P> 1.611 + * Any characters in the pattern that are not in the ranges of ['a'..'z'] and 1.612 + * ['A'..'Z'] will be treated as quoted text. For instance, characters 1.613 + * like ':', '.', ' ', '#' and '@' will appear in the resulting time text 1.614 + * even they are not embraced within single quotes. 1.615 + * <P> 1.616 + * A pattern containing any invalid pattern letter will result in a failing 1.617 + * UErrorCode result during formatting or parsing. 1.618 + * <P> 1.619 + * Examples using the US locale: 1.620 + * <pre> 1.621 + * \code 1.622 + * Format Pattern Result 1.623 + * -------------- ------- 1.624 + * "yyyy.MM.dd G 'at' HH:mm:ss vvvv" ->> 1996.07.10 AD at 15:08:56 Pacific Time 1.625 + * "EEE, MMM d, ''yy" ->> Wed, July 10, '96 1.626 + * "h:mm a" ->> 12:08 PM 1.627 + * "hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time 1.628 + * "K:mm a, vvv" ->> 0:00 PM, PT 1.629 + * "yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 1996.July.10 AD 12:08 PM 1.630 + * \endcode 1.631 + * </pre> 1.632 + * Code Sample: 1.633 + * <pre> 1.634 + * \code 1.635 + * UErrorCode success = U_ZERO_ERROR; 1.636 + * SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST"); 1.637 + * pdt->setStartRule( Calendar::APRIL, 1, Calendar::SUNDAY, 2*60*60*1000); 1.638 + * pdt->setEndRule( Calendar::OCTOBER, -1, Calendar::SUNDAY, 2*60*60*1000); 1.639 + * 1.640 + * // Format the current time. 1.641 + * SimpleDateFormat* formatter 1.642 + * = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success ); 1.643 + * GregorianCalendar cal(success); 1.644 + * UDate currentTime_1 = cal.getTime(success); 1.645 + * FieldPosition fp(0); 1.646 + * UnicodeString dateString; 1.647 + * formatter->format( currentTime_1, dateString, fp ); 1.648 + * cout << "result: " << dateString << endl; 1.649 + * 1.650 + * // Parse the previous string back into a Date. 1.651 + * ParsePosition pp(0); 1.652 + * UDate currentTime_2 = formatter->parse(dateString, pp ); 1.653 + * \endcode 1.654 + * </pre> 1.655 + * In the above example, the time value "currentTime_2" obtained from parsing 1.656 + * will be equal to currentTime_1. However, they may not be equal if the am/pm 1.657 + * marker 'a' is left out from the format pattern while the "hour in am/pm" 1.658 + * pattern symbol is used. This information loss can happen when formatting the 1.659 + * time in PM. 1.660 + * 1.661 + * <p> 1.662 + * When parsing a date string using the abbreviated year pattern ("y" or "yy"), 1.663 + * SimpleDateFormat must interpret the abbreviated year 1.664 + * relative to some century. It does this by adjusting dates to be 1.665 + * within 80 years before and 20 years after the time the SimpleDateFormat 1.666 + * instance is created. For example, using a pattern of "MM/dd/yy" and a 1.667 + * SimpleDateFormat instance created on Jan 1, 1997, the string 1.668 + * "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" 1.669 + * would be interpreted as May 4, 1964. 1.670 + * During parsing, only strings consisting of exactly two digits, as defined by 1.671 + * <code>Unicode::isDigit()</code>, will be parsed into the default century. 1.672 + * Any other numeric string, such as a one digit string, a three or more digit 1.673 + * string, or a two digit string that isn't all digits (for example, "-1"), is 1.674 + * interpreted literally. So "01/02/3" or "01/02/003" are parsed (for the 1.675 + * Gregorian calendar), using the same pattern, as Jan 2, 3 AD. Likewise (but 1.676 + * only in lenient parse mode, the default) "01/02/-3" is parsed as Jan 2, 4 BC. 1.677 + * 1.678 + * <p> 1.679 + * If the year pattern has more than two 'y' characters, the year is 1.680 + * interpreted literally, regardless of the number of digits. So using the 1.681 + * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D. 1.682 + * 1.683 + * <p> 1.684 + * When numeric fields abut one another directly, with no intervening delimiter 1.685 + * characters, they constitute a run of abutting numeric fields. Such runs are 1.686 + * parsed specially. For example, the format "HHmmss" parses the input text 1.687 + * "123456" to 12:34:56, parses the input text "12345" to 1:23:45, and fails to 1.688 + * parse "1234". In other words, the leftmost field of the run is flexible, 1.689 + * while the others keep a fixed width. If the parse fails anywhere in the run, 1.690 + * then the leftmost field is shortened by one character, and the entire run is 1.691 + * parsed again. This is repeated until either the parse succeeds or the 1.692 + * leftmost field is one character in length. If the parse still fails at that 1.693 + * point, the parse of the run fails. 1.694 + * 1.695 + * <P> 1.696 + * For time zones that have no names, SimpleDateFormat uses strings GMT+hours:minutes or 1.697 + * GMT-hours:minutes. 1.698 + * <P> 1.699 + * The calendar defines what is the first day of the week, the first week of the 1.700 + * year, whether hours are zero based or not (0 vs 12 or 24), and the timezone. 1.701 + * There is one common number format to handle all the numbers; the digit count 1.702 + * is handled programmatically according to the pattern. 1.703 + * 1.704 + * <p><em>User subclasses are not supported.</em> While clients may write 1.705 + * subclasses, such code will not necessarily work and will not be 1.706 + * guaranteed to work stably from release to release. 1.707 + */ 1.708 +class U_I18N_API SimpleDateFormat: public DateFormat { 1.709 +public: 1.710 + /** 1.711 + * Construct a SimpleDateFormat using the default pattern for the default 1.712 + * locale. 1.713 + * <P> 1.714 + * [Note:] Not all locales support SimpleDateFormat; for full generality, 1.715 + * use the factory methods in the DateFormat class. 1.716 + * @param status Output param set to success/failure code. 1.717 + * @stable ICU 2.0 1.718 + */ 1.719 + SimpleDateFormat(UErrorCode& status); 1.720 + 1.721 + /** 1.722 + * Construct a SimpleDateFormat using the given pattern and the default locale. 1.723 + * The locale is used to obtain the symbols used in formatting (e.g., the 1.724 + * names of the months), but not to provide the pattern. 1.725 + * <P> 1.726 + * [Note:] Not all locales support SimpleDateFormat; for full generality, 1.727 + * use the factory methods in the DateFormat class. 1.728 + * @param pattern the pattern for the format. 1.729 + * @param status Output param set to success/failure code. 1.730 + * @stable ICU 2.0 1.731 + */ 1.732 + SimpleDateFormat(const UnicodeString& pattern, 1.733 + UErrorCode& status); 1.734 + 1.735 + /** 1.736 + * Construct a SimpleDateFormat using the given pattern, numbering system override, and the default locale. 1.737 + * The locale is used to obtain the symbols used in formatting (e.g., the 1.738 + * names of the months), but not to provide the pattern. 1.739 + * <P> 1.740 + * A numbering system override is a string containing either the name of a known numbering system, 1.741 + * or a set of field and numbering system pairs that specify which fields are to be formattied with 1.742 + * the alternate numbering system. For example, to specify that all numeric fields in the specified 1.743 + * date or time pattern are to be rendered using Thai digits, simply specify the numbering system override 1.744 + * as "thai". To specify that just the year portion of the date be formatted using Hebrew numbering, 1.745 + * use the override string "y=hebrew". Numbering system overrides can be combined using a semi-colon 1.746 + * character in the override string, such as "d=decimal;M=arabic;y=hebrew", etc. 1.747 + * 1.748 + * <P> 1.749 + * [Note:] Not all locales support SimpleDateFormat; for full generality, 1.750 + * use the factory methods in the DateFormat class. 1.751 + * @param pattern the pattern for the format. 1.752 + * @param override the override string. 1.753 + * @param status Output param set to success/failure code. 1.754 + * @stable ICU 4.2 1.755 + */ 1.756 + SimpleDateFormat(const UnicodeString& pattern, 1.757 + const UnicodeString& override, 1.758 + UErrorCode& status); 1.759 + 1.760 + /** 1.761 + * Construct a SimpleDateFormat using the given pattern and locale. 1.762 + * The locale is used to obtain the symbols used in formatting (e.g., the 1.763 + * names of the months), but not to provide the pattern. 1.764 + * <P> 1.765 + * [Note:] Not all locales support SimpleDateFormat; for full generality, 1.766 + * use the factory methods in the DateFormat class. 1.767 + * @param pattern the pattern for the format. 1.768 + * @param locale the given locale. 1.769 + * @param status Output param set to success/failure code. 1.770 + * @stable ICU 2.0 1.771 + */ 1.772 + SimpleDateFormat(const UnicodeString& pattern, 1.773 + const Locale& locale, 1.774 + UErrorCode& status); 1.775 + 1.776 + /** 1.777 + * Construct a SimpleDateFormat using the given pattern, numbering system override, and locale. 1.778 + * The locale is used to obtain the symbols used in formatting (e.g., the 1.779 + * names of the months), but not to provide the pattern. 1.780 + * <P> 1.781 + * A numbering system override is a string containing either the name of a known numbering system, 1.782 + * or a set of field and numbering system pairs that specify which fields are to be formattied with 1.783 + * the alternate numbering system. For example, to specify that all numeric fields in the specified 1.784 + * date or time pattern are to be rendered using Thai digits, simply specify the numbering system override 1.785 + * as "thai". To specify that just the year portion of the date be formatted using Hebrew numbering, 1.786 + * use the override string "y=hebrew". Numbering system overrides can be combined using a semi-colon 1.787 + * character in the override string, such as "d=decimal;M=arabic;y=hebrew", etc. 1.788 + * <P> 1.789 + * [Note:] Not all locales support SimpleDateFormat; for full generality, 1.790 + * use the factory methods in the DateFormat class. 1.791 + * @param pattern the pattern for the format. 1.792 + * @param override the numbering system override. 1.793 + * @param locale the given locale. 1.794 + * @param status Output param set to success/failure code. 1.795 + * @stable ICU 4.2 1.796 + */ 1.797 + SimpleDateFormat(const UnicodeString& pattern, 1.798 + const UnicodeString& override, 1.799 + const Locale& locale, 1.800 + UErrorCode& status); 1.801 + 1.802 + /** 1.803 + * Construct a SimpleDateFormat using the given pattern and locale-specific 1.804 + * symbol data. The formatter takes ownership of the DateFormatSymbols object; 1.805 + * the caller is no longer responsible for deleting it. 1.806 + * @param pattern the given pattern for the format. 1.807 + * @param formatDataToAdopt the symbols to be adopted. 1.808 + * @param status Output param set to success/faulure code. 1.809 + * @stable ICU 2.0 1.810 + */ 1.811 + SimpleDateFormat(const UnicodeString& pattern, 1.812 + DateFormatSymbols* formatDataToAdopt, 1.813 + UErrorCode& status); 1.814 + 1.815 + /** 1.816 + * Construct a SimpleDateFormat using the given pattern and locale-specific 1.817 + * symbol data. The DateFormatSymbols object is NOT adopted; the caller 1.818 + * remains responsible for deleting it. 1.819 + * @param pattern the given pattern for the format. 1.820 + * @param formatData the formatting symbols to be use. 1.821 + * @param status Output param set to success/faulure code. 1.822 + * @stable ICU 2.0 1.823 + */ 1.824 + SimpleDateFormat(const UnicodeString& pattern, 1.825 + const DateFormatSymbols& formatData, 1.826 + UErrorCode& status); 1.827 + 1.828 + /** 1.829 + * Copy constructor. 1.830 + * @stable ICU 2.0 1.831 + */ 1.832 + SimpleDateFormat(const SimpleDateFormat&); 1.833 + 1.834 + /** 1.835 + * Assignment operator. 1.836 + * @stable ICU 2.0 1.837 + */ 1.838 + SimpleDateFormat& operator=(const SimpleDateFormat&); 1.839 + 1.840 + /** 1.841 + * Destructor. 1.842 + * @stable ICU 2.0 1.843 + */ 1.844 + virtual ~SimpleDateFormat(); 1.845 + 1.846 + /** 1.847 + * Clone this Format object polymorphically. The caller owns the result and 1.848 + * should delete it when done. 1.849 + * @return A copy of the object. 1.850 + * @stable ICU 2.0 1.851 + */ 1.852 + virtual Format* clone(void) const; 1.853 + 1.854 + /** 1.855 + * Return true if the given Format objects are semantically equal. Objects 1.856 + * of different subclasses are considered unequal. 1.857 + * @param other the object to be compared with. 1.858 + * @return true if the given Format objects are semantically equal. 1.859 + * @stable ICU 2.0 1.860 + */ 1.861 + virtual UBool operator==(const Format& other) const; 1.862 + 1.863 + 1.864 + using DateFormat::format; 1.865 + 1.866 + /** 1.867 + * Format a date or time, which is the standard millis since 24:00 GMT, Jan 1.868 + * 1, 1970. Overrides DateFormat pure virtual method. 1.869 + * <P> 1.870 + * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> 1.871 + * 1996.07.10 AD at 15:08:56 PDT 1.872 + * 1.873 + * @param cal Calendar set to the date and time to be formatted 1.874 + * into a date/time string. 1.875 + * @param appendTo Output parameter to receive result. 1.876 + * Result is appended to existing contents. 1.877 + * @param pos The formatting position. On input: an alignment field, 1.878 + * if desired. On output: the offsets of the alignment field. 1.879 + * @return Reference to 'appendTo' parameter. 1.880 + * @stable ICU 2.1 1.881 + */ 1.882 + virtual UnicodeString& format( Calendar& cal, 1.883 + UnicodeString& appendTo, 1.884 + FieldPosition& pos) const; 1.885 + 1.886 + /** 1.887 + * Format a date or time, which is the standard millis since 24:00 GMT, Jan 1.888 + * 1, 1970. Overrides DateFormat pure virtual method. 1.889 + * <P> 1.890 + * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> 1.891 + * 1996.07.10 AD at 15:08:56 PDT 1.892 + * 1.893 + * @param cal Calendar set to the date and time to be formatted 1.894 + * into a date/time string. 1.895 + * @param appendTo Output parameter to receive result. 1.896 + * Result is appended to existing contents. 1.897 + * @param posIter On return, can be used to iterate over positions 1.898 + * of fields generated by this format call. Field values 1.899 + * are defined in UDateFormatField. 1.900 + * @param status Input/output param set to success/failure code. 1.901 + * @return Reference to 'appendTo' parameter. 1.902 + * @stable ICU 4.4 1.903 + */ 1.904 + virtual UnicodeString& format( Calendar& cal, 1.905 + UnicodeString& appendTo, 1.906 + FieldPositionIterator* posIter, 1.907 + UErrorCode& status) const; 1.908 + 1.909 + using DateFormat::parse; 1.910 + 1.911 + /** 1.912 + * Parse a date/time string beginning at the given parse position. For 1.913 + * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date 1.914 + * that is equivalent to Date(837039928046). 1.915 + * <P> 1.916 + * By default, parsing is lenient: If the input is not in the form used by 1.917 + * this object's format method but can still be parsed as a date, then the 1.918 + * parse succeeds. Clients may insist on strict adherence to the format by 1.919 + * calling setLenient(false). 1.920 + * @see DateFormat::setLenient(boolean) 1.921 + * 1.922 + * @param text The date/time string to be parsed 1.923 + * @param cal A Calendar set on input to the date and time to be used for 1.924 + * missing values in the date/time string being parsed, and set 1.925 + * on output to the parsed date/time. When the calendar type is 1.926 + * different from the internal calendar held by this SimpleDateFormat 1.927 + * instance, the internal calendar will be cloned to a work 1.928 + * calendar set to the same milliseconds and time zone as the 1.929 + * cal parameter, field values will be parsed based on the work 1.930 + * calendar, then the result (milliseconds and time zone) will 1.931 + * be set in this calendar. 1.932 + * @param pos On input, the position at which to start parsing; on 1.933 + * output, the position at which parsing terminated, or the 1.934 + * start position if the parse failed. 1.935 + * @stable ICU 2.1 1.936 + */ 1.937 + virtual void parse( const UnicodeString& text, 1.938 + Calendar& cal, 1.939 + ParsePosition& pos) const; 1.940 + 1.941 + 1.942 + /** 1.943 + * Set the start UDate used to interpret two-digit year strings. 1.944 + * When dates are parsed having 2-digit year strings, they are placed within 1.945 + * a assumed range of 100 years starting on the two digit start date. For 1.946 + * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or 1.947 + * some other year. SimpleDateFormat chooses a year so that the resultant 1.948 + * date is on or after the two digit start date and within 100 years of the 1.949 + * two digit start date. 1.950 + * <P> 1.951 + * By default, the two digit start date is set to 80 years before the current 1.952 + * time at which a SimpleDateFormat object is created. 1.953 + * @param d start UDate used to interpret two-digit year strings. 1.954 + * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with 1.955 + * an error value if there was a parse error. 1.956 + * @stable ICU 2.0 1.957 + */ 1.958 + virtual void set2DigitYearStart(UDate d, UErrorCode& status); 1.959 + 1.960 + /** 1.961 + * Get the start UDate used to interpret two-digit year strings. 1.962 + * When dates are parsed having 2-digit year strings, they are placed within 1.963 + * a assumed range of 100 years starting on the two digit start date. For 1.964 + * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or 1.965 + * some other year. SimpleDateFormat chooses a year so that the resultant 1.966 + * date is on or after the two digit start date and within 100 years of the 1.967 + * two digit start date. 1.968 + * <P> 1.969 + * By default, the two digit start date is set to 80 years before the current 1.970 + * time at which a SimpleDateFormat object is created. 1.971 + * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with 1.972 + * an error value if there was a parse error. 1.973 + * @stable ICU 2.0 1.974 + */ 1.975 + UDate get2DigitYearStart(UErrorCode& status) const; 1.976 + 1.977 + /** 1.978 + * Return a pattern string describing this date format. 1.979 + * @param result Output param to receive the pattern. 1.980 + * @return A reference to 'result'. 1.981 + * @stable ICU 2.0 1.982 + */ 1.983 + virtual UnicodeString& toPattern(UnicodeString& result) const; 1.984 + 1.985 + /** 1.986 + * Return a localized pattern string describing this date format. 1.987 + * In most cases, this will return the same thing as toPattern(), 1.988 + * but a locale can specify characters to use in pattern descriptions 1.989 + * in place of the ones described in this class's class documentation. 1.990 + * (Presumably, letters that would be more mnemonic in that locale's 1.991 + * language.) This function would produce a pattern using those 1.992 + * letters. 1.993 + * 1.994 + * @param result Receives the localized pattern. 1.995 + * @param status Output param set to success/failure code on 1.996 + * exit. If the pattern is invalid, this will be 1.997 + * set to a failure result. 1.998 + * @return A reference to 'result'. 1.999 + * @stable ICU 2.0 1.1000 + */ 1.1001 + virtual UnicodeString& toLocalizedPattern(UnicodeString& result, 1.1002 + UErrorCode& status) const; 1.1003 + 1.1004 + /** 1.1005 + * Apply the given unlocalized pattern string to this date format. 1.1006 + * (i.e., after this call, this formatter will format dates according to 1.1007 + * the new pattern) 1.1008 + * 1.1009 + * @param pattern The pattern to be applied. 1.1010 + * @stable ICU 2.0 1.1011 + */ 1.1012 + virtual void applyPattern(const UnicodeString& pattern); 1.1013 + 1.1014 + /** 1.1015 + * Apply the given localized pattern string to this date format. 1.1016 + * (see toLocalizedPattern() for more information on localized patterns.) 1.1017 + * 1.1018 + * @param pattern The localized pattern to be applied. 1.1019 + * @param status Output param set to success/failure code on 1.1020 + * exit. If the pattern is invalid, this will be 1.1021 + * set to a failure result. 1.1022 + * @stable ICU 2.0 1.1023 + */ 1.1024 + virtual void applyLocalizedPattern(const UnicodeString& pattern, 1.1025 + UErrorCode& status); 1.1026 + 1.1027 + /** 1.1028 + * Gets the date/time formatting symbols (this is an object carrying 1.1029 + * the various strings and other symbols used in formatting: e.g., month 1.1030 + * names and abbreviations, time zone names, AM/PM strings, etc.) 1.1031 + * @return a copy of the date-time formatting data associated 1.1032 + * with this date-time formatter. 1.1033 + * @stable ICU 2.0 1.1034 + */ 1.1035 + virtual const DateFormatSymbols* getDateFormatSymbols(void) const; 1.1036 + 1.1037 + /** 1.1038 + * Set the date/time formatting symbols. The caller no longer owns the 1.1039 + * DateFormatSymbols object and should not delete it after making this call. 1.1040 + * @param newFormatSymbols the given date-time formatting symbols to copy. 1.1041 + * @stable ICU 2.0 1.1042 + */ 1.1043 + virtual void adoptDateFormatSymbols(DateFormatSymbols* newFormatSymbols); 1.1044 + 1.1045 + /** 1.1046 + * Set the date/time formatting data. 1.1047 + * @param newFormatSymbols the given date-time formatting symbols to copy. 1.1048 + * @stable ICU 2.0 1.1049 + */ 1.1050 + virtual void setDateFormatSymbols(const DateFormatSymbols& newFormatSymbols); 1.1051 + 1.1052 + /** 1.1053 + * Return the class ID for this class. This is useful only for comparing to 1.1054 + * a return value from getDynamicClassID(). For example: 1.1055 + * <pre> 1.1056 + * . Base* polymorphic_pointer = createPolymorphicObject(); 1.1057 + * . if (polymorphic_pointer->getDynamicClassID() == 1.1058 + * . erived::getStaticClassID()) ... 1.1059 + * </pre> 1.1060 + * @return The class ID for all objects of this class. 1.1061 + * @stable ICU 2.0 1.1062 + */ 1.1063 + static UClassID U_EXPORT2 getStaticClassID(void); 1.1064 + 1.1065 + /** 1.1066 + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 1.1067 + * method is to implement a simple version of RTTI, since not all C++ 1.1068 + * compilers support genuine RTTI. Polymorphic operator==() and clone() 1.1069 + * methods call this method. 1.1070 + * 1.1071 + * @return The class ID for this object. All objects of a 1.1072 + * given class have the same class ID. Objects of 1.1073 + * other classes have different class IDs. 1.1074 + * @stable ICU 2.0 1.1075 + */ 1.1076 + virtual UClassID getDynamicClassID(void) const; 1.1077 + 1.1078 + /** 1.1079 + * Set the calendar to be used by this date format. Initially, the default 1.1080 + * calendar for the specified or default locale is used. The caller should 1.1081 + * not delete the Calendar object after it is adopted by this call. 1.1082 + * Adopting a new calendar will change to the default symbols. 1.1083 + * 1.1084 + * @param calendarToAdopt Calendar object to be adopted. 1.1085 + * @stable ICU 2.0 1.1086 + */ 1.1087 + virtual void adoptCalendar(Calendar* calendarToAdopt); 1.1088 + 1.1089 + /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ 1.1090 + /** 1.1091 + * Set a particular UDisplayContext value in the formatter, such as 1.1092 + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. 1.1093 + * @param value The UDisplayContext value to set. 1.1094 + * @param status Input/output status. If at entry this indicates a failure 1.1095 + * status, the function will do nothing; otherwise this will be 1.1096 + * updated with any new status from the function. 1.1097 + * @draft ICU 51 1.1098 + */ 1.1099 + virtual void setContext(UDisplayContext value, UErrorCode& status); 1.1100 + 1.1101 + /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ 1.1102 + /** 1.1103 + * Get the formatter's UDisplayContext value for the specified UDisplayContextType, 1.1104 + * such as UDISPCTX_TYPE_CAPITALIZATION. 1.1105 + * @param type The UDisplayContextType whose value to return 1.1106 + * @param status Input/output status. If at entry this indicates a failure 1.1107 + * status, the function will do nothing; otherwise this will be 1.1108 + * updated with any new status from the function. 1.1109 + * @return The UDisplayContextValue for the specified type. 1.1110 + * @draft ICU 51 1.1111 + */ 1.1112 + virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const; 1.1113 + 1.1114 + /* Cannot use #ifndef U_HIDE_INTERNAL_API for the following methods since they are virtual */ 1.1115 + /** 1.1116 + * Sets the TimeZoneFormat to be used by this date/time formatter. 1.1117 + * The caller should not delete the TimeZoneFormat object after 1.1118 + * it is adopted by this call. 1.1119 + * @param timeZoneFormatToAdopt The TimeZoneFormat object to be adopted. 1.1120 + * @internal ICU 49 technology preview 1.1121 + */ 1.1122 + virtual void adoptTimeZoneFormat(TimeZoneFormat* timeZoneFormatToAdopt); 1.1123 + 1.1124 + /** 1.1125 + * Sets the TimeZoneFormat to be used by this date/time formatter. 1.1126 + * @param newTimeZoneFormat The TimeZoneFormat object to copy. 1.1127 + * @internal ICU 49 technology preview 1.1128 + */ 1.1129 + virtual void setTimeZoneFormat(const TimeZoneFormat& newTimeZoneFormat); 1.1130 + 1.1131 + /** 1.1132 + * Gets the time zone format object associated with this date/time formatter. 1.1133 + * @return the time zone format associated with this date/time formatter. 1.1134 + * @internal ICU 49 technology preview 1.1135 + */ 1.1136 + virtual const TimeZoneFormat* getTimeZoneFormat(void) const; 1.1137 + 1.1138 +#ifndef U_HIDE_INTERNAL_API 1.1139 + /** 1.1140 + * This is for ICU internal use only. Please do not use. 1.1141 + * Check whether the 'field' is smaller than all the fields covered in 1.1142 + * pattern, return TRUE if it is. The sequence of calendar field, 1.1143 + * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,... 1.1144 + * @param field the calendar field need to check against 1.1145 + * @return TRUE if the 'field' is smaller than all the fields 1.1146 + * covered in pattern. FALSE otherwise. 1.1147 + * @internal ICU 4.0 1.1148 + */ 1.1149 + UBool isFieldUnitIgnored(UCalendarDateFields field) const; 1.1150 + 1.1151 + 1.1152 + /** 1.1153 + * This is for ICU internal use only. Please do not use. 1.1154 + * Check whether the 'field' is smaller than all the fields covered in 1.1155 + * pattern, return TRUE if it is. The sequence of calendar field, 1.1156 + * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,... 1.1157 + * @param pattern the pattern to check against 1.1158 + * @param field the calendar field need to check against 1.1159 + * @return TRUE if the 'field' is smaller than all the fields 1.1160 + * covered in pattern. FALSE otherwise. 1.1161 + * @internal ICU 4.0 1.1162 + */ 1.1163 + static UBool isFieldUnitIgnored(const UnicodeString& pattern, 1.1164 + UCalendarDateFields field); 1.1165 + 1.1166 + /** 1.1167 + * This is for ICU internal use only. Please do not use. 1.1168 + * Get the locale of this simple date formatter. 1.1169 + * It is used in DateIntervalFormat. 1.1170 + * 1.1171 + * @return locale in this simple date formatter 1.1172 + * @internal ICU 4.0 1.1173 + */ 1.1174 + const Locale& getSmpFmtLocale(void) const; 1.1175 +#endif /* U_HIDE_INTERNAL_API */ 1.1176 + 1.1177 +private: 1.1178 + friend class DateFormat; 1.1179 + 1.1180 + void initializeDefaultCentury(void); 1.1181 + 1.1182 + SimpleDateFormat(); // default constructor not implemented 1.1183 + 1.1184 + /** 1.1185 + * Used by the DateFormat factory methods to construct a SimpleDateFormat. 1.1186 + * @param timeStyle the time style. 1.1187 + * @param dateStyle the date style. 1.1188 + * @param locale the given locale. 1.1189 + * @param status Output param set to success/failure code on 1.1190 + * exit. 1.1191 + */ 1.1192 + SimpleDateFormat(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status); 1.1193 + 1.1194 + /** 1.1195 + * Construct a SimpleDateFormat for the given locale. If no resource data 1.1196 + * is available, create an object of last resort, using hard-coded strings. 1.1197 + * This is an internal method, called by DateFormat. It should never fail. 1.1198 + * @param locale the given locale. 1.1199 + * @param status Output param set to success/failure code on 1.1200 + * exit. 1.1201 + */ 1.1202 + SimpleDateFormat(const Locale& locale, UErrorCode& status); // Use default pattern 1.1203 + 1.1204 + /** 1.1205 + * Hook called by format(... FieldPosition& ...) and format(...FieldPositionIterator&...) 1.1206 + */ 1.1207 + UnicodeString& _format(Calendar& cal, UnicodeString& appendTo, FieldPositionHandler& handler, UErrorCode& status) const; 1.1208 + 1.1209 + /** 1.1210 + * Called by format() to format a single field. 1.1211 + * 1.1212 + * @param appendTo Output parameter to receive result. 1.1213 + * Result is appended to existing contents. 1.1214 + * @param ch The format character we encountered in the pattern. 1.1215 + * @param count Number of characters in the current pattern symbol (e.g., 1.1216 + * "yyyy" in the pattern would result in a call to this function 1.1217 + * with ch equal to 'y' and count equal to 4) 1.1218 + * @param capitalizationContext Capitalization context for this date format. 1.1219 + * @param fieldNum Zero-based numbering of current field within the overall format. 1.1220 + * @param handler Records information about field positions. 1.1221 + * @param cal Calendar to use 1.1222 + * @param status Receives a status code, which will be U_ZERO_ERROR if the operation 1.1223 + * succeeds. 1.1224 + */ 1.1225 + void subFormat(UnicodeString &appendTo, 1.1226 + UChar ch, 1.1227 + int32_t count, 1.1228 + UDisplayContext capitalizationContext, 1.1229 + int32_t fieldNum, 1.1230 + FieldPositionHandler& handler, 1.1231 + Calendar& cal, 1.1232 + UErrorCode& status) const; // in case of illegal argument 1.1233 + 1.1234 + /** 1.1235 + * Used by subFormat() to format a numeric value. 1.1236 + * Appends to toAppendTo a string representation of "value" 1.1237 + * having a number of digits between "minDigits" and 1.1238 + * "maxDigits". Uses the DateFormat's NumberFormat. 1.1239 + * 1.1240 + * @param currentNumberFormat 1.1241 + * @param appendTo Output parameter to receive result. 1.1242 + * Formatted number is appended to existing contents. 1.1243 + * @param value Value to format. 1.1244 + * @param minDigits Minimum number of digits the result should have 1.1245 + * @param maxDigits Maximum number of digits the result should have 1.1246 + */ 1.1247 + void zeroPaddingNumber(NumberFormat *currentNumberFormat, 1.1248 + UnicodeString &appendTo, 1.1249 + int32_t value, 1.1250 + int32_t minDigits, 1.1251 + int32_t maxDigits) const; 1.1252 + 1.1253 + /** 1.1254 + * Return true if the given format character, occuring count 1.1255 + * times, represents a numeric field. 1.1256 + */ 1.1257 + static UBool isNumeric(UChar formatChar, int32_t count); 1.1258 + 1.1259 + /** 1.1260 + * Returns TRUE if the patternOffset is at the start of a numeric field. 1.1261 + */ 1.1262 + static UBool isAtNumericField(const UnicodeString &pattern, int32_t patternOffset); 1.1263 + 1.1264 + /** 1.1265 + * Returns TRUE if the patternOffset is right after a non-numeric field. 1.1266 + */ 1.1267 + static UBool isAfterNonNumericField(const UnicodeString &pattern, int32_t patternOffset); 1.1268 + 1.1269 + /** 1.1270 + * initializes fCalendar from parameters. Returns fCalendar as a convenience. 1.1271 + * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault(). 1.1272 + * @param locale Locale of the calendar 1.1273 + * @param status Error code 1.1274 + * @return the newly constructed fCalendar 1.1275 + */ 1.1276 + Calendar *initializeCalendar(TimeZone* adoptZone, const Locale& locale, UErrorCode& status); 1.1277 + 1.1278 + /** 1.1279 + * initializes fSymbols from parameters. 1.1280 + * @param locale Locale of the symbols 1.1281 + * @param calendar Alias to Calendar that will be used. 1.1282 + * @param status Error code 1.1283 + */ 1.1284 + void initializeSymbols(const Locale& locale, Calendar* calendar, UErrorCode& status); 1.1285 + 1.1286 + /** 1.1287 + * Called by several of the constructors to load pattern data and formatting symbols 1.1288 + * out of a resource bundle and initialize the locale based on it. 1.1289 + * @param timeStyle The time style, as passed to DateFormat::createDateInstance(). 1.1290 + * @param dateStyle The date style, as passed to DateFormat::createTimeInstance(). 1.1291 + * @param locale The locale to load the patterns from. 1.1292 + * @param status Filled in with an error code if loading the data from the 1.1293 + * resources fails. 1.1294 + */ 1.1295 + void construct(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status); 1.1296 + 1.1297 + /** 1.1298 + * Called by construct() and the various constructors to set up the SimpleDateFormat's 1.1299 + * Calendar and NumberFormat objects. 1.1300 + * @param locale The locale for which we want a Calendar and a NumberFormat. 1.1301 + * @param status Filled in with an error code if creating either subobject fails. 1.1302 + */ 1.1303 + void initialize(const Locale& locale, UErrorCode& status); 1.1304 + 1.1305 + /** 1.1306 + * Private code-size reduction function used by subParse. 1.1307 + * @param text the time text being parsed. 1.1308 + * @param start where to start parsing. 1.1309 + * @param field the date field being parsed. 1.1310 + * @param stringArray the string array to parsed. 1.1311 + * @param stringArrayCount the size of the array. 1.1312 + * @param monthPattern pointer to leap month pattern, or NULL if none. 1.1313 + * @param cal a Calendar set to the date and time to be formatted 1.1314 + * into a date/time string. 1.1315 + * @return the new start position if matching succeeded; a negative number 1.1316 + * indicating matching failure, otherwise. 1.1317 + */ 1.1318 + int32_t matchString(const UnicodeString& text, int32_t start, UCalendarDateFields field, 1.1319 + const UnicodeString* stringArray, int32_t stringArrayCount, 1.1320 + const UnicodeString* monthPattern, Calendar& cal) const; 1.1321 + 1.1322 + /** 1.1323 + * Private code-size reduction function used by subParse. 1.1324 + * @param text the time text being parsed. 1.1325 + * @param start where to start parsing. 1.1326 + * @param field the date field being parsed. 1.1327 + * @param stringArray the string array to parsed. 1.1328 + * @param stringArrayCount the size of the array. 1.1329 + * @param cal a Calendar set to the date and time to be formatted 1.1330 + * into a date/time string. 1.1331 + * @return the new start position if matching succeeded; a negative number 1.1332 + * indicating matching failure, otherwise. 1.1333 + */ 1.1334 + int32_t matchQuarterString(const UnicodeString& text, int32_t start, UCalendarDateFields field, 1.1335 + const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const; 1.1336 + 1.1337 + /** 1.1338 + * Private function used by subParse to match literal pattern text. 1.1339 + * 1.1340 + * @param pattern the pattern string 1.1341 + * @param patternOffset the starting offset into the pattern text. On 1.1342 + * outupt will be set the offset of the first non-literal character in the pattern 1.1343 + * @param text the text being parsed 1.1344 + * @param textOffset the starting offset into the text. On output 1.1345 + * will be set to the offset of the character after the match 1.1346 + * @param lenient <code>TRUE</code> if the parse is lenient, <code>FALSE</code> otherwise. 1.1347 + * 1.1348 + * @return <code>TRUE</code> if the literal text could be matched, <code>FALSE</code> otherwise. 1.1349 + */ 1.1350 + static UBool matchLiterals(const UnicodeString &pattern, int32_t &patternOffset, 1.1351 + const UnicodeString &text, int32_t &textOffset, UBool lenient); 1.1352 + 1.1353 + /** 1.1354 + * Private member function that converts the parsed date strings into 1.1355 + * timeFields. Returns -start (for ParsePosition) if failed. 1.1356 + * @param text the time text to be parsed. 1.1357 + * @param start where to start parsing. 1.1358 + * @param ch the pattern character for the date field text to be parsed. 1.1359 + * @param count the count of a pattern character. 1.1360 + * @param obeyCount if true then the count is strictly obeyed. 1.1361 + * @param allowNegative 1.1362 + * @param ambiguousYear If true then the two-digit year == the default start year. 1.1363 + * @param saveHebrewMonth Used to hang onto month until year is known. 1.1364 + * @param cal a Calendar set to the date and time to be formatted 1.1365 + * into a date/time string. 1.1366 + * @param patLoc 1.1367 + * @param numericLeapMonthFormatter If non-null, used to parse numeric leap months. 1.1368 + * @return the new start position if matching succeeded; a negative number 1.1369 + * indicating matching failure, otherwise. 1.1370 + */ 1.1371 + int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count, 1.1372 + UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal, 1.1373 + int32_t patLoc, MessageFormat * numericLeapMonthFormatter) const; 1.1374 + 1.1375 + void parseInt(const UnicodeString& text, 1.1376 + Formattable& number, 1.1377 + ParsePosition& pos, 1.1378 + UBool allowNegative, 1.1379 + NumberFormat *fmt) const; 1.1380 + 1.1381 + void parseInt(const UnicodeString& text, 1.1382 + Formattable& number, 1.1383 + int32_t maxDigits, 1.1384 + ParsePosition& pos, 1.1385 + UBool allowNegative, 1.1386 + NumberFormat *fmt) const; 1.1387 + 1.1388 + int32_t checkIntSuffix(const UnicodeString& text, int32_t start, 1.1389 + int32_t patLoc, UBool isNegative) const; 1.1390 + 1.1391 + /** 1.1392 + * Translate a pattern, mapping each character in the from string to the 1.1393 + * corresponding character in the to string. Return an error if the original 1.1394 + * pattern contains an unmapped character, or if a quote is unmatched. 1.1395 + * Quoted (single quotes only) material is not translated. 1.1396 + * @param originalPattern the original pattern. 1.1397 + * @param translatedPattern Output param to receive the translited pattern. 1.1398 + * @param from the characters to be translited from. 1.1399 + * @param to the characters to be translited to. 1.1400 + * @param status Receives a status code, which will be U_ZERO_ERROR 1.1401 + * if the operation succeeds. 1.1402 + */ 1.1403 + static void translatePattern(const UnicodeString& originalPattern, 1.1404 + UnicodeString& translatedPattern, 1.1405 + const UnicodeString& from, 1.1406 + const UnicodeString& to, 1.1407 + UErrorCode& status); 1.1408 + 1.1409 + /** 1.1410 + * Sets the starting date of the 100-year window that dates with 2-digit years 1.1411 + * are considered to fall within. 1.1412 + * @param startDate the start date 1.1413 + * @param status Receives a status code, which will be U_ZERO_ERROR 1.1414 + * if the operation succeeds. 1.1415 + */ 1.1416 + void parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& status); 1.1417 + 1.1418 + /** 1.1419 + * Return the length matched by the given affix, or -1 if none. 1.1420 + * Runs of white space in the affix, match runs of white space in 1.1421 + * the input. 1.1422 + * @param affix pattern string, taken as a literal 1.1423 + * @param input input text 1.1424 + * @param pos offset into input at which to begin matching 1.1425 + * @return length of input that matches, or -1 if match failure 1.1426 + */ 1.1427 + int32_t compareSimpleAffix(const UnicodeString& affix, 1.1428 + const UnicodeString& input, 1.1429 + int32_t pos) const; 1.1430 + 1.1431 + /** 1.1432 + * Skip over a run of zero or more Pattern_White_Space characters at 1.1433 + * pos in text. 1.1434 + */ 1.1435 + int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos) const; 1.1436 + 1.1437 + /** 1.1438 + * Skip over a run of zero or more isUWhiteSpace() characters at pos 1.1439 + * in text. 1.1440 + */ 1.1441 + int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const; 1.1442 + 1.1443 + /** 1.1444 + * Initialize NumberFormat instances used for numbering system overrides. 1.1445 + */ 1.1446 + void initNumberFormatters(const Locale &locale,UErrorCode &status); 1.1447 + 1.1448 + /** 1.1449 + * Get the numbering system to be used for a particular field. 1.1450 + */ 1.1451 + NumberFormat * getNumberFormatByIndex(UDateFormatField index) const; 1.1452 + 1.1453 + /** 1.1454 + * Parse the given override string and set up structures for number formats 1.1455 + */ 1.1456 + void processOverrideString(const Locale &locale, const UnicodeString &str, int8_t type, UErrorCode &status); 1.1457 + 1.1458 + /** 1.1459 + * Used to map pattern characters to Calendar field identifiers. 1.1460 + */ 1.1461 + static const UCalendarDateFields fgPatternIndexToCalendarField[]; 1.1462 + 1.1463 + /** 1.1464 + * Map index into pattern character string to DateFormat field number 1.1465 + */ 1.1466 + static const UDateFormatField fgPatternIndexToDateFormatField[]; 1.1467 + 1.1468 + /** 1.1469 + * Lazy TimeZoneFormat instantiation, semantically const 1.1470 + */ 1.1471 + TimeZoneFormat *tzFormat() const; 1.1472 + 1.1473 + /** 1.1474 + * Used to map Calendar field to field level. 1.1475 + * The larger the level, the smaller the field unit. 1.1476 + * For example, UCAL_ERA level is 0, UCAL_YEAR level is 10, 1.1477 + * UCAL_MONTH level is 20. 1.1478 + */ 1.1479 + static const int32_t fgCalendarFieldToLevel[]; 1.1480 + static const int32_t fgPatternCharToLevel[]; 1.1481 + 1.1482 + /** 1.1483 + * The formatting pattern for this formatter. 1.1484 + */ 1.1485 + UnicodeString fPattern; 1.1486 + 1.1487 + /** 1.1488 + * The numbering system override for dates. 1.1489 + */ 1.1490 + UnicodeString fDateOverride; 1.1491 + 1.1492 + /** 1.1493 + * The numbering system override for times. 1.1494 + */ 1.1495 + UnicodeString fTimeOverride; 1.1496 + 1.1497 + 1.1498 + /** 1.1499 + * The original locale used (for reloading symbols) 1.1500 + */ 1.1501 + Locale fLocale; 1.1502 + 1.1503 + /** 1.1504 + * A pointer to an object containing the strings to use in formatting (e.g., 1.1505 + * month and day names, AM and PM strings, time zone names, etc.) 1.1506 + */ 1.1507 + DateFormatSymbols* fSymbols; // Owned 1.1508 + 1.1509 + /** 1.1510 + * The time zone formatter 1.1511 + */ 1.1512 + TimeZoneFormat* fTimeZoneFormat; 1.1513 + 1.1514 + /** 1.1515 + * If dates have ambiguous years, we map them into the century starting 1.1516 + * at defaultCenturyStart, which may be any date. If defaultCenturyStart is 1.1517 + * set to SYSTEM_DEFAULT_CENTURY, which it is by default, then the system 1.1518 + * values are used. The instance values defaultCenturyStart and 1.1519 + * defaultCenturyStartYear are only used if explicitly set by the user 1.1520 + * through the API method parseAmbiguousDatesAsAfter(). 1.1521 + */ 1.1522 + UDate fDefaultCenturyStart; 1.1523 + 1.1524 + /** 1.1525 + * See documentation for defaultCenturyStart. 1.1526 + */ 1.1527 + /*transient*/ int32_t fDefaultCenturyStartYear; 1.1528 + 1.1529 + int32_t tztype; // here to avoid api change 1.1530 + 1.1531 + typedef struct NSOverride { 1.1532 + NumberFormat *nf; 1.1533 + int32_t hash; 1.1534 + NSOverride *next; 1.1535 + } NSOverride; 1.1536 + 1.1537 + NumberFormat **fNumberFormatters; 1.1538 + 1.1539 + NSOverride *fOverrideList; 1.1540 + 1.1541 + UBool fHaveDefaultCentury; 1.1542 + 1.1543 + UDisplayContext fCapitalizationContext; 1.1544 +}; 1.1545 + 1.1546 +inline UDate 1.1547 +SimpleDateFormat::get2DigitYearStart(UErrorCode& /*status*/) const 1.1548 +{ 1.1549 + return fDefaultCenturyStart; 1.1550 +} 1.1551 + 1.1552 +U_NAMESPACE_END 1.1553 + 1.1554 +#endif /* #if !UCONFIG_NO_FORMATTING */ 1.1555 + 1.1556 +#endif // _SMPDTFMT 1.1557 +//eof