tzfmt.h 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2011-2015, International Business Machines Corporation and
  6. * others. All Rights Reserved.
  7. *******************************************************************************
  8. */
  9. #ifndef __TZFMT_H
  10. #define __TZFMT_H
  11. /**
  12. * \file
  13. * \brief C++ API: TimeZoneFormat
  14. */
  15. #include "unicode/utypes.h"
  16. #if U_SHOW_CPLUSPLUS_API
  17. #if !UCONFIG_NO_FORMATTING
  18. #include "unicode/format.h"
  19. #include "unicode/timezone.h"
  20. #include "unicode/tznames.h"
  21. U_CDECL_BEGIN
  22. /**
  23. * Constants for time zone display format style used by format/parse APIs
  24. * in TimeZoneFormat.
  25. * @stable ICU 50
  26. */
  27. typedef enum UTimeZoneFormatStyle {
  28. /**
  29. * Generic location format, such as "United States Time (New York)", "Italy Time"
  30. * @stable ICU 50
  31. */
  32. UTZFMT_STYLE_GENERIC_LOCATION,
  33. /**
  34. * Generic long non-location format, such as "Eastern Time".
  35. * @stable ICU 50
  36. */
  37. UTZFMT_STYLE_GENERIC_LONG,
  38. /**
  39. * Generic short non-location format, such as "ET".
  40. * @stable ICU 50
  41. */
  42. UTZFMT_STYLE_GENERIC_SHORT,
  43. /**
  44. * Specific long format, such as "Eastern Standard Time".
  45. * @stable ICU 50
  46. */
  47. UTZFMT_STYLE_SPECIFIC_LONG,
  48. /**
  49. * Specific short format, such as "EST", "PDT".
  50. * @stable ICU 50
  51. */
  52. UTZFMT_STYLE_SPECIFIC_SHORT,
  53. /**
  54. * Localized GMT offset format, such as "GMT-05:00", "UTC+0100"
  55. * @stable ICU 50
  56. */
  57. UTZFMT_STYLE_LOCALIZED_GMT,
  58. /**
  59. * Short localized GMT offset format, such as "GMT-5", "UTC+1:30"
  60. * This style is equivalent to the LDML date format pattern "O".
  61. * @stable ICU 51
  62. */
  63. UTZFMT_STYLE_LOCALIZED_GMT_SHORT,
  64. /**
  65. * Short ISO 8601 local time difference (basic format) or the UTC indicator.
  66. * For example, "-05", "+0530", and "Z"(UTC).
  67. * This style is equivalent to the LDML date format pattern "X".
  68. * @stable ICU 51
  69. */
  70. UTZFMT_STYLE_ISO_BASIC_SHORT,
  71. /**
  72. * Short ISO 8601 locale time difference (basic format).
  73. * For example, "-05" and "+0530".
  74. * This style is equivalent to the LDML date format pattern "x".
  75. * @stable ICU 51
  76. */
  77. UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT,
  78. /**
  79. * Fixed width ISO 8601 local time difference (basic format) or the UTC indicator.
  80. * For example, "-0500", "+0530", and "Z"(UTC).
  81. * This style is equivalent to the LDML date format pattern "XX".
  82. * @stable ICU 51
  83. */
  84. UTZFMT_STYLE_ISO_BASIC_FIXED,
  85. /**
  86. * Fixed width ISO 8601 local time difference (basic format).
  87. * For example, "-0500" and "+0530".
  88. * This style is equivalent to the LDML date format pattern "xx".
  89. * @stable ICU 51
  90. */
  91. UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED,
  92. /**
  93. * ISO 8601 local time difference (basic format) with optional seconds field, or the UTC indicator.
  94. * For example, "-0500", "+052538", and "Z"(UTC).
  95. * This style is equivalent to the LDML date format pattern "XXXX".
  96. * @stable ICU 51
  97. */
  98. UTZFMT_STYLE_ISO_BASIC_FULL,
  99. /**
  100. * ISO 8601 local time difference (basic format) with optional seconds field.
  101. * For example, "-0500" and "+052538".
  102. * This style is equivalent to the LDML date format pattern "xxxx".
  103. * @stable ICU 51
  104. */
  105. UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL,
  106. /**
  107. * Fixed width ISO 8601 local time difference (extended format) or the UTC indicator.
  108. * For example, "-05:00", "+05:30", and "Z"(UTC).
  109. * This style is equivalent to the LDML date format pattern "XXX".
  110. * @stable ICU 51
  111. */
  112. UTZFMT_STYLE_ISO_EXTENDED_FIXED,
  113. /**
  114. * Fixed width ISO 8601 local time difference (extended format).
  115. * For example, "-05:00" and "+05:30".
  116. * This style is equivalent to the LDML date format pattern "xxx" and "ZZZZZ".
  117. * @stable ICU 51
  118. */
  119. UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED,
  120. /**
  121. * ISO 8601 local time difference (extended format) with optional seconds field, or the UTC indicator.
  122. * For example, "-05:00", "+05:25:38", and "Z"(UTC).
  123. * This style is equivalent to the LDML date format pattern "XXXXX".
  124. * @stable ICU 51
  125. */
  126. UTZFMT_STYLE_ISO_EXTENDED_FULL,
  127. /**
  128. * ISO 8601 local time difference (extended format) with optional seconds field.
  129. * For example, "-05:00" and "+05:25:38".
  130. * This style is equivalent to the LDML date format pattern "xxxxx".
  131. * @stable ICU 51
  132. */
  133. UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL,
  134. /**
  135. * Time Zone ID, such as "America/Los_Angeles".
  136. * @stable ICU 51
  137. */
  138. UTZFMT_STYLE_ZONE_ID,
  139. /**
  140. * Short Time Zone ID (BCP 47 Unicode location extension, time zone type value), such as "uslax".
  141. * @stable ICU 51
  142. */
  143. UTZFMT_STYLE_ZONE_ID_SHORT,
  144. /**
  145. * Exemplar location, such as "Los Angeles" and "Paris".
  146. * @stable ICU 51
  147. */
  148. UTZFMT_STYLE_EXEMPLAR_LOCATION
  149. } UTimeZoneFormatStyle;
  150. /**
  151. * Constants for GMT offset pattern types.
  152. * @stable ICU 50
  153. */
  154. typedef enum UTimeZoneFormatGMTOffsetPatternType {
  155. /**
  156. * Positive offset with hours and minutes fields
  157. * @stable ICU 50
  158. */
  159. UTZFMT_PAT_POSITIVE_HM,
  160. /**
  161. * Positive offset with hours, minutes and seconds fields
  162. * @stable ICU 50
  163. */
  164. UTZFMT_PAT_POSITIVE_HMS,
  165. /**
  166. * Negative offset with hours and minutes fields
  167. * @stable ICU 50
  168. */
  169. UTZFMT_PAT_NEGATIVE_HM,
  170. /**
  171. * Negative offset with hours, minutes and seconds fields
  172. * @stable ICU 50
  173. */
  174. UTZFMT_PAT_NEGATIVE_HMS,
  175. /**
  176. * Positive offset with hours field
  177. * @stable ICU 51
  178. */
  179. UTZFMT_PAT_POSITIVE_H,
  180. /**
  181. * Negative offset with hours field
  182. * @stable ICU 51
  183. */
  184. UTZFMT_PAT_NEGATIVE_H,
  185. /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed for other .h declarations */
  186. /**
  187. * Number of UTimeZoneFormatGMTOffsetPatternType types.
  188. * @internal
  189. */
  190. UTZFMT_PAT_COUNT = 6
  191. } UTimeZoneFormatGMTOffsetPatternType;
  192. /**
  193. * Constants for time types used by TimeZoneFormat APIs for
  194. * receiving time type (standard time, daylight time or unknown).
  195. * @stable ICU 50
  196. */
  197. typedef enum UTimeZoneFormatTimeType {
  198. /**
  199. * Unknown
  200. * @stable ICU 50
  201. */
  202. UTZFMT_TIME_TYPE_UNKNOWN,
  203. /**
  204. * Standard time
  205. * @stable ICU 50
  206. */
  207. UTZFMT_TIME_TYPE_STANDARD,
  208. /**
  209. * Daylight saving time
  210. * @stable ICU 50
  211. */
  212. UTZFMT_TIME_TYPE_DAYLIGHT
  213. } UTimeZoneFormatTimeType;
  214. /**
  215. * Constants for parse option flags, used for specifying optional parse behavior.
  216. * @stable ICU 50
  217. */
  218. typedef enum UTimeZoneFormatParseOption {
  219. /**
  220. * No option.
  221. * @stable ICU 50
  222. */
  223. UTZFMT_PARSE_OPTION_NONE = 0x00,
  224. /**
  225. * When a time zone display name is not found within a set of display names
  226. * used for the specified style, look for the name from display names used
  227. * by other styles.
  228. * @stable ICU 50
  229. */
  230. UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01,
  231. /**
  232. * When parsing a time zone display name in \link UTZFMT_STYLE_SPECIFIC_SHORT \endlink,
  233. * look for the IANA tz database compatible zone abbreviations in addition
  234. * to the localized names coming from the icu::TimeZoneNames currently
  235. * used by the icu::TimeZoneFormat.
  236. * @stable ICU 54
  237. */
  238. UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS = 0x02
  239. } UTimeZoneFormatParseOption;
  240. U_CDECL_END
  241. U_NAMESPACE_BEGIN
  242. class TimeZoneGenericNames;
  243. class TZDBTimeZoneNames;
  244. class UVector;
  245. /**
  246. * <code>TimeZoneFormat</code> supports time zone display name formatting and parsing.
  247. * An instance of TimeZoneFormat works as a subformatter of {@link SimpleDateFormat},
  248. * but you can also directly get a new instance of <code>TimeZoneFormat</code> and
  249. * formatting/parsing time zone display names.
  250. * <p>
  251. * ICU implements the time zone display names defined by <a href="http://www.unicode.org/reports/tr35/">UTS#35
  252. * Unicode Locale Data Markup Language (LDML)</a>. {@link TimeZoneNames} represents the
  253. * time zone display name data model and this class implements the algorithm for actual
  254. * formatting and parsing.
  255. *
  256. * @see SimpleDateFormat
  257. * @see TimeZoneNames
  258. * @stable ICU 50
  259. */
  260. class U_I18N_API TimeZoneFormat : public Format {
  261. public:
  262. /**
  263. * Copy constructor.
  264. * @stable ICU 50
  265. */
  266. TimeZoneFormat(const TimeZoneFormat& other);
  267. /**
  268. * Destructor.
  269. * @stable ICU 50
  270. */
  271. virtual ~TimeZoneFormat();
  272. /**
  273. * Assignment operator.
  274. * @stable ICU 50
  275. */
  276. TimeZoneFormat& operator=(const TimeZoneFormat& other);
  277. /**
  278. * Return true if the given Format objects are semantically equal.
  279. * Objects of different subclasses are considered unequal.
  280. * @param other The object to be compared with.
  281. * @return Return true if the given Format objects are semantically equal.
  282. * Objects of different subclasses are considered unequal.
  283. * @stable ICU 50
  284. */
  285. virtual bool operator==(const Format& other) const override;
  286. /**
  287. * Clone this object polymorphically. The caller is responsible
  288. * for deleting the result when done.
  289. * @return A copy of the object
  290. * @stable ICU 50
  291. */
  292. virtual TimeZoneFormat* clone() const override;
  293. /**
  294. * Creates an instance of <code>TimeZoneFormat</code> for the given locale.
  295. * @param locale The locale.
  296. * @param status Receives the status.
  297. * @return An instance of <code>TimeZoneFormat</code> for the given locale,
  298. * owned by the caller.
  299. * @stable ICU 50
  300. */
  301. static TimeZoneFormat* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
  302. /**
  303. * Returns the time zone display name data used by this instance.
  304. * @return The time zone display name data.
  305. * @stable ICU 50
  306. */
  307. const TimeZoneNames* getTimeZoneNames() const;
  308. /**
  309. * Sets the time zone display name data to this format instance.
  310. * The caller should not delete the TimeZoenNames object after it is adopted
  311. * by this call.
  312. * @param tznames TimeZoneNames object to be adopted.
  313. * @stable ICU 50
  314. */
  315. void adoptTimeZoneNames(TimeZoneNames *tznames);
  316. /**
  317. * Sets the time zone display name data to this format instance.
  318. * @param tznames TimeZoneNames object to be set.
  319. * @stable ICU 50
  320. */
  321. void setTimeZoneNames(const TimeZoneNames &tznames);
  322. /**
  323. * Returns the localized GMT format pattern.
  324. * @param pattern Receives the localized GMT format pattern.
  325. * @return A reference to the result pattern.
  326. * @see #setGMTPattern
  327. * @stable ICU 50
  328. */
  329. UnicodeString& getGMTPattern(UnicodeString& pattern) const;
  330. /**
  331. * Sets the localized GMT format pattern. The pattern must contain
  332. * a single argument {0}, for example "GMT {0}".
  333. * @param pattern The localized GMT format pattern to be used by this object.
  334. * @param status Receives the status.
  335. * @see #getGMTPattern
  336. * @stable ICU 50
  337. */
  338. void setGMTPattern(const UnicodeString& pattern, UErrorCode& status);
  339. /**
  340. * Returns the offset pattern used for localized GMT format.
  341. * @param type The offset pattern type enum.
  342. * @param pattern Receives the offset pattern.
  343. * @return A reference to the result pattern.
  344. * @see #setGMTOffsetPattern
  345. * @stable ICU 50
  346. */
  347. UnicodeString& getGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, UnicodeString& pattern) const;
  348. /**
  349. * Sets the offset pattern for the given offset type.
  350. * @param type The offset pattern type enum.
  351. * @param pattern The offset pattern used for localized GMT format for the type.
  352. * @param status Receives the status.
  353. * @see #getGMTOffsetPattern
  354. * @stable ICU 50
  355. */
  356. void setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, const UnicodeString& pattern, UErrorCode& status);
  357. /**
  358. * Returns the decimal digit characters used for localized GMT format.
  359. * The return string contains exactly 10 code points (may include Unicode
  360. * supplementary character) representing digit 0 to digit 9 in the ascending
  361. * order.
  362. * @param digits Receives the decimal digits used for localized GMT format.
  363. * @see #setGMTOffsetDigits
  364. * @stable ICU 50
  365. */
  366. UnicodeString& getGMTOffsetDigits(UnicodeString& digits) const;
  367. /**
  368. * Sets the decimal digit characters used for localized GMT format.
  369. * The input <code>digits</code> must contain exactly 10 code points
  370. * (Unicode supplementary characters are also allowed) representing
  371. * digit 0 to digit 9 in the ascending order. When the input <code>digits</code>
  372. * does not satisfy the condition, <code>U_ILLEGAL_ARGUMENT_ERROR</code>
  373. * will be set to the return status.
  374. * @param digits The decimal digits used for localized GMT format.
  375. * @param status Receives the status.
  376. * @see #getGMTOffsetDigits
  377. * @stable ICU 50
  378. */
  379. void setGMTOffsetDigits(const UnicodeString& digits, UErrorCode& status);
  380. /**
  381. * Returns the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
  382. * @param gmtZeroFormat Receives the localized GMT string string for GMT(UTC) itself.
  383. * @return A reference to the result GMT string.
  384. * @see #setGMTZeroFormat
  385. * @stable ICU 50
  386. */
  387. UnicodeString& getGMTZeroFormat(UnicodeString& gmtZeroFormat) const;
  388. /**
  389. * Sets the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
  390. * @param gmtZeroFormat The localized GMT format string for GMT(UTC).
  391. * @param status Receives the status.
  392. * @see #getGMTZeroFormat
  393. * @stable ICU 50
  394. */
  395. void setGMTZeroFormat(const UnicodeString& gmtZeroFormat, UErrorCode& status);
  396. /**
  397. * Returns the bitwise flags of UTimeZoneFormatParseOption representing the default parse
  398. * options used by this object.
  399. * @return the default parse options.
  400. * @see ParseOption
  401. * @stable ICU 50
  402. */
  403. uint32_t getDefaultParseOptions() const;
  404. /**
  405. * Sets the default parse options.
  406. * <p><b>Note</b>: By default, an instance of <code>TimeZoneFormat</code>
  407. * created by {@link #createInstance} has no parse options set (UTZFMT_PARSE_OPTION_NONE).
  408. * To specify multiple options, use bitwise flags of UTimeZoneFormatParseOption.
  409. * @see #UTimeZoneFormatParseOption
  410. * @stable ICU 50
  411. */
  412. void setDefaultParseOptions(uint32_t flags);
  413. /**
  414. * Returns the ISO 8601 basic time zone string for the given offset.
  415. * For example, "-08", "-0830" and "Z"
  416. *
  417. * @param offset the offset from GMT(UTC) in milliseconds.
  418. * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when the offset is 0.
  419. * @param isShort true if shortest form is used.
  420. * @param ignoreSeconds true if non-zero offset seconds is appended.
  421. * @param result Receives the ISO format string.
  422. * @param status Receives the status
  423. * @return the ISO 8601 basic format.
  424. * @see #formatOffsetISO8601Extended
  425. * @see #parseOffsetISO8601
  426. * @stable ICU 51
  427. */
  428. UnicodeString& formatOffsetISO8601Basic(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds,
  429. UnicodeString& result, UErrorCode& status) const;
  430. /**
  431. * Returns the ISO 8601 extended time zone string for the given offset.
  432. * For example, "-08:00", "-08:30" and "Z"
  433. *
  434. * @param offset the offset from GMT(UTC) in milliseconds.
  435. * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when the offset is 0.
  436. * @param isShort true if shortest form is used.
  437. * @param ignoreSeconds true if non-zero offset seconds is appended.
  438. * @param result Receives the ISO format string.
  439. * @param status Receives the status
  440. * @return the ISO 8601 basic format.
  441. * @see #formatOffsetISO8601Extended
  442. * @see #parseOffsetISO8601
  443. * @stable ICU 51
  444. */
  445. UnicodeString& formatOffsetISO8601Extended(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds,
  446. UnicodeString& result, UErrorCode& status) const;
  447. /**
  448. * Returns the localized GMT(UTC) offset format for the given offset.
  449. * The localized GMT offset is defined by;
  450. * <ul>
  451. * <li>GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern})
  452. * <li>Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern})
  453. * <li>Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits})
  454. * <li>GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat})
  455. * </ul>
  456. * This format always uses 2 digit hours and minutes. When the given offset has non-zero
  457. * seconds, 2 digit seconds field will be appended. For example,
  458. * GMT+05:00 and GMT+05:28:06.
  459. * @param offset the offset from GMT(UTC) in milliseconds.
  460. * @param status Receives the status
  461. * @param result Receives the localized GMT format string.
  462. * @return A reference to the result.
  463. * @see #parseOffsetLocalizedGMT
  464. * @stable ICU 50
  465. */
  466. UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UnicodeString& result, UErrorCode& status) const;
  467. /**
  468. * Returns the short localized GMT(UTC) offset format for the given offset.
  469. * The short localized GMT offset is defined by;
  470. * <ul>
  471. * <li>GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern})
  472. * <li>Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern})
  473. * <li>Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits})
  474. * <li>GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat})
  475. * </ul>
  476. * This format uses the shortest representation of offset. The hours field does not
  477. * have leading zero and lower fields with zero will be truncated. For example,
  478. * GMT+5 and GMT+530.
  479. * @param offset the offset from GMT(UTC) in milliseconds.
  480. * @param status Receives the status
  481. * @param result Receives the short localized GMT format string.
  482. * @return A reference to the result.
  483. * @see #parseOffsetShortLocalizedGMT
  484. * @stable ICU 51
  485. */
  486. UnicodeString& formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString& result, UErrorCode& status) const;
  487. using Format::format;
  488. /**
  489. * Returns the display name of the time zone at the given date for the style.
  490. * @param style The style (e.g. <code>UTZFMT_STYLE_GENERIC_LONG</code>, <code>UTZFMT_STYLE_LOCALIZED_GMT</code>...)
  491. * @param tz The time zone.
  492. * @param date The date.
  493. * @param name Receives the display name.
  494. * @param timeType the output argument for receiving the time type (standard/daylight/unknown)
  495. * used for the display name, or nullptr if the information is not necessary.
  496. * @return A reference to the result
  497. * @see #UTimeZoneFormatStyle
  498. * @see #UTimeZoneFormatTimeType
  499. * @stable ICU 50
  500. */
  501. virtual UnicodeString& format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate date,
  502. UnicodeString& name, UTimeZoneFormatTimeType* timeType = nullptr) const;
  503. /**
  504. * Returns offset from GMT(UTC) in milliseconds for the given ISO 8601
  505. * style time zone string. When the given string is not an ISO 8601 time zone
  506. * string, this method sets the current position as the error index
  507. * to <code>ParsePosition pos</code> and returns 0.
  508. * @param text The text contains ISO8601 style time zone string (e.g. "-08:00", "Z")
  509. * at the position.
  510. * @param pos The ParsePosition object.
  511. * @return The offset from GMT(UTC) in milliseconds for the given ISO 8601 style
  512. * time zone string.
  513. * @see #formatOffsetISO8601Basic
  514. * @see #formatOffsetISO8601Extended
  515. * @stable ICU 50
  516. */
  517. int32_t parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos) const;
  518. /**
  519. * Returns offset from GMT(UTC) in milliseconds for the given localized GMT
  520. * offset format string. When the given string cannot be parsed, this method
  521. * sets the current position as the error index to <code>ParsePosition pos</code>
  522. * and returns 0.
  523. * @param text The text contains a localized GMT offset string at the position.
  524. * @param pos The ParsePosition object.
  525. * @return The offset from GMT(UTC) in milliseconds for the given localized GMT
  526. * offset format string.
  527. * @see #formatOffsetLocalizedGMT
  528. * @stable ICU 50
  529. */
  530. int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const;
  531. /**
  532. * Returns offset from GMT(UTC) in milliseconds for the given short localized GMT
  533. * offset format string. When the given string cannot be parsed, this method
  534. * sets the current position as the error index to <code>ParsePosition pos</code>
  535. * and returns 0.
  536. * @param text The text contains a short localized GMT offset string at the position.
  537. * @param pos The ParsePosition object.
  538. * @return The offset from GMT(UTC) in milliseconds for the given short localized GMT
  539. * offset format string.
  540. * @see #formatOffsetShortLocalizedGMT
  541. * @stable ICU 51
  542. */
  543. int32_t parseOffsetShortLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const;
  544. /**
  545. * Returns a <code>TimeZone</code> by parsing the time zone string according to
  546. * the given parse position, the specified format style and parse options.
  547. *
  548. * @param text The text contains a time zone string at the position.
  549. * @param style The format style
  550. * @param pos The position.
  551. * @param parseOptions The parse options represented by bitwise flags of UTimeZoneFormatParseOption.
  552. * @param timeType The output argument for receiving the time type (standard/daylight/unknown),
  553. * or nullptr if the information is not necessary.
  554. * @return A <code>TimeZone</code>, or null if the input could not be parsed.
  555. * @see UTimeZoneFormatStyle
  556. * @see UTimeZoneFormatParseOption
  557. * @see UTimeZoneFormatTimeType
  558. * @stable ICU 50
  559. */
  560. virtual TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
  561. int32_t parseOptions, UTimeZoneFormatTimeType* timeType = nullptr) const;
  562. /**
  563. * Returns a <code>TimeZone</code> by parsing the time zone string according to
  564. * the given parse position, the specified format style and the default parse options.
  565. *
  566. * @param text The text contains a time zone string at the position.
  567. * @param style The format style
  568. * @param pos The position.
  569. * @param timeType The output argument for receiving the time type (standard/daylight/unknown),
  570. * or nullptr if the information is not necessary.
  571. * @return A <code>TimeZone</code>, or null if the input could not be parsed.
  572. * @see UTimeZoneFormatStyle
  573. * @see UTimeZoneFormatParseOption
  574. * @see UTimeZoneFormatTimeType
  575. * @stable ICU 50
  576. */
  577. TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
  578. UTimeZoneFormatTimeType* timeType = nullptr) const;
  579. /* ----------------------------------------------
  580. * Format APIs
  581. * ---------------------------------------------- */
  582. /**
  583. * Format an object to produce a time zone display string using localized GMT offset format.
  584. * This method handles Formattable objects with a <code>TimeZone</code>. If a the Formattable
  585. * object type is not a <code>TimeZone</code>, then it returns a failing UErrorCode.
  586. * @param obj The object to format. Must be a <code>TimeZone</code>.
  587. * @param appendTo Output parameter to receive result. Result is appended to existing contents.
  588. * @param pos On input: an alignment field, if desired. On output: the offsets of the alignment field.
  589. * @param status Output param filled with success/failure status.
  590. * @return Reference to 'appendTo' parameter.
  591. * @stable ICU 50
  592. */
  593. virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo,
  594. FieldPosition& pos, UErrorCode& status) const override;
  595. /**
  596. * Parse a string to produce an object. This methods handles parsing of
  597. * time zone display strings into Formattable objects with <code>TimeZone</code>.
  598. * @param source The string to be parsed into an object.
  599. * @param result Formattable to be set to the parse result. If parse fails, return contents are undefined.
  600. * @param parse_pos The position to start parsing at. Upon return this param is set to the position after the
  601. * last character successfully parsed. If the source is not parsed successfully, this param
  602. * will remain unchanged.
  603. * @return A newly created Formattable* object, or nullptr on failure. The caller owns this and should
  604. * delete it when done.
  605. * @stable ICU 50
  606. */
  607. virtual void parseObject(const UnicodeString& source, Formattable& result, ParsePosition& parse_pos) const override;
  608. /**
  609. * ICU "poor man's RTTI", returns a UClassID for this class.
  610. * @stable ICU 50
  611. */
  612. static UClassID U_EXPORT2 getStaticClassID();
  613. /**
  614. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  615. * @stable ICU 50
  616. */
  617. virtual UClassID getDynamicClassID() const override;
  618. protected:
  619. /**
  620. * Constructs a TimeZoneFormat object for the specified locale.
  621. * @param locale the locale
  622. * @param status receives the status.
  623. * @stable ICU 50
  624. */
  625. TimeZoneFormat(const Locale& locale, UErrorCode& status);
  626. private:
  627. /* Locale of this object */
  628. Locale fLocale;
  629. /* Stores the region (could be implicit default) */
  630. char fTargetRegion[ULOC_COUNTRY_CAPACITY];
  631. /* TimeZoneNames object used by this formatter */
  632. TimeZoneNames* fTimeZoneNames;
  633. /* TimeZoneGenericNames object used by this formatter - lazily instantiated */
  634. TimeZoneGenericNames* fTimeZoneGenericNames;
  635. /* Localized GMT format pattern - e.g. "GMT{0}" */
  636. UnicodeString fGMTPattern;
  637. /* Array of offset patterns used by Localized GMT format - e.g. "+HH:mm" */
  638. UnicodeString fGMTOffsetPatterns[UTZFMT_PAT_COUNT];
  639. /* Localized decimal digits used by Localized GMT format */
  640. UChar32 fGMTOffsetDigits[10];
  641. /* Localized GMT zero format - e.g. "GMT" */
  642. UnicodeString fGMTZeroFormat;
  643. /* Bit flags representing parse options */
  644. uint32_t fDefParseOptionFlags;
  645. /* Constant parts of GMT format pattern, populated from localized GMT format pattern*/
  646. UnicodeString fGMTPatternPrefix; /* Substring before {0} */
  647. UnicodeString fGMTPatternSuffix; /* Substring after {0} */
  648. /* Compiled offset patterns generated from fGMTOffsetPatterns[] */
  649. UVector* fGMTOffsetPatternItems[UTZFMT_PAT_COUNT];
  650. UBool fAbuttingOffsetHoursAndMinutes;
  651. /* TZDBTimeZoneNames object used for parsing */
  652. TZDBTimeZoneNames* fTZDBTimeZoneNames;
  653. /**
  654. * Returns the time zone's specific format string.
  655. * @param tz the time zone
  656. * @param stdType the name type used for standard time
  657. * @param dstType the name type used for daylight time
  658. * @param date the date
  659. * @param name receives the time zone's specific format name string
  660. * @param timeType when null, actual time type is set
  661. * @return a reference to name.
  662. */
  663. UnicodeString& formatSpecific(const TimeZone& tz, UTimeZoneNameType stdType, UTimeZoneNameType dstType,
  664. UDate date, UnicodeString& name, UTimeZoneFormatTimeType *timeType) const;
  665. /**
  666. * Returns the time zone's generic format string.
  667. * @param tz the time zone
  668. * @param genType the generic name type
  669. * @param date the date
  670. * @param name receives the time zone's generic format name string
  671. * @return a reference to name.
  672. */
  673. UnicodeString& formatGeneric(const TimeZone& tz, int32_t genType, UDate date, UnicodeString& name) const;
  674. /**
  675. * Lazily create a TimeZoneGenericNames instance
  676. * @param status receives the status
  677. * @return the cached TimeZoneGenericNames.
  678. */
  679. const TimeZoneGenericNames* getTimeZoneGenericNames(UErrorCode& status) const;
  680. /**
  681. * Lazily create a TZDBTimeZoneNames instance
  682. * @param status receives the status
  683. * @return the cached TZDBTimeZoneNames.
  684. */
  685. const TZDBTimeZoneNames* getTZDBTimeZoneNames(UErrorCode& status) const;
  686. /**
  687. * Private method returning the time zone's exemplar location string.
  688. * This method will never return empty.
  689. * @param tz the time zone
  690. * @param name receives the time zone's exemplar location name
  691. * @return a reference to name.
  692. */
  693. UnicodeString& formatExemplarLocation(const TimeZone& tz, UnicodeString& name) const;
  694. /**
  695. * Private enum specifying a combination of offset fields
  696. */
  697. enum OffsetFields {
  698. FIELDS_H,
  699. FIELDS_HM,
  700. FIELDS_HMS
  701. };
  702. /**
  703. * Parses the localized GMT pattern string and initialize
  704. * localized gmt pattern fields.
  705. * @param gmtPattern the localized GMT pattern string such as "GMT {0}"
  706. * @param status U_ILLEGAL_ARGUMENT_ERROR is set when the specified pattern does not
  707. * contain an argument "{0}".
  708. */
  709. void initGMTPattern(const UnicodeString& gmtPattern, UErrorCode& status);
  710. /**
  711. * Parse the GMT offset pattern into runtime optimized format.
  712. * @param pattern the offset pattern string
  713. * @param required the required set of fields, such as FIELDS_HM
  714. * @param status U_ILLEGAL_ARGUMENT is set when the specified pattern does not contain
  715. * pattern letters for the required fields.
  716. * @return A list of GMTOffsetField objects, or nullptr on error.
  717. */
  718. static UVector* parseOffsetPattern(const UnicodeString& pattern, OffsetFields required, UErrorCode& status);
  719. /**
  720. * Appends seconds field to the offset pattern with hour/minute
  721. * Note: This code will be obsoleted once we add hour-minute-second pattern data in CLDR.
  722. * @param offsetHM the offset pattern including hours and minutes fields
  723. * @param result the output offset pattern including hour, minute and seconds fields
  724. * @param status receives the status
  725. * @return a reference to result
  726. */
  727. static UnicodeString& expandOffsetPattern(const UnicodeString& offsetHM, UnicodeString& result, UErrorCode& status);
  728. /**
  729. * Truncates minutes field to the offset pattern with hour/minute
  730. * Note: This code will be obsoleted once we add hour pattern data in CLDR.
  731. * @param offsetHM the offset pattern including hours and minutes fields
  732. * @param result the output offset pattern including only hours field
  733. * @param status receives the status
  734. * @return a reference to result
  735. */
  736. static UnicodeString& truncateOffsetPattern(const UnicodeString& offsetHM, UnicodeString& result, UErrorCode& status);
  737. /**
  738. * Break input string into UChar32[]. Each array element represents
  739. * a code point. This method is used for parsing localized digit
  740. * characters and support characters in Unicode supplemental planes.
  741. * @param str the string
  742. * @param codeArray receives the result
  743. * @param capacity the capacity of codeArray
  744. * @return true when the specified code array is fully filled with code points
  745. * (no under/overflow).
  746. */
  747. static UBool toCodePoints(const UnicodeString& str, UChar32* codeArray, int32_t capacity);
  748. /**
  749. * Private method supprting all of ISO8601 formats
  750. * @param offset the offset from GMT(UTC) in milliseconds.
  751. * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when the offset is 0.
  752. * @param isShort true if shortest form is used.
  753. * @param ignoreSeconds true if non-zero offset seconds is appended.
  754. * @param result Receives the result
  755. * @param status Receives the status
  756. * @return the ISO 8601 basic format.
  757. */
  758. UnicodeString& formatOffsetISO8601(int32_t offset, UBool isBasic, UBool useUtcIndicator,
  759. UBool isShort, UBool ignoreSeconds, UnicodeString& result, UErrorCode& status) const;
  760. /**
  761. * Private method used for localized GMT formatting.
  762. * @param offset the zone's UTC offset
  763. * @param isShort true if the short localized GMT format is desired.
  764. * @param result receives the localized GMT format string
  765. * @param status receives the status
  766. */
  767. UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UBool isShort, UnicodeString& result, UErrorCode& status) const;
  768. /**
  769. * Returns offset from GMT(UTC) in milliseconds for the given ISO 8601 style
  770. * (extended format) time zone string. When the given string is not an ISO 8601 time
  771. * zone string, this method sets the current position as the error index
  772. * to <code>ParsePosition pos</code> and returns 0.
  773. * @param text the text contains ISO 8601 style time zone string (e.g. "-08:00", "Z")
  774. * at the position.
  775. * @param pos the position, non-negative error index will be set on failure.
  776. * @param extendedOnly true if parsing the text as ISO 8601 extended offset format (e.g. "-08:00"),
  777. * or false to evaluate the text as basic format.
  778. * @param hasDigitOffset receiving if the parsed zone string contains offset digits.
  779. * @return the offset from GMT(UTC) in milliseconds for the given ISO 8601 style
  780. * time zone string.
  781. */
  782. int32_t parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos, UBool extendedOnly,
  783. UBool* hasDigitOffset = nullptr) const;
  784. /**
  785. * Appends localized digits to the buffer.
  786. * This code assumes that the input number is 0 - 59
  787. * @param buf the target buffer
  788. * @param n the integer number
  789. * @param minDigits the minimum digits width
  790. */
  791. void appendOffsetDigits(UnicodeString& buf, int32_t n, uint8_t minDigits) const;
  792. /**
  793. * Returns offset from GMT(UTC) in milliseconds for the given localized GMT
  794. * offset format string. When the given string cannot be parsed, this method
  795. * sets the current position as the error index to <code>ParsePosition pos</code>
  796. * and returns 0.
  797. * @param text the text contains a localized GMT offset string at the position.
  798. * @param pos the position, non-negative error index will be set on failure.
  799. * @param isShort true if this parser to try the short format first
  800. * @param hasDigitOffset receiving if the parsed zone string contains offset digits.
  801. * @return the offset from GMT(UTC) in milliseconds for the given localized GMT
  802. * offset format string.
  803. */
  804. int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& pos,
  805. UBool isShort, UBool* hasDigitOffset) const;
  806. /**
  807. * Parse localized GMT format generated by the patter used by this formatter, except
  808. * GMT Zero format.
  809. * @param text the input text
  810. * @param start the start index
  811. * @param isShort true if the short localized format is parsed.
  812. * @param parsedLen receives the parsed length
  813. * @return the parsed offset in milliseconds
  814. */
  815. int32_t parseOffsetLocalizedGMTPattern(const UnicodeString& text, int32_t start,
  816. UBool isShort, int32_t& parsedLen) const;
  817. /**
  818. * Parses localized GMT offset fields into offset.
  819. * @param text the input text
  820. * @param start the start index
  821. * @param isShort true if this is a short format - currently not used
  822. * @param parsedLen the parsed length, or 0 on failure.
  823. * @return the parsed offset in milliseconds.
  824. */
  825. int32_t parseOffsetFields(const UnicodeString& text, int32_t start, UBool isShort, int32_t& parsedLen) const;
  826. /**
  827. * Parse localized GMT offset fields with the given pattern.
  828. * @param text the input text
  829. * @param start the start index
  830. * @param pattenItems the pattern (already itemized)
  831. * @param forceSingleHourDigit true if hours field is parsed as a single digit
  832. * @param hour receives the hour offset field
  833. * @param min receives the minute offset field
  834. * @param sec receives the second offset field
  835. * @return the parsed length
  836. */
  837. int32_t parseOffsetFieldsWithPattern(const UnicodeString& text, int32_t start,
  838. UVector* patternItems, UBool forceSingleHourDigit, int32_t& hour, int32_t& min, int32_t& sec) const;
  839. /**
  840. * Parses abutting localized GMT offset fields (such as 0800) into offset.
  841. * @param text the input text
  842. * @param start the start index
  843. * @param parsedLen the parsed length, or 0 on failure
  844. * @return the parsed offset in milliseconds.
  845. */
  846. int32_t parseAbuttingOffsetFields(const UnicodeString& text, int32_t start, int32_t& parsedLen) const;
  847. /**
  848. * Parses the input text using the default format patterns (e.g. "UTC{0}").
  849. * @param text the input text
  850. * @param start the start index
  851. * @param parsedLen the parsed length, or 0 on failure
  852. * @return the parsed offset in milliseconds.
  853. */
  854. int32_t parseOffsetDefaultLocalizedGMT(const UnicodeString& text, int start, int32_t& parsedLen) const;
  855. /**
  856. * Parses the input GMT offset fields with the default offset pattern.
  857. * @param text the input text
  858. * @param start the start index
  859. * @param separator the separator character, e.g. ':'
  860. * @param parsedLen the parsed length, or 0 on failure.
  861. * @return the parsed offset in milliseconds.
  862. */
  863. int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, char16_t separator,
  864. int32_t& parsedLen) const;
  865. /**
  866. * Reads an offset field value. This method will stop parsing when
  867. * 1) number of digits reaches <code>maxDigits</code>
  868. * 2) just before already parsed number exceeds <code>maxVal</code>
  869. *
  870. * @param text the text
  871. * @param start the start offset
  872. * @param minDigits the minimum number of required digits
  873. * @param maxDigits the maximum number of digits
  874. * @param minVal the minimum value
  875. * @param maxVal the maximum value
  876. * @param parsedLen the actual parsed length.
  877. * @return the integer value parsed
  878. */
  879. int32_t parseOffsetFieldWithLocalizedDigits(const UnicodeString& text, int32_t start,
  880. uint8_t minDigits, uint8_t maxDigits, uint16_t minVal, uint16_t maxVal, int32_t& parsedLen) const;
  881. /**
  882. * Reads a single decimal digit, either localized digits used by this object
  883. * or any Unicode numeric character.
  884. * @param text the text
  885. * @param start the start index
  886. * @param len the actual length read from the text
  887. * the start index is not a decimal number.
  888. * @return the integer value of the parsed digit, or -1 on failure.
  889. */
  890. int32_t parseSingleLocalizedDigit(const UnicodeString& text, int32_t start, int32_t& len) const;
  891. /**
  892. * Formats offset using ASCII digits. The input offset range must be
  893. * within +/-24 hours (exclusive).
  894. * @param offset The offset
  895. * @param sep The field separator character or 0 if not required
  896. * @param minFields The minimum fields
  897. * @param maxFields The maximum fields
  898. * @return The offset string
  899. */
  900. static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep,
  901. OffsetFields minFields, OffsetFields maxFields, UnicodeString& result);
  902. /**
  903. * Parses offset represented by contiguous ASCII digits.
  904. * <p>
  905. * Note: This method expects the input position is already at the start of
  906. * ASCII digits and does not parse sign (+/-).
  907. * @param text The text contains a sequence of ASCII digits
  908. * @param pos The parse position
  909. * @param minFields The minimum Fields to be parsed
  910. * @param maxFields The maximum Fields to be parsed
  911. * @param fixedHourWidth true if hours field must be width of 2
  912. * @return Parsed offset, 0 or positive number.
  913. */
  914. static int32_t parseAbuttingAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos,
  915. OffsetFields minFields, OffsetFields maxFields, UBool fixedHourWidth);
  916. /**
  917. * Parses offset represented by ASCII digits and separators.
  918. * <p>
  919. * Note: This method expects the input position is already at the start of
  920. * ASCII digits and does not parse sign (+/-).
  921. * @param text The text
  922. * @param pos The parse position
  923. * @param sep The separator character
  924. * @param minFields The minimum Fields to be parsed
  925. * @param maxFields The maximum Fields to be parsed
  926. * @return Parsed offset, 0 or positive number.
  927. */
  928. static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, char16_t sep,
  929. OffsetFields minFields, OffsetFields maxFields);
  930. /**
  931. * Unquotes the message format style pattern.
  932. * @param pattern the pattern
  933. * @param result receive the unquoted pattern.
  934. * @return A reference to result.
  935. */
  936. static UnicodeString& unquote(const UnicodeString& pattern, UnicodeString& result);
  937. /**
  938. * Initialize localized GMT format offset hour/min/sec patterns.
  939. * This method parses patterns into optimized run-time format.
  940. * @param status receives the status.
  941. */
  942. void initGMTOffsetPatterns(UErrorCode& status);
  943. /**
  944. * Check if there are any GMT format offset patterns without
  945. * any separators between hours field and minutes field and update
  946. * fAbuttingOffsetHoursAndMinutes field. This method must be called
  947. * after all patterns are parsed into pattern items.
  948. */
  949. void checkAbuttingHoursAndMinutes();
  950. /**
  951. * Creates an instance of TimeZone for the given offset
  952. * @param offset the offset
  953. * @return A TimeZone with the given offset
  954. */
  955. TimeZone* createTimeZoneForOffset(int32_t offset) const;
  956. /**
  957. * Returns the time type for the given name type
  958. * @param nameType the name type
  959. * @return the time type (unknown/standard/daylight)
  960. */
  961. static UTimeZoneFormatTimeType getTimeType(UTimeZoneNameType nameType);
  962. /**
  963. * Returns the time zone ID of a match at the specified index within
  964. * the MatchInfoCollection.
  965. * @param matches the collection of matches
  966. * @param idx the index within matches
  967. * @param tzID receives the resolved time zone ID
  968. * @return a reference to tzID.
  969. */
  970. UnicodeString& getTimeZoneID(const TimeZoneNames::MatchInfoCollection* matches, int32_t idx, UnicodeString& tzID) const;
  971. /**
  972. * Parse a zone ID.
  973. * @param text the text contains a time zone ID string at the position.
  974. * @param pos the position
  975. * @param tzID receives the zone ID
  976. * @return a reference to tzID
  977. */
  978. UnicodeString& parseZoneID(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const;
  979. /**
  980. * Parse a short zone ID.
  981. * @param text the text contains a short time zone ID string at the position.
  982. * @param pos the position
  983. * @param tzID receives the short zone ID
  984. * @return a reference to tzID
  985. */
  986. UnicodeString& parseShortZoneID(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const;
  987. /**
  988. * Parse an exemplar location string.
  989. * @param text the text contains an exemplar location string at the position.
  990. * @param pos the position.
  991. * @param tzID receives the time zone ID
  992. * @return a reference to tzID
  993. */
  994. UnicodeString& parseExemplarLocation(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const;
  995. };
  996. U_NAMESPACE_END
  997. #endif /* !UCONFIG_NO_FORMATTING */
  998. #endif /* U_SHOW_CPLUSPLUS_API */
  999. #endif