smpdtfmt.h 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612
  1. /*
  2. * Copyright (C) 1997-2016, International Business Machines Corporation and
  3. * others. All Rights Reserved.
  4. *******************************************************************************
  5. *
  6. * File SMPDTFMT.H
  7. *
  8. * Modification History:
  9. *
  10. * Date Name Description
  11. * 02/19/97 aliu Converted from java.
  12. * 07/09/97 helena Make ParsePosition into a class.
  13. * 07/21/98 stephen Added GMT_PLUS, GMT_MINUS
  14. * Changed setTwoDigitStartDate to set2DigitYearStart
  15. * Changed getTwoDigitStartDate to get2DigitYearStart
  16. * Removed subParseLong
  17. * Removed getZoneIndex (added in DateFormatSymbols)
  18. * 06/14/99 stephen Removed fgTimeZoneDataSuffix
  19. * 10/14/99 aliu Updated class doc to describe 2-digit year parsing
  20. * {j28 4182066}.
  21. *******************************************************************************
  22. */
  23. #ifndef SMPDTFMT_H
  24. #define SMPDTFMT_H
  25. #include "unicode/utypes.h"
  26. /**
  27. * \file
  28. * \brief C++ API: Format and parse dates in a language-independent manner.
  29. */
  30. #if !UCONFIG_NO_FORMATTING
  31. #include "unicode/datefmt.h"
  32. #include "unicode/udisplaycontext.h"
  33. #include "unicode/tzfmt.h" /* for UTimeZoneFormatTimeType */
  34. #include "unicode/brkiter.h"
  35. U_NAMESPACE_BEGIN
  36. class DateFormatSymbols;
  37. class DateFormat;
  38. class MessageFormat;
  39. class FieldPositionHandler;
  40. class TimeZoneFormat;
  41. class SharedNumberFormat;
  42. class SimpleDateFormatMutableNFs;
  43. /**
  44. *
  45. * SimpleDateFormat is a concrete class for formatting and parsing dates in a
  46. * language-independent manner. It allows for formatting (millis -> text),
  47. * parsing (text -> millis), and normalization. Formats/Parses a date or time,
  48. * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970.
  49. * <P>
  50. * Clients are encouraged to create a date-time formatter using DateFormat::getInstance(),
  51. * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather than
  52. * explicitly constructing an instance of SimpleDateFormat. This way, the client
  53. * is guaranteed to get an appropriate formatting pattern for whatever locale the
  54. * program is running in. However, if the client needs something more unusual than
  55. * the default patterns in the locales, he can construct a SimpleDateFormat directly
  56. * and give it an appropriate pattern (or use one of the factory methods on DateFormat
  57. * and modify the pattern after the fact with toPattern() and applyPattern().
  58. *
  59. * <p><strong>Date and Time Patterns:</strong></p>
  60. *
  61. * <p>Date and time formats are specified by <em>date and time pattern</em> strings.
  62. * Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved
  63. * as pattern letters representing calendar fields. <code>SimpleDateFormat</code> supports
  64. * the date and time formatting algorithm and pattern letters defined by
  65. * <a href="http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table">UTS#35
  66. * Unicode Locale Data Markup Language (LDML)</a> and further documented for ICU in the
  67. * <a href="https://sites.google.com/site/icuprojectuserguide/formatparse/datetime?pli=1#TOC-Date-Field-Symbol-Table">ICU
  68. * User Guide</a>. The following pattern letters are currently available (note that the actual
  69. * values depend on CLDR and may change from the examples shown here):</p>
  70. *
  71. * <table border="1">
  72. * <tr>
  73. * <th>Field</th>
  74. * <th style="text-align: center">Sym.</th>
  75. * <th style="text-align: center">No.</th>
  76. * <th>Example</th>
  77. * <th>Description</th>
  78. * </tr>
  79. * <tr>
  80. * <th rowspan="3">era</th>
  81. * <td style="text-align: center" rowspan="3">G</td>
  82. * <td style="text-align: center">1..3</td>
  83. * <td>AD</td>
  84. * <td rowspan="3">Era - Replaced with the Era string for the current date. One to three letters for the
  85. * abbreviated form, four letters for the long (wide) form, five for the narrow form.</td>
  86. * </tr>
  87. * <tr>
  88. * <td style="text-align: center">4</td>
  89. * <td>Anno Domini</td>
  90. * </tr>
  91. * <tr>
  92. * <td style="text-align: center">5</td>
  93. * <td>A</td>
  94. * </tr>
  95. * <tr>
  96. * <th rowspan="6">year</th>
  97. * <td style="text-align: center">y</td>
  98. * <td style="text-align: center">1..n</td>
  99. * <td>1996</td>
  100. * <td>Year. Normally the length specifies the padding, but for two letters it also specifies the maximum
  101. * length. Example:<div align="center">
  102. * <center>
  103. * <table border="1" cellpadding="2" cellspacing="0">
  104. * <tr>
  105. * <th>Year</th>
  106. * <th style="text-align: right">y</th>
  107. * <th style="text-align: right">yy</th>
  108. * <th style="text-align: right">yyy</th>
  109. * <th style="text-align: right">yyyy</th>
  110. * <th style="text-align: right">yyyyy</th>
  111. * </tr>
  112. * <tr>
  113. * <td>AD 1</td>
  114. * <td style="text-align: right">1</td>
  115. * <td style="text-align: right">01</td>
  116. * <td style="text-align: right">001</td>
  117. * <td style="text-align: right">0001</td>
  118. * <td style="text-align: right">00001</td>
  119. * </tr>
  120. * <tr>
  121. * <td>AD 12</td>
  122. * <td style="text-align: right">12</td>
  123. * <td style="text-align: right">12</td>
  124. * <td style="text-align: right">012</td>
  125. * <td style="text-align: right">0012</td>
  126. * <td style="text-align: right">00012</td>
  127. * </tr>
  128. * <tr>
  129. * <td>AD 123</td>
  130. * <td style="text-align: right">123</td>
  131. * <td style="text-align: right">23</td>
  132. * <td style="text-align: right">123</td>
  133. * <td style="text-align: right">0123</td>
  134. * <td style="text-align: right">00123</td>
  135. * </tr>
  136. * <tr>
  137. * <td>AD 1234</td>
  138. * <td style="text-align: right">1234</td>
  139. * <td style="text-align: right">34</td>
  140. * <td style="text-align: right">1234</td>
  141. * <td style="text-align: right">1234</td>
  142. * <td style="text-align: right">01234</td>
  143. * </tr>
  144. * <tr>
  145. * <td>AD 12345</td>
  146. * <td style="text-align: right">12345</td>
  147. * <td style="text-align: right">45</td>
  148. * <td style="text-align: right">12345</td>
  149. * <td style="text-align: right">12345</td>
  150. * <td style="text-align: right">12345</td>
  151. * </tr>
  152. * </table>
  153. * </center></div>
  154. * </td>
  155. * </tr>
  156. * <tr>
  157. * <td style="text-align: center">Y</td>
  158. * <td style="text-align: center">1..n</td>
  159. * <td>1997</td>
  160. * <td>Year (in "Week of Year" based calendars). Normally the length specifies the padding,
  161. * but for two letters it also specifies the maximum length. This year designation is used in ISO
  162. * year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems
  163. * where week date processing is desired. May not always be the same value as calendar year.</td>
  164. * </tr>
  165. * <tr>
  166. * <td style="text-align: center">u</td>
  167. * <td style="text-align: center">1..n</td>
  168. * <td>4601</td>
  169. * <td>Extended year. This is a single number designating the year of this calendar system, encompassing
  170. * all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an
  171. * era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE
  172. * years and negative values to BCE years, with 1 BCE being year 0.</td>
  173. * </tr>
  174. * <tr>
  175. * <td style="text-align: center" rowspan="3">U</td>
  176. * <td style="text-align: center">1..3</td>
  177. * <td>&#30002;&#23376;</td>
  178. * <td rowspan="3">Cyclic year name. Calendars such as the Chinese lunar calendar (and related calendars)
  179. * and the Hindu calendars use 60-year cycles of year names. Use one through three letters for the abbreviated
  180. * name, four for the full (wide) name, or five for the narrow name (currently the data only provides abbreviated names,
  181. * which will be used for all requested name widths). If the calendar does not provide cyclic year name data,
  182. * or if the year value to be formatted is out of the range of years for which cyclic name data is provided,
  183. * then numeric formatting is used (behaves like 'y').</td>
  184. * </tr>
  185. * <tr>
  186. * <td style="text-align: center">4</td>
  187. * <td>(currently also &#30002;&#23376;)</td>
  188. * </tr>
  189. * <tr>
  190. * <td style="text-align: center">5</td>
  191. * <td>(currently also &#30002;&#23376;)</td>
  192. * </tr>
  193. * <tr>
  194. * <th rowspan="6">quarter</th>
  195. * <td rowspan="3" style="text-align: center">Q</td>
  196. * <td style="text-align: center">1..2</td>
  197. * <td>02</td>
  198. * <td rowspan="3">Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the
  199. * full (wide) name (five for the narrow name is not yet supported).</td>
  200. * </tr>
  201. * <tr>
  202. * <td style="text-align: center">3</td>
  203. * <td>Q2</td>
  204. * </tr>
  205. * <tr>
  206. * <td style="text-align: center">4</td>
  207. * <td>2nd quarter</td>
  208. * </tr>
  209. * <tr>
  210. * <td rowspan="3" style="text-align: center">q</td>
  211. * <td style="text-align: center">1..2</td>
  212. * <td>02</td>
  213. * <td rowspan="3"><b>Stand-Alone</b> Quarter - Use one or two for the numerical quarter, three for the abbreviation,
  214. * or four for the full name (five for the narrow name is not yet supported).</td>
  215. * </tr>
  216. * <tr>
  217. * <td style="text-align: center">3</td>
  218. * <td>Q2</td>
  219. * </tr>
  220. * <tr>
  221. * <td style="text-align: center">4</td>
  222. * <td>2nd quarter</td>
  223. * </tr>
  224. * <tr>
  225. * <th rowspan="8">month</th>
  226. * <td rowspan="4" style="text-align: center">M</td>
  227. * <td style="text-align: center">1..2</td>
  228. * <td>09</td>
  229. * <td rowspan="4">Month - Use one or two for the numerical month, three for the abbreviation, four for
  230. * the full (wide) name, or five for the narrow name. With two ("MM"), the month number is zero-padded
  231. * if necessary (e.g. "08")</td>
  232. * </tr>
  233. * <tr>
  234. * <td style="text-align: center">3</td>
  235. * <td>Sep</td>
  236. * </tr>
  237. * <tr>
  238. * <td style="text-align: center">4</td>
  239. * <td>September</td>
  240. * </tr>
  241. * <tr>
  242. * <td style="text-align: center">5</td>
  243. * <td>S</td>
  244. * </tr>
  245. * <tr>
  246. * <td rowspan="4" style="text-align: center">L</td>
  247. * <td style="text-align: center">1..2</td>
  248. * <td>09</td>
  249. * <td rowspan="4"><b>Stand-Alone</b> Month - Use one or two for the numerical month, three for the abbreviation,
  250. * four for the full (wide) name, or 5 for the narrow name. With two ("LL"), the month number is zero-padded if
  251. * necessary (e.g. "08")</td>
  252. * </tr>
  253. * <tr>
  254. * <td style="text-align: center">3</td>
  255. * <td>Sep</td>
  256. * </tr>
  257. * <tr>
  258. * <td style="text-align: center">4</td>
  259. * <td>September</td>
  260. * </tr>
  261. * <tr>
  262. * <td style="text-align: center">5</td>
  263. * <td>S</td>
  264. * </tr>
  265. * <tr>
  266. * <th rowspan="2">week</th>
  267. * <td style="text-align: center">w</td>
  268. * <td style="text-align: center">1..2</td>
  269. * <td>27</td>
  270. * <td>Week of Year. Use "w" to show the minimum number of digits, or "ww" to always show two digits
  271. * (zero-padding if necessary, e.g. "08").</td>
  272. * </tr>
  273. * <tr>
  274. * <td style="text-align: center">W</td>
  275. * <td style="text-align: center">1</td>
  276. * <td>3</td>
  277. * <td>Week of Month</td>
  278. * </tr>
  279. * <tr>
  280. * <th rowspan="4">day</th>
  281. * <td style="text-align: center">d</td>
  282. * <td style="text-align: center">1..2</td>
  283. * <td>1</td>
  284. * <td>Date - Day of the month. Use "d" to show the minimum number of digits, or "dd" to always show
  285. * two digits (zero-padding if necessary, e.g. "08").</td>
  286. * </tr>
  287. * <tr>
  288. * <td style="text-align: center">D</td>
  289. * <td style="text-align: center">1..3</td>
  290. * <td>345</td>
  291. * <td>Day of year</td>
  292. * </tr>
  293. * <tr>
  294. * <td style="text-align: center">F</td>
  295. * <td style="text-align: center">1</td>
  296. * <td>2</td>
  297. * <td>Day of Week in Month. The example is for the 2nd Wed in July</td>
  298. * </tr>
  299. * <tr>
  300. * <td style="text-align: center">g</td>
  301. * <td style="text-align: center">1..n</td>
  302. * <td>2451334</td>
  303. * <td>Modified Julian day. This is different from the conventional Julian day number in two regards.
  304. * First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number;
  305. * that is, it depends on the local time zone. It can be thought of as a single number that encompasses
  306. * all the date-related fields.</td>
  307. * </tr>
  308. * <tr>
  309. * <th rowspan="14">week<br>
  310. * day</th>
  311. * <td rowspan="4" style="text-align: center">E</td>
  312. * <td style="text-align: center">1..3</td>
  313. * <td>Tue</td>
  314. * <td rowspan="4">Day of week - Use one through three letters for the short day, four for the full (wide) name,
  315. * five for the narrow name, or six for the short name.</td>
  316. * </tr>
  317. * <tr>
  318. * <td style="text-align: center">4</td>
  319. * <td>Tuesday</td>
  320. * </tr>
  321. * <tr>
  322. * <td style="text-align: center">5</td>
  323. * <td>T</td>
  324. * </tr>
  325. * <tr>
  326. * <td style="text-align: center">6</td>
  327. * <td>Tu</td>
  328. * </tr>
  329. * <tr>
  330. * <td rowspan="5" style="text-align: center">e</td>
  331. * <td style="text-align: center">1..2</td>
  332. * <td>2</td>
  333. * <td rowspan="5">Local day of week. Same as E except adds a numeric value that will depend on the local
  334. * starting day of the week, using one or two letters. For this example, Monday is the first day of the week.</td>
  335. * </tr>
  336. * <tr>
  337. * <td style="text-align: center">3</td>
  338. * <td>Tue</td>
  339. * </tr>
  340. * <tr>
  341. * <td style="text-align: center">4</td>
  342. * <td>Tuesday</td>
  343. * </tr>
  344. * <tr>
  345. * <td style="text-align: center">5</td>
  346. * <td>T</td>
  347. * </tr>
  348. * <tr>
  349. * <td style="text-align: center">6</td>
  350. * <td>Tu</td>
  351. * </tr>
  352. * <tr>
  353. * <td rowspan="5" style="text-align: center">c</td>
  354. * <td style="text-align: center">1</td>
  355. * <td>2</td>
  356. * <td rowspan="5"><b>Stand-Alone</b> local day of week - Use one letter for the local numeric value (same
  357. * as 'e'), three for the short day, four for the full (wide) name, five for the narrow name, or six for
  358. * the short name.</td>
  359. * </tr>
  360. * <tr>
  361. * <td style="text-align: center">3</td>
  362. * <td>Tue</td>
  363. * </tr>
  364. * <tr>
  365. * <td style="text-align: center">4</td>
  366. * <td>Tuesday</td>
  367. * </tr>
  368. * <tr>
  369. * <td style="text-align: center">5</td>
  370. * <td>T</td>
  371. * </tr>
  372. * <tr>
  373. * <td style="text-align: center">6</td>
  374. * <td>Tu</td>
  375. * </tr>
  376. * <tr>
  377. * <th>period</th>
  378. * <td style="text-align: center">a</td>
  379. * <td style="text-align: center">1</td>
  380. * <td>AM</td>
  381. * <td>AM or PM</td>
  382. * </tr>
  383. * <tr>
  384. * <th rowspan="4">hour</th>
  385. * <td style="text-align: center">h</td>
  386. * <td style="text-align: center">1..2</td>
  387. * <td>11</td>
  388. * <td>Hour [1-12]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern
  389. * generation, it should match the 12-hour-cycle format preferred by the locale (h or K); it should not match
  390. * a 24-hour-cycle format (H or k). Use hh for zero padding.</td>
  391. * </tr>
  392. * <tr>
  393. * <td style="text-align: center">H</td>
  394. * <td style="text-align: center">1..2</td>
  395. * <td>13</td>
  396. * <td>Hour [0-23]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern
  397. * generation, it should match the 24-hour-cycle format preferred by the locale (H or k); it should not match a
  398. * 12-hour-cycle format (h or K). Use HH for zero padding.</td>
  399. * </tr>
  400. * <tr>
  401. * <td style="text-align: center">K</td>
  402. * <td style="text-align: center">1..2</td>
  403. * <td>0</td>
  404. * <td>Hour [0-11]. When used in a skeleton, only matches K or h, see above. Use KK for zero padding.</td>
  405. * </tr>
  406. * <tr>
  407. * <td style="text-align: center">k</td>
  408. * <td style="text-align: center">1..2</td>
  409. * <td>24</td>
  410. * <td>Hour [1-24]. When used in a skeleton, only matches k or H, see above. Use kk for zero padding.</td>
  411. * </tr>
  412. * <tr>
  413. * <th>minute</th>
  414. * <td style="text-align: center">m</td>
  415. * <td style="text-align: center">1..2</td>
  416. * <td>59</td>
  417. * <td>Minute. Use "m" to show the minimum number of digits, or "mm" to always show two digits
  418. * (zero-padding if necessary, e.g. "08").</td>
  419. * </tr>
  420. * <tr>
  421. * <th rowspan="3">second</th>
  422. * <td style="text-align: center">s</td>
  423. * <td style="text-align: center">1..2</td>
  424. * <td>12</td>
  425. * <td>Second. Use "s" to show the minimum number of digits, or "ss" to always show two digits
  426. * (zero-padding if necessary, e.g. "08").</td>
  427. * </tr>
  428. * <tr>
  429. * <td style="text-align: center">S</td>
  430. * <td style="text-align: center">1..n</td>
  431. * <td>3450</td>
  432. * <td>Fractional Second - truncates (like other time fields) to the count of letters when formatting.
  433. * Appends zeros if more than 3 letters specified. Truncates at three significant digits when parsing.
  434. * (example shows display using pattern SSSS for seconds value 12.34567)</td>
  435. * </tr>
  436. * <tr>
  437. * <td style="text-align: center">A</td>
  438. * <td style="text-align: center">1..n</td>
  439. * <td>69540000</td>
  440. * <td>Milliseconds in day. This field behaves <i>exactly</i> like a composite of all time-related fields,
  441. * not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition
  442. * days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This
  443. * reflects the fact that is must be combined with the offset field to obtain a unique local time value.</td>
  444. * </tr>
  445. * <tr>
  446. * <th rowspan="23">zone</th>
  447. * <td rowspan="2" style="text-align: center">z</td>
  448. * <td style="text-align: center">1..3</td>
  449. * <td>PDT</td>
  450. * <td>The <i>short specific non-location format</i>.
  451. * Where that is unavailable, falls back to the <i>short localized GMT format</i> ("O").</td>
  452. * </tr>
  453. * <tr>
  454. * <td style="text-align: center">4</td>
  455. * <td>Pacific Daylight Time</td>
  456. * <td>The <i>long specific non-location format</i>.
  457. * Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO").</td>
  458. * </tr>
  459. * <tr>
  460. * <td rowspan="3" style="text-align: center">Z</td>
  461. * <td style="text-align: center">1..3</td>
  462. * <td>-0800</td>
  463. * <td>The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields.
  464. * The format is equivalent to RFC 822 zone format (when optional seconds field is absent).
  465. * This is equivalent to the "xxxx" specifier.</td>
  466. * </tr>
  467. * <tr>
  468. * <td style="text-align: center">4</td>
  469. * <td>GMT-8:00</td>
  470. * <td>The <i>long localized GMT format</i>.
  471. * This is equivalent to the "OOOO" specifier.</td>
  472. * </tr>
  473. * <tr>
  474. * <td style="text-align: center">5</td>
  475. * <td>-08:00<br>
  476. * -07:52:58</td>
  477. * <td>The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields.
  478. * The ISO8601 UTC indicator "Z" is used when local time offset is 0.
  479. * This is equivalent to the "XXXXX" specifier.</td>
  480. * </tr>
  481. * <tr>
  482. * <td rowspan="2" style="text-align: center">O</td>
  483. * <td style="text-align: center">1</td>
  484. * <td>GMT-8</td>
  485. * <td>The <i>short localized GMT format</i>.</td>
  486. * </tr>
  487. * <tr>
  488. * <td style="text-align: center">4</td>
  489. * <td>GMT-08:00</td>
  490. * <td>The <i>long localized GMT format</i>.</td>
  491. * </tr>
  492. * <tr>
  493. * <td rowspan="2" style="text-align: center">v</td>
  494. * <td style="text-align: center">1</td>
  495. * <td>PT</td>
  496. * <td>The <i>short generic non-location format</i>.
  497. * Where that is unavailable, falls back to the <i>generic location format</i> ("VVVV"),
  498. * then the <i>short localized GMT format</i> as the final fallback.</td>
  499. * </tr>
  500. * <tr>
  501. * <td style="text-align: center">4</td>
  502. * <td>Pacific Time</td>
  503. * <td>The <i>long generic non-location format</i>.
  504. * Where that is unavailable, falls back to <i>generic location format</i> ("VVVV").
  505. * </tr>
  506. * <tr>
  507. * <td rowspan="4" style="text-align: center">V</td>
  508. * <td style="text-align: center">1</td>
  509. * <td>uslax</td>
  510. * <td>The short time zone ID.
  511. * Where that is unavailable, the special short time zone ID <i>unk</i> (Unknown Zone) is used.<br>
  512. * <i><b>Note</b>: This specifier was originally used for a variant of the short specific non-location format,
  513. * but it was deprecated in the later version of the LDML specification. In CLDR 23/ICU 51, the definition of
  514. * the specifier was changed to designate a short time zone ID.</i></td>
  515. * </tr>
  516. * <tr>
  517. * <td style="text-align: center">2</td>
  518. * <td>America/Los_Angeles</td>
  519. * <td>The long time zone ID.</td>
  520. * </tr>
  521. * <tr>
  522. * <td style="text-align: center">3</td>
  523. * <td>Los Angeles</td>
  524. * <td>The exemplar city (location) for the time zone.
  525. * Where that is unavailable, the localized exemplar city name for the special zone <i>Etc/Unknown</i> is used
  526. * as the fallback (for example, "Unknown City"). </td>
  527. * </tr>
  528. * <tr>
  529. * <td style="text-align: center">4</td>
  530. * <td>Los Angeles Time</td>
  531. * <td>The <i>generic location format</i>.
  532. * Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO";
  533. * Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)<br>
  534. * This is especially useful when presenting possible timezone choices for user selection,
  535. * since the naming is more uniform than the "v" format.</td>
  536. * </tr>
  537. * <tr>
  538. * <td rowspan="5" style="text-align: center">X</td>
  539. * <td style="text-align: center">1</td>
  540. * <td>-08<br>
  541. * +0530<br>
  542. * Z</td>
  543. * <td>The <i>ISO8601 basic format</i> with hours field and optional minutes field.
  544. * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td>
  545. * </tr>
  546. * <tr>
  547. * <td style="text-align: center">2</td>
  548. * <td>-0800<br>
  549. * Z</td>
  550. * <td>The <i>ISO8601 basic format</i> with hours and minutes fields.
  551. * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td>
  552. * </tr>
  553. * <tr>
  554. * <td style="text-align: center">3</td>
  555. * <td>-08:00<br>
  556. * Z</td>
  557. * <td>The <i>ISO8601 extended format</i> with hours and minutes fields.
  558. * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td>
  559. * </tr>
  560. * <tr>
  561. * <td style="text-align: center">4</td>
  562. * <td>-0800<br>
  563. * -075258<br>
  564. * Z</td>
  565. * <td>The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields.
  566. * (Note: The seconds field is not supported by the ISO8601 specification.)
  567. * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td>
  568. * </tr>
  569. * <tr>
  570. * <td style="text-align: center">5</td>
  571. * <td>-08:00<br>
  572. * -07:52:58<br>
  573. * Z</td>
  574. * <td>The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields.
  575. * (Note: The seconds field is not supported by the ISO8601 specification.)
  576. * The ISO8601 UTC indicator "Z" is used when local time offset is 0.</td>
  577. * </tr>
  578. * <tr>
  579. * <td rowspan="5" style="text-align: center">x</td>
  580. * <td style="text-align: center">1</td>
  581. * <td>-08<br>
  582. * +0530</td>
  583. * <td>The <i>ISO8601 basic format</i> with hours field and optional minutes field.</td>
  584. * </tr>
  585. * <tr>
  586. * <td style="text-align: center">2</td>
  587. * <td>-0800</td>
  588. * <td>The <i>ISO8601 basic format</i> with hours and minutes fields.</td>
  589. * </tr>
  590. * <tr>
  591. * <td style="text-align: center">3</td>
  592. * <td>-08:00</td>
  593. * <td>The <i>ISO8601 extended format</i> with hours and minutes fields.</td>
  594. * </tr>
  595. * <tr>
  596. * <td style="text-align: center">4</td>
  597. * <td>-0800<br>
  598. * -075258</td>
  599. * <td>The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields.
  600. * (Note: The seconds field is not supported by the ISO8601 specification.)</td>
  601. * </tr>
  602. * <tr>
  603. * <td style="text-align: center">5</td>
  604. * <td>-08:00<br>
  605. * -07:52:58</td>
  606. * <td>The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields.
  607. * (Note: The seconds field is not supported by the ISO8601 specification.)</td>
  608. * </tr>
  609. * </table>
  610. *
  611. * <P>
  612. * Any characters in the pattern that are not in the ranges of ['a'..'z'] and
  613. * ['A'..'Z'] will be treated as quoted text. For instance, characters
  614. * like ':', '.', ' ', '#' and '@' will appear in the resulting time text
  615. * even they are not embraced within single quotes.
  616. * <P>
  617. * A pattern containing any invalid pattern letter will result in a failing
  618. * UErrorCode result during formatting or parsing.
  619. * <P>
  620. * Examples using the US locale:
  621. * <pre>
  622. * \code
  623. * Format Pattern Result
  624. * -------------- -------
  625. * "yyyy.MM.dd G 'at' HH:mm:ss vvvv" ->> 1996.07.10 AD at 15:08:56 Pacific Time
  626. * "EEE, MMM d, ''yy" ->> Wed, July 10, '96
  627. * "h:mm a" ->> 12:08 PM
  628. * "hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time
  629. * "K:mm a, vvv" ->> 0:00 PM, PT
  630. * "yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 1996.July.10 AD 12:08 PM
  631. * \endcode
  632. * </pre>
  633. * Code Sample:
  634. * <pre>
  635. * \code
  636. * UErrorCode success = U_ZERO_ERROR;
  637. * SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");
  638. * pdt->setStartRule( Calendar::APRIL, 1, Calendar::SUNDAY, 2*60*60*1000);
  639. * pdt->setEndRule( Calendar::OCTOBER, -1, Calendar::SUNDAY, 2*60*60*1000);
  640. *
  641. * // Format the current time.
  642. * SimpleDateFormat* formatter
  643. * = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success );
  644. * GregorianCalendar cal(success);
  645. * UDate currentTime_1 = cal.getTime(success);
  646. * FieldPosition fp(0);
  647. * UnicodeString dateString;
  648. * formatter->format( currentTime_1, dateString, fp );
  649. * cout << "result: " << dateString << endl;
  650. *
  651. * // Parse the previous string back into a Date.
  652. * ParsePosition pp(0);
  653. * UDate currentTime_2 = formatter->parse(dateString, pp );
  654. * \endcode
  655. * </pre>
  656. * In the above example, the time value "currentTime_2" obtained from parsing
  657. * will be equal to currentTime_1. However, they may not be equal if the am/pm
  658. * marker 'a' is left out from the format pattern while the "hour in am/pm"
  659. * pattern symbol is used. This information loss can happen when formatting the
  660. * time in PM.
  661. *
  662. * <p>
  663. * When parsing a date string using the abbreviated year pattern ("y" or "yy"),
  664. * SimpleDateFormat must interpret the abbreviated year
  665. * relative to some century. It does this by adjusting dates to be
  666. * within 80 years before and 20 years after the time the SimpleDateFormat
  667. * instance is created. For example, using a pattern of "MM/dd/yy" and a
  668. * SimpleDateFormat instance created on Jan 1, 1997, the string
  669. * "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64"
  670. * would be interpreted as May 4, 1964.
  671. * During parsing, only strings consisting of exactly two digits, as defined by
  672. * <code>Unicode::isDigit()</code>, will be parsed into the default century.
  673. * Any other numeric string, such as a one digit string, a three or more digit
  674. * string, or a two digit string that isn't all digits (for example, "-1"), is
  675. * interpreted literally. So "01/02/3" or "01/02/003" are parsed (for the
  676. * Gregorian calendar), using the same pattern, as Jan 2, 3 AD. Likewise (but
  677. * only in lenient parse mode, the default) "01/02/-3" is parsed as Jan 2, 4 BC.
  678. *
  679. * <p>
  680. * If the year pattern has more than two 'y' characters, the year is
  681. * interpreted literally, regardless of the number of digits. So using the
  682. * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D.
  683. *
  684. * <p>
  685. * When numeric fields abut one another directly, with no intervening delimiter
  686. * characters, they constitute a run of abutting numeric fields. Such runs are
  687. * parsed specially. For example, the format "HHmmss" parses the input text
  688. * "123456" to 12:34:56, parses the input text "12345" to 1:23:45, and fails to
  689. * parse "1234". In other words, the leftmost field of the run is flexible,
  690. * while the others keep a fixed width. If the parse fails anywhere in the run,
  691. * then the leftmost field is shortened by one character, and the entire run is
  692. * parsed again. This is repeated until either the parse succeeds or the
  693. * leftmost field is one character in length. If the parse still fails at that
  694. * point, the parse of the run fails.
  695. *
  696. * <P>
  697. * For time zones that have no names, SimpleDateFormat uses strings GMT+hours:minutes or
  698. * GMT-hours:minutes.
  699. * <P>
  700. * The calendar defines what is the first day of the week, the first week of the
  701. * year, whether hours are zero based or not (0 vs 12 or 24), and the timezone.
  702. * There is one common number format to handle all the numbers; the digit count
  703. * is handled programmatically according to the pattern.
  704. *
  705. * <p><em>User subclasses are not supported.</em> While clients may write
  706. * subclasses, such code will not necessarily work and will not be
  707. * guaranteed to work stably from release to release.
  708. */
  709. class U_I18N_API SimpleDateFormat: public DateFormat {
  710. public:
  711. /**
  712. * Construct a SimpleDateFormat using the default pattern for the default
  713. * locale.
  714. * <P>
  715. * [Note:] Not all locales support SimpleDateFormat; for full generality,
  716. * use the factory methods in the DateFormat class.
  717. * @param status Output param set to success/failure code.
  718. * @stable ICU 2.0
  719. */
  720. SimpleDateFormat(UErrorCode& status);
  721. /**
  722. * Construct a SimpleDateFormat using the given pattern and the default locale.
  723. * The locale is used to obtain the symbols used in formatting (e.g., the
  724. * names of the months), but not to provide the pattern.
  725. * <P>
  726. * [Note:] Not all locales support SimpleDateFormat; for full generality,
  727. * use the factory methods in the DateFormat class.
  728. * @param pattern the pattern for the format.
  729. * @param status Output param set to success/failure code.
  730. * @stable ICU 2.0
  731. */
  732. SimpleDateFormat(const UnicodeString& pattern,
  733. UErrorCode& status);
  734. /**
  735. * Construct a SimpleDateFormat using the given pattern, numbering system override, and the default locale.
  736. * The locale is used to obtain the symbols used in formatting (e.g., the
  737. * names of the months), but not to provide the pattern.
  738. * <P>
  739. * A numbering system override is a string containing either the name of a known numbering system,
  740. * or a set of field and numbering system pairs that specify which fields are to be formattied with
  741. * the alternate numbering system. For example, to specify that all numeric fields in the specified
  742. * date or time pattern are to be rendered using Thai digits, simply specify the numbering system override
  743. * as "thai". To specify that just the year portion of the date be formatted using Hebrew numbering,
  744. * use the override string "y=hebrew". Numbering system overrides can be combined using a semi-colon
  745. * character in the override string, such as "d=decimal;M=arabic;y=hebrew", etc.
  746. *
  747. * <P>
  748. * [Note:] Not all locales support SimpleDateFormat; for full generality,
  749. * use the factory methods in the DateFormat class.
  750. * @param pattern the pattern for the format.
  751. * @param override the override string.
  752. * @param status Output param set to success/failure code.
  753. * @stable ICU 4.2
  754. */
  755. SimpleDateFormat(const UnicodeString& pattern,
  756. const UnicodeString& override,
  757. UErrorCode& status);
  758. /**
  759. * Construct a SimpleDateFormat using the given pattern and locale.
  760. * The locale is used to obtain the symbols used in formatting (e.g., the
  761. * names of the months), but not to provide the pattern.
  762. * <P>
  763. * [Note:] Not all locales support SimpleDateFormat; for full generality,
  764. * use the factory methods in the DateFormat class.
  765. * @param pattern the pattern for the format.
  766. * @param locale the given locale.
  767. * @param status Output param set to success/failure code.
  768. * @stable ICU 2.0
  769. */
  770. SimpleDateFormat(const UnicodeString& pattern,
  771. const Locale& locale,
  772. UErrorCode& status);
  773. /**
  774. * Construct a SimpleDateFormat using the given pattern, numbering system override, and locale.
  775. * The locale is used to obtain the symbols used in formatting (e.g., the
  776. * names of the months), but not to provide the pattern.
  777. * <P>
  778. * A numbering system override is a string containing either the name of a known numbering system,
  779. * or a set of field and numbering system pairs that specify which fields are to be formattied with
  780. * the alternate numbering system. For example, to specify that all numeric fields in the specified
  781. * date or time pattern are to be rendered using Thai digits, simply specify the numbering system override
  782. * as "thai". To specify that just the year portion of the date be formatted using Hebrew numbering,
  783. * use the override string "y=hebrew". Numbering system overrides can be combined using a semi-colon
  784. * character in the override string, such as "d=decimal;M=arabic;y=hebrew", etc.
  785. * <P>
  786. * [Note:] Not all locales support SimpleDateFormat; for full generality,
  787. * use the factory methods in the DateFormat class.
  788. * @param pattern the pattern for the format.
  789. * @param override the numbering system override.
  790. * @param locale the given locale.
  791. * @param status Output param set to success/failure code.
  792. * @stable ICU 4.2
  793. */
  794. SimpleDateFormat(const UnicodeString& pattern,
  795. const UnicodeString& override,
  796. const Locale& locale,
  797. UErrorCode& status);
  798. /**
  799. * Construct a SimpleDateFormat using the given pattern and locale-specific
  800. * symbol data. The formatter takes ownership of the DateFormatSymbols object;
  801. * the caller is no longer responsible for deleting it.
  802. * @param pattern the given pattern for the format.
  803. * @param formatDataToAdopt the symbols to be adopted.
  804. * @param status Output param set to success/faulure code.
  805. * @stable ICU 2.0
  806. */
  807. SimpleDateFormat(const UnicodeString& pattern,
  808. DateFormatSymbols* formatDataToAdopt,
  809. UErrorCode& status);
  810. /**
  811. * Construct a SimpleDateFormat using the given pattern and locale-specific
  812. * symbol data. The DateFormatSymbols object is NOT adopted; the caller
  813. * remains responsible for deleting it.
  814. * @param pattern the given pattern for the format.
  815. * @param formatData the formatting symbols to be use.
  816. * @param status Output param set to success/faulure code.
  817. * @stable ICU 2.0
  818. */
  819. SimpleDateFormat(const UnicodeString& pattern,
  820. const DateFormatSymbols& formatData,
  821. UErrorCode& status);
  822. /**
  823. * Copy constructor.
  824. * @stable ICU 2.0
  825. */
  826. SimpleDateFormat(const SimpleDateFormat&);
  827. /**
  828. * Assignment operator.
  829. * @stable ICU 2.0
  830. */
  831. SimpleDateFormat& operator=(const SimpleDateFormat&);
  832. /**
  833. * Destructor.
  834. * @stable ICU 2.0
  835. */
  836. virtual ~SimpleDateFormat();
  837. /**
  838. * Clone this Format object polymorphically. The caller owns the result and
  839. * should delete it when done.
  840. * @return A copy of the object.
  841. * @stable ICU 2.0
  842. */
  843. virtual Format* clone(void) const;
  844. /**
  845. * Return true if the given Format objects are semantically equal. Objects
  846. * of different subclasses are considered unequal.
  847. * @param other the object to be compared with.
  848. * @return true if the given Format objects are semantically equal.
  849. * @stable ICU 2.0
  850. */
  851. virtual UBool operator==(const Format& other) const;
  852. using DateFormat::format;
  853. /**
  854. * Format a date or time, which is the standard millis since 24:00 GMT, Jan
  855. * 1, 1970. Overrides DateFormat pure virtual method.
  856. * <P>
  857. * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->>
  858. * 1996.07.10 AD at 15:08:56 PDT
  859. *
  860. * @param cal Calendar set to the date and time to be formatted
  861. * into a date/time string.
  862. * @param appendTo Output parameter to receive result.
  863. * Result is appended to existing contents.
  864. * @param pos The formatting position. On input: an alignment field,
  865. * if desired. On output: the offsets of the alignment field.
  866. * @return Reference to 'appendTo' parameter.
  867. * @stable ICU 2.1
  868. */
  869. virtual UnicodeString& format( Calendar& cal,
  870. UnicodeString& appendTo,
  871. FieldPosition& pos) const;
  872. /**
  873. * Format a date or time, which is the standard millis since 24:00 GMT, Jan
  874. * 1, 1970. Overrides DateFormat pure virtual method.
  875. * <P>
  876. * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->>
  877. * 1996.07.10 AD at 15:08:56 PDT
  878. *
  879. * @param cal Calendar set to the date and time to be formatted
  880. * into a date/time string.
  881. * @param appendTo Output parameter to receive result.
  882. * Result is appended to existing contents.
  883. * @param posIter On return, can be used to iterate over positions
  884. * of fields generated by this format call. Field values
  885. * are defined in UDateFormatField.
  886. * @param status Input/output param set to success/failure code.
  887. * @return Reference to 'appendTo' parameter.
  888. * @stable ICU 4.4
  889. */
  890. virtual UnicodeString& format( Calendar& cal,
  891. UnicodeString& appendTo,
  892. FieldPositionIterator* posIter,
  893. UErrorCode& status) const;
  894. using DateFormat::parse;
  895. /**
  896. * Parse a date/time string beginning at the given parse position. For
  897. * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
  898. * that is equivalent to Date(837039928046).
  899. * <P>
  900. * By default, parsing is lenient: If the input is not in the form used by
  901. * this object's format method but can still be parsed as a date, then the
  902. * parse succeeds. Clients may insist on strict adherence to the format by
  903. * calling setLenient(false).
  904. * @see DateFormat::setLenient(boolean)
  905. *
  906. * @param text The date/time string to be parsed
  907. * @param cal A Calendar set on input to the date and time to be used for
  908. * missing values in the date/time string being parsed, and set
  909. * on output to the parsed date/time. When the calendar type is
  910. * different from the internal calendar held by this SimpleDateFormat
  911. * instance, the internal calendar will be cloned to a work
  912. * calendar set to the same milliseconds and time zone as the
  913. * cal parameter, field values will be parsed based on the work
  914. * calendar, then the result (milliseconds and time zone) will
  915. * be set in this calendar.
  916. * @param pos On input, the position at which to start parsing; on
  917. * output, the position at which parsing terminated, or the
  918. * start position if the parse failed.
  919. * @stable ICU 2.1
  920. */
  921. virtual void parse( const UnicodeString& text,
  922. Calendar& cal,
  923. ParsePosition& pos) const;
  924. /**
  925. * Set the start UDate used to interpret two-digit year strings.
  926. * When dates are parsed having 2-digit year strings, they are placed within
  927. * a assumed range of 100 years starting on the two digit start date. For
  928. * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or
  929. * some other year. SimpleDateFormat chooses a year so that the resultant
  930. * date is on or after the two digit start date and within 100 years of the
  931. * two digit start date.
  932. * <P>
  933. * By default, the two digit start date is set to 80 years before the current
  934. * time at which a SimpleDateFormat object is created.
  935. * @param d start UDate used to interpret two-digit year strings.
  936. * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with
  937. * an error value if there was a parse error.
  938. * @stable ICU 2.0
  939. */
  940. virtual void set2DigitYearStart(UDate d, UErrorCode& status);
  941. /**
  942. * Get the start UDate used to interpret two-digit year strings.
  943. * When dates are parsed having 2-digit year strings, they are placed within
  944. * a assumed range of 100 years starting on the two digit start date. For
  945. * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or
  946. * some other year. SimpleDateFormat chooses a year so that the resultant
  947. * date is on or after the two digit start date and within 100 years of the
  948. * two digit start date.
  949. * <P>
  950. * By default, the two digit start date is set to 80 years before the current
  951. * time at which a SimpleDateFormat object is created.
  952. * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with
  953. * an error value if there was a parse error.
  954. * @stable ICU 2.0
  955. */
  956. UDate get2DigitYearStart(UErrorCode& status) const;
  957. /**
  958. * Return a pattern string describing this date format.
  959. * @param result Output param to receive the pattern.
  960. * @return A reference to 'result'.
  961. * @stable ICU 2.0
  962. */
  963. virtual UnicodeString& toPattern(UnicodeString& result) const;
  964. /**
  965. * Return a localized pattern string describing this date format.
  966. * In most cases, this will return the same thing as toPattern(),
  967. * but a locale can specify characters to use in pattern descriptions
  968. * in place of the ones described in this class's class documentation.
  969. * (Presumably, letters that would be more mnemonic in that locale's
  970. * language.) This function would produce a pattern using those
  971. * letters.
  972. *
  973. * @param result Receives the localized pattern.
  974. * @param status Output param set to success/failure code on
  975. * exit. If the pattern is invalid, this will be
  976. * set to a failure result.
  977. * @return A reference to 'result'.
  978. * @stable ICU 2.0
  979. */
  980. virtual UnicodeString& toLocalizedPattern(UnicodeString& result,
  981. UErrorCode& status) const;
  982. /**
  983. * Apply the given unlocalized pattern string to this date format.
  984. * (i.e., after this call, this formatter will format dates according to
  985. * the new pattern)
  986. *
  987. * @param pattern The pattern to be applied.
  988. * @stable ICU 2.0
  989. */
  990. virtual void applyPattern(const UnicodeString& pattern);
  991. /**
  992. * Apply the given localized pattern string to this date format.
  993. * (see toLocalizedPattern() for more information on localized patterns.)
  994. *
  995. * @param pattern The localized pattern to be applied.
  996. * @param status Output param set to success/failure code on
  997. * exit. If the pattern is invalid, this will be
  998. * set to a failure result.
  999. * @stable ICU 2.0
  1000. */
  1001. virtual void applyLocalizedPattern(const UnicodeString& pattern,
  1002. UErrorCode& status);
  1003. /**
  1004. * Gets the date/time formatting symbols (this is an object carrying
  1005. * the various strings and other symbols used in formatting: e.g., month
  1006. * names and abbreviations, time zone names, AM/PM strings, etc.)
  1007. * @return a copy of the date-time formatting data associated
  1008. * with this date-time formatter.
  1009. * @stable ICU 2.0
  1010. */
  1011. virtual const DateFormatSymbols* getDateFormatSymbols(void) const;
  1012. /**
  1013. * Set the date/time formatting symbols. The caller no longer owns the
  1014. * DateFormatSymbols object and should not delete it after making this call.
  1015. * @param newFormatSymbols the given date-time formatting symbols to copy.
  1016. * @stable ICU 2.0
  1017. */
  1018. virtual void adoptDateFormatSymbols(DateFormatSymbols* newFormatSymbols);
  1019. /**
  1020. * Set the date/time formatting data.
  1021. * @param newFormatSymbols the given date-time formatting symbols to copy.
  1022. * @stable ICU 2.0
  1023. */
  1024. virtual void setDateFormatSymbols(const DateFormatSymbols& newFormatSymbols);
  1025. /**
  1026. * Return the class ID for this class. This is useful only for comparing to
  1027. * a return value from getDynamicClassID(). For example:
  1028. * <pre>
  1029. * . Base* polymorphic_pointer = createPolymorphicObject();
  1030. * . if (polymorphic_pointer->getDynamicClassID() ==
  1031. * . erived::getStaticClassID()) ...
  1032. * </pre>
  1033. * @return The class ID for all objects of this class.
  1034. * @stable ICU 2.0
  1035. */
  1036. static UClassID U_EXPORT2 getStaticClassID(void);
  1037. /**
  1038. * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
  1039. * method is to implement a simple version of RTTI, since not all C++
  1040. * compilers support genuine RTTI. Polymorphic operator==() and clone()
  1041. * methods call this method.
  1042. *
  1043. * @return The class ID for this object. All objects of a
  1044. * given class have the same class ID. Objects of
  1045. * other classes have different class IDs.
  1046. * @stable ICU 2.0
  1047. */
  1048. virtual UClassID getDynamicClassID(void) const;
  1049. /**
  1050. * Set the calendar to be used by this date format. Initially, the default
  1051. * calendar for the specified or default locale is used. The caller should
  1052. * not delete the Calendar object after it is adopted by this call.
  1053. * Adopting a new calendar will change to the default symbols.
  1054. *
  1055. * @param calendarToAdopt Calendar object to be adopted.
  1056. * @stable ICU 2.0
  1057. */
  1058. virtual void adoptCalendar(Calendar* calendarToAdopt);
  1059. /* Cannot use #ifndef U_HIDE_INTERNAL_API for the following methods since they are virtual */
  1060. /**
  1061. * Sets the TimeZoneFormat to be used by this date/time formatter.
  1062. * The caller should not delete the TimeZoneFormat object after
  1063. * it is adopted by this call.
  1064. * @param timeZoneFormatToAdopt The TimeZoneFormat object to be adopted.
  1065. * @internal ICU 49 technology preview
  1066. */
  1067. virtual void adoptTimeZoneFormat(TimeZoneFormat* timeZoneFormatToAdopt);
  1068. /**
  1069. * Sets the TimeZoneFormat to be used by this date/time formatter.
  1070. * @param newTimeZoneFormat The TimeZoneFormat object to copy.
  1071. * @internal ICU 49 technology preview
  1072. */
  1073. virtual void setTimeZoneFormat(const TimeZoneFormat& newTimeZoneFormat);
  1074. /**
  1075. * Gets the time zone format object associated with this date/time formatter.
  1076. * @return the time zone format associated with this date/time formatter.
  1077. * @internal ICU 49 technology preview
  1078. */
  1079. virtual const TimeZoneFormat* getTimeZoneFormat(void) const;
  1080. /**
  1081. * Set a particular UDisplayContext value in the formatter, such as
  1082. * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. Note: For getContext, see
  1083. * DateFormat.
  1084. * @param value The UDisplayContext value to set.
  1085. * @param status Input/output status. If at entry this indicates a failure
  1086. * status, the function will do nothing; otherwise this will be
  1087. * updated with any new status from the function.
  1088. * @stable ICU 53
  1089. */
  1090. virtual void setContext(UDisplayContext value, UErrorCode& status);
  1091. /**
  1092. * Overrides base class method and
  1093. * This method clears per field NumberFormat instances
  1094. * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)}
  1095. * @param adoptNF the NumbeferFormat used
  1096. * @stable ICU 54
  1097. */
  1098. void adoptNumberFormat(NumberFormat *formatToAdopt);
  1099. /**
  1100. * Allow the user to set the NumberFormat for several fields
  1101. * It can be a single field like: "y"(year) or "M"(month)
  1102. * It can be several field combined together: "yM"(year and month)
  1103. * Note:
  1104. * 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy")
  1105. * If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field)
  1106. * Per field NumberFormat can also be cleared in {@see DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)}
  1107. *
  1108. * @param fields the fields to override(like y)
  1109. * @param adoptNF the NumbeferFormat used
  1110. * @param status Receives a status code, which will be U_ZERO_ERROR
  1111. * if the operation succeeds.
  1112. * @stable ICU 54
  1113. */
  1114. void adoptNumberFormat(const UnicodeString& fields, NumberFormat *formatToAdopt, UErrorCode &status);
  1115. /**
  1116. * Get the numbering system to be used for a particular field.
  1117. * @param field The UDateFormatField to get
  1118. * @stable ICU 54
  1119. */
  1120. const NumberFormat * getNumberFormatForField(UChar field) const;
  1121. #ifndef U_HIDE_INTERNAL_API
  1122. /**
  1123. * This is for ICU internal use only. Please do not use.
  1124. * Check whether the 'field' is smaller than all the fields covered in
  1125. * pattern, return TRUE if it is. The sequence of calendar field,
  1126. * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,...
  1127. * @param field the calendar field need to check against
  1128. * @return TRUE if the 'field' is smaller than all the fields
  1129. * covered in pattern. FALSE otherwise.
  1130. * @internal ICU 4.0
  1131. */
  1132. UBool isFieldUnitIgnored(UCalendarDateFields field) const;
  1133. /**
  1134. * This is for ICU internal use only. Please do not use.
  1135. * Check whether the 'field' is smaller than all the fields covered in
  1136. * pattern, return TRUE if it is. The sequence of calendar field,
  1137. * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,...
  1138. * @param pattern the pattern to check against
  1139. * @param field the calendar field need to check against
  1140. * @return TRUE if the 'field' is smaller than all the fields
  1141. * covered in pattern. FALSE otherwise.
  1142. * @internal ICU 4.0
  1143. */
  1144. static UBool isFieldUnitIgnored(const UnicodeString& pattern,
  1145. UCalendarDateFields field);
  1146. /**
  1147. * This is for ICU internal use only. Please do not use.
  1148. * Get the locale of this simple date formatter.
  1149. * It is used in DateIntervalFormat.
  1150. *
  1151. * @return locale in this simple date formatter
  1152. * @internal ICU 4.0
  1153. */
  1154. const Locale& getSmpFmtLocale(void) const;
  1155. #endif /* U_HIDE_INTERNAL_API */
  1156. private:
  1157. friend class DateFormat;
  1158. void initializeDefaultCentury(void);
  1159. void initializeBooleanAttributes(void);
  1160. SimpleDateFormat(); // default constructor not implemented
  1161. /**
  1162. * Used by the DateFormat factory methods to construct a SimpleDateFormat.
  1163. * @param timeStyle the time style.
  1164. * @param dateStyle the date style.
  1165. * @param locale the given locale.
  1166. * @param status Output param set to success/failure code on
  1167. * exit.
  1168. */
  1169. SimpleDateFormat(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status);
  1170. /**
  1171. * Construct a SimpleDateFormat for the given locale. If no resource data
  1172. * is available, create an object of last resort, using hard-coded strings.
  1173. * This is an internal method, called by DateFormat. It should never fail.
  1174. * @param locale the given locale.
  1175. * @param status Output param set to success/failure code on
  1176. * exit.
  1177. */
  1178. SimpleDateFormat(const Locale& locale, UErrorCode& status); // Use default pattern
  1179. /**
  1180. * Hook called by format(... FieldPosition& ...) and format(...FieldPositionIterator&...)
  1181. */
  1182. UnicodeString& _format(Calendar& cal, UnicodeString& appendTo, FieldPositionHandler& handler, UErrorCode& status) const;
  1183. /**
  1184. * Called by format() to format a single field.
  1185. *
  1186. * @param appendTo Output parameter to receive result.
  1187. * Result is appended to existing contents.
  1188. * @param ch The format character we encountered in the pattern.
  1189. * @param count Number of characters in the current pattern symbol (e.g.,
  1190. * "yyyy" in the pattern would result in a call to this function
  1191. * with ch equal to 'y' and count equal to 4)
  1192. * @param capitalizationContext Capitalization context for this date format.
  1193. * @param fieldNum Zero-based numbering of current field within the overall format.
  1194. * @param handler Records information about field positions.
  1195. * @param cal Calendar to use
  1196. * @param status Receives a status code, which will be U_ZERO_ERROR if the operation
  1197. * succeeds.
  1198. */
  1199. void subFormat(UnicodeString &appendTo,
  1200. UChar ch,
  1201. int32_t count,
  1202. UDisplayContext capitalizationContext,
  1203. int32_t fieldNum,
  1204. FieldPositionHandler& handler,
  1205. Calendar& cal,
  1206. SimpleDateFormatMutableNFs &mutableNFs,
  1207. UErrorCode& status) const; // in case of illegal argument
  1208. /**
  1209. * Used by subFormat() to format a numeric value.
  1210. * Appends to toAppendTo a string representation of "value"
  1211. * having a number of digits between "minDigits" and
  1212. * "maxDigits". Uses the DateFormat's NumberFormat.
  1213. *
  1214. * @param currentNumberFormat
  1215. * @param appendTo Output parameter to receive result.
  1216. * Formatted number is appended to existing contents.
  1217. * @param value Value to format.
  1218. * @param minDigits Minimum number of digits the result should have
  1219. * @param maxDigits Maximum number of digits the result should have
  1220. */
  1221. void zeroPaddingNumber(NumberFormat *currentNumberFormat,
  1222. UnicodeString &appendTo,
  1223. int32_t value,
  1224. int32_t minDigits,
  1225. int32_t maxDigits) const;
  1226. /**
  1227. * Return true if the given format character, occuring count
  1228. * times, represents a numeric field.
  1229. */
  1230. static UBool isNumeric(UChar formatChar, int32_t count);
  1231. /**
  1232. * Returns TRUE if the patternOffset is at the start of a numeric field.
  1233. */
  1234. static UBool isAtNumericField(const UnicodeString &pattern, int32_t patternOffset);
  1235. /**
  1236. * Returns TRUE if the patternOffset is right after a non-numeric field.
  1237. */
  1238. static UBool isAfterNonNumericField(const UnicodeString &pattern, int32_t patternOffset);
  1239. /**
  1240. * initializes fCalendar from parameters. Returns fCalendar as a convenience.
  1241. * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault().
  1242. * @param locale Locale of the calendar
  1243. * @param status Error code
  1244. * @return the newly constructed fCalendar
  1245. */
  1246. Calendar *initializeCalendar(TimeZone* adoptZone, const Locale& locale, UErrorCode& status);
  1247. /**
  1248. * Called by several of the constructors to load pattern data and formatting symbols
  1249. * out of a resource bundle and initialize the locale based on it.
  1250. * @param timeStyle The time style, as passed to DateFormat::createDateInstance().
  1251. * @param dateStyle The date style, as passed to DateFormat::createTimeInstance().
  1252. * @param locale The locale to load the patterns from.
  1253. * @param status Filled in with an error code if loading the data from the
  1254. * resources fails.
  1255. */
  1256. void construct(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status);
  1257. /**
  1258. * Called by construct() and the various constructors to set up the SimpleDateFormat's
  1259. * Calendar and NumberFormat objects.
  1260. * @param locale The locale for which we want a Calendar and a NumberFormat.
  1261. * @param status Filled in with an error code if creating either subobject fails.
  1262. */
  1263. void initialize(const Locale& locale, UErrorCode& status);
  1264. /**
  1265. * Private code-size reduction function used by subParse.
  1266. * @param text the time text being parsed.
  1267. * @param start where to start parsing.
  1268. * @param field the date field being parsed.
  1269. * @param stringArray the string array to parsed.
  1270. * @param stringArrayCount the size of the array.
  1271. * @param monthPattern pointer to leap month pattern, or NULL if none.
  1272. * @param cal a Calendar set to the date and time to be formatted
  1273. * into a date/time string.
  1274. * @return the new start position if matching succeeded; a negative number
  1275. * indicating matching failure, otherwise.
  1276. */
  1277. int32_t matchString(const UnicodeString& text, int32_t start, UCalendarDateFields field,
  1278. const UnicodeString* stringArray, int32_t stringArrayCount,
  1279. const UnicodeString* monthPattern, Calendar& cal) const;
  1280. /**
  1281. * Private code-size reduction function used by subParse.
  1282. * @param text the time text being parsed.
  1283. * @param start where to start parsing.
  1284. * @param field the date field being parsed.
  1285. * @param stringArray the string array to parsed.
  1286. * @param stringArrayCount the size of the array.
  1287. * @param cal a Calendar set to the date and time to be formatted
  1288. * into a date/time string.
  1289. * @return the new start position if matching succeeded; a negative number
  1290. * indicating matching failure, otherwise.
  1291. */
  1292. int32_t matchQuarterString(const UnicodeString& text, int32_t start, UCalendarDateFields field,
  1293. const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const;
  1294. /**
  1295. * Used by subParse() to match localized day period strings.
  1296. */
  1297. int32_t matchDayPeriodStrings(const UnicodeString& text, int32_t start,
  1298. const UnicodeString* stringArray, int32_t stringArrayCount,
  1299. int32_t &dayPeriod) const;
  1300. /**
  1301. * Private function used by subParse to match literal pattern text.
  1302. *
  1303. * @param pattern the pattern string
  1304. * @param patternOffset the starting offset into the pattern text. On
  1305. * outupt will be set the offset of the first non-literal character in the pattern
  1306. * @param text the text being parsed
  1307. * @param textOffset the starting offset into the text. On output
  1308. * will be set to the offset of the character after the match
  1309. * @param whitespaceLenient <code>TRUE</code> if whitespace parse is lenient, <code>FALSE</code> otherwise.
  1310. * @param partialMatchLenient <code>TRUE</code> if partial match parse is lenient, <code>FALSE</code> otherwise.
  1311. * @param oldLeniency <code>TRUE</code> if old leniency control is lenient, <code>FALSE</code> otherwise.
  1312. *
  1313. * @return <code>TRUE</code> if the literal text could be matched, <code>FALSE</code> otherwise.
  1314. */
  1315. static UBool matchLiterals(const UnicodeString &pattern, int32_t &patternOffset,
  1316. const UnicodeString &text, int32_t &textOffset,
  1317. UBool whitespaceLenient, UBool partialMatchLenient, UBool oldLeniency);
  1318. /**
  1319. * Private member function that converts the parsed date strings into
  1320. * timeFields. Returns -start (for ParsePosition) if failed.
  1321. * @param text the time text to be parsed.
  1322. * @param start where to start parsing.
  1323. * @param ch the pattern character for the date field text to be parsed.
  1324. * @param count the count of a pattern character.
  1325. * @param obeyCount if true then the count is strictly obeyed.
  1326. * @param allowNegative
  1327. * @param ambiguousYear If true then the two-digit year == the default start year.
  1328. * @param saveHebrewMonth Used to hang onto month until year is known.
  1329. * @param cal a Calendar set to the date and time to be formatted
  1330. * into a date/time string.
  1331. * @param patLoc
  1332. * @param numericLeapMonthFormatter If non-null, used to parse numeric leap months.
  1333. * @param tzTimeType the type of parsed time zone - standard, daylight or unknown (output).
  1334. * This parameter can be NULL if caller does not need the information.
  1335. * @return the new start position if matching succeeded; a negative number
  1336. * indicating matching failure, otherwise.
  1337. */
  1338. int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count,
  1339. UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
  1340. int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs,
  1341. int32_t *dayPeriod=NULL) const;
  1342. void parseInt(const UnicodeString& text,
  1343. Formattable& number,
  1344. ParsePosition& pos,
  1345. UBool allowNegative,
  1346. NumberFormat *fmt) const;
  1347. void parseInt(const UnicodeString& text,
  1348. Formattable& number,
  1349. int32_t maxDigits,
  1350. ParsePosition& pos,
  1351. UBool allowNegative,
  1352. NumberFormat *fmt) const;
  1353. int32_t checkIntSuffix(const UnicodeString& text, int32_t start,
  1354. int32_t patLoc, UBool isNegative) const;
  1355. /**
  1356. * Translate a pattern, mapping each character in the from string to the
  1357. * corresponding character in the to string. Return an error if the original
  1358. * pattern contains an unmapped character, or if a quote is unmatched.
  1359. * Quoted (single quotes only) material is not translated.
  1360. * @param originalPattern the original pattern.
  1361. * @param translatedPattern Output param to receive the translited pattern.
  1362. * @param from the characters to be translited from.
  1363. * @param to the characters to be translited to.
  1364. * @param status Receives a status code, which will be U_ZERO_ERROR
  1365. * if the operation succeeds.
  1366. */
  1367. static void translatePattern(const UnicodeString& originalPattern,
  1368. UnicodeString& translatedPattern,
  1369. const UnicodeString& from,
  1370. const UnicodeString& to,
  1371. UErrorCode& status);
  1372. /**
  1373. * Sets the starting date of the 100-year window that dates with 2-digit years
  1374. * are considered to fall within.
  1375. * @param startDate the start date
  1376. * @param status Receives a status code, which will be U_ZERO_ERROR
  1377. * if the operation succeeds.
  1378. */
  1379. void parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& status);
  1380. /**
  1381. * Return the length matched by the given affix, or -1 if none.
  1382. * Runs of white space in the affix, match runs of white space in
  1383. * the input.
  1384. * @param affix pattern string, taken as a literal
  1385. * @param input input text
  1386. * @param pos offset into input at which to begin matching
  1387. * @return length of input that matches, or -1 if match failure
  1388. */
  1389. int32_t compareSimpleAffix(const UnicodeString& affix,
  1390. const UnicodeString& input,
  1391. int32_t pos) const;
  1392. /**
  1393. * Skip over a run of zero or more Pattern_White_Space characters at
  1394. * pos in text.
  1395. */
  1396. int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos) const;
  1397. /**
  1398. * Skip over a run of zero or more isUWhiteSpace() characters at pos
  1399. * in text.
  1400. */
  1401. int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const;
  1402. /**
  1403. * Initialize NumberFormat instances used for numbering system overrides.
  1404. */
  1405. void initNumberFormatters(const Locale &locale,UErrorCode &status);
  1406. /**
  1407. * Parse the given override string and set up structures for number formats
  1408. */
  1409. void processOverrideString(const Locale &locale, const UnicodeString &str, int8_t type, UErrorCode &status);
  1410. /**
  1411. * Used to map pattern characters to Calendar field identifiers.
  1412. */
  1413. static const UCalendarDateFields fgPatternIndexToCalendarField[];
  1414. /**
  1415. * Map index into pattern character string to DateFormat field number
  1416. */
  1417. static const UDateFormatField fgPatternIndexToDateFormatField[];
  1418. /**
  1419. * Lazy TimeZoneFormat instantiation, semantically const
  1420. */
  1421. TimeZoneFormat *tzFormat() const;
  1422. const NumberFormat* getNumberFormatByIndex(UDateFormatField index) const;
  1423. /**
  1424. * Used to map Calendar field to field level.
  1425. * The larger the level, the smaller the field unit.
  1426. * For example, UCAL_ERA level is 0, UCAL_YEAR level is 10,
  1427. * UCAL_MONTH level is 20.
  1428. */
  1429. static const int32_t fgCalendarFieldToLevel[];
  1430. /**
  1431. * Map calendar field letter into calendar field level.
  1432. */
  1433. static int32_t getLevelFromChar(UChar ch);
  1434. /**
  1435. * Tell if a character can be used to define a field in a format string.
  1436. */
  1437. static UBool isSyntaxChar(UChar ch);
  1438. /**
  1439. * The formatting pattern for this formatter.
  1440. */
  1441. UnicodeString fPattern;
  1442. /**
  1443. * The numbering system override for dates.
  1444. */
  1445. UnicodeString fDateOverride;
  1446. /**
  1447. * The numbering system override for times.
  1448. */
  1449. UnicodeString fTimeOverride;
  1450. /**
  1451. * The original locale used (for reloading symbols)
  1452. */
  1453. Locale fLocale;
  1454. /**
  1455. * A pointer to an object containing the strings to use in formatting (e.g.,
  1456. * month and day names, AM and PM strings, time zone names, etc.)
  1457. */
  1458. DateFormatSymbols* fSymbols; // Owned
  1459. /**
  1460. * The time zone formatter
  1461. */
  1462. TimeZoneFormat* fTimeZoneFormat;
  1463. /**
  1464. * If dates have ambiguous years, we map them into the century starting
  1465. * at defaultCenturyStart, which may be any date. If defaultCenturyStart is
  1466. * set to SYSTEM_DEFAULT_CENTURY, which it is by default, then the system
  1467. * values are used. The instance values defaultCenturyStart and
  1468. * defaultCenturyStartYear are only used if explicitly set by the user
  1469. * through the API method parseAmbiguousDatesAsAfter().
  1470. */
  1471. UDate fDefaultCenturyStart;
  1472. UBool fHasMinute;
  1473. UBool fHasSecond;
  1474. /**
  1475. * Sets fHasMinutes and fHasSeconds.
  1476. */
  1477. void parsePattern();
  1478. /**
  1479. * See documentation for defaultCenturyStart.
  1480. */
  1481. /*transient*/ int32_t fDefaultCenturyStartYear;
  1482. struct NSOverride : public UMemory {
  1483. const SharedNumberFormat *snf;
  1484. int32_t hash;
  1485. NSOverride *next;
  1486. void free();
  1487. NSOverride() : snf(NULL), hash(0), next(NULL) {
  1488. }
  1489. ~NSOverride();
  1490. };
  1491. /**
  1492. * The number format in use for each date field. NULL means fall back
  1493. * to fNumberFormat in DateFormat.
  1494. */
  1495. const SharedNumberFormat **fSharedNumberFormatters;
  1496. UBool fHaveDefaultCentury;
  1497. BreakIterator* fCapitalizationBrkIter;
  1498. };
  1499. inline UDate
  1500. SimpleDateFormat::get2DigitYearStart(UErrorCode& /*status*/) const
  1501. {
  1502. return fDefaultCenturyStart;
  1503. }
  1504. U_NAMESPACE_END
  1505. #endif /* #if !UCONFIG_NO_FORMATTING */
  1506. #endif // _SMPDTFMT
  1507. //eof