dtptngen.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. // Copyright (C) 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2007-2016, International Business Machines Corporation and
  6. * others. All Rights Reserved.
  7. *******************************************************************************
  8. *
  9. * File DTPTNGEN.H
  10. *
  11. *******************************************************************************
  12. */
  13. #ifndef __DTPTNGEN_H__
  14. #define __DTPTNGEN_H__
  15. #include "unicode/datefmt.h"
  16. #include "unicode/locid.h"
  17. #include "unicode/udat.h"
  18. #include "unicode/udatpg.h"
  19. U_NAMESPACE_BEGIN
  20. /**
  21. * \file
  22. * \brief C++ API: Date/Time Pattern Generator
  23. */
  24. class Hashtable;
  25. class FormatParser;
  26. class DateTimeMatcher;
  27. class DistanceInfo;
  28. class PatternMap;
  29. class PtnSkeleton;
  30. class SharedDateTimePatternGenerator;
  31. /**
  32. * This class provides flexible generation of date format patterns, like "yy-MM-dd".
  33. * The user can build up the generator by adding successive patterns. Once that
  34. * is done, a query can be made using a "skeleton", which is a pattern which just
  35. * includes the desired fields and lengths. The generator will return the "best fit"
  36. * pattern corresponding to that skeleton.
  37. * <p>The main method people will use is getBestPattern(String skeleton),
  38. * since normally this class is pre-built with data from a particular locale.
  39. * However, generators can be built directly from other data as well.
  40. * <p><i>Issue: may be useful to also have a function that returns the list of
  41. * fields in a pattern, in order, since we have that internally.
  42. * That would be useful for getting the UI order of field elements.</i>
  43. * @stable ICU 3.8
  44. **/
  45. class U_I18N_API DateTimePatternGenerator : public UObject {
  46. public:
  47. /**
  48. * Construct a flexible generator according to default locale.
  49. * @param status Output param set to success/failure code on exit,
  50. * which must not indicate a failure before the function call.
  51. * @stable ICU 3.8
  52. */
  53. static DateTimePatternGenerator* U_EXPORT2 createInstance(UErrorCode& status);
  54. /**
  55. * Construct a flexible generator according to data for a given locale.
  56. * @param uLocale
  57. * @param status Output param set to success/failure code on exit,
  58. * which must not indicate a failure before the function call.
  59. * @stable ICU 3.8
  60. */
  61. static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLocale, UErrorCode& status);
  62. #ifndef U_HIDE_INTERNAL_API
  63. /**
  64. * For ICU use only
  65. *
  66. * @internal
  67. */
  68. static DateTimePatternGenerator* U_EXPORT2 internalMakeInstance(const Locale& uLocale, UErrorCode& status);
  69. #endif /* U_HIDE_INTERNAL_API */
  70. /**
  71. * Create an empty generator, to be constructed with addPattern(...) etc.
  72. * @param status Output param set to success/failure code on exit,
  73. * which must not indicate a failure before the function call.
  74. * @stable ICU 3.8
  75. */
  76. static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
  77. /**
  78. * Destructor.
  79. * @stable ICU 3.8
  80. */
  81. virtual ~DateTimePatternGenerator();
  82. /**
  83. * Clone DateTimePatternGenerator object. Clients are responsible for
  84. * deleting the DateTimePatternGenerator object cloned.
  85. * @stable ICU 3.8
  86. */
  87. DateTimePatternGenerator* clone() const;
  88. /**
  89. * Return true if another object is semantically equal to this one.
  90. *
  91. * @param other the DateTimePatternGenerator object to be compared with.
  92. * @return true if other is semantically equal to this.
  93. * @stable ICU 3.8
  94. */
  95. UBool operator==(const DateTimePatternGenerator& other) const;
  96. /**
  97. * Return true if another object is semantically unequal to this one.
  98. *
  99. * @param other the DateTimePatternGenerator object to be compared with.
  100. * @return true if other is semantically unequal to this.
  101. * @stable ICU 3.8
  102. */
  103. UBool operator!=(const DateTimePatternGenerator& other) const;
  104. /**
  105. * Utility to return a unique skeleton from a given pattern. For example,
  106. * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
  107. *
  108. * @param pattern Input pattern, such as "dd/MMM"
  109. * @param status Output param set to success/failure code on exit,
  110. * which must not indicate a failure before the function call.
  111. * @return skeleton such as "MMMdd"
  112. * @stable ICU 56
  113. */
  114. static UnicodeString staticGetSkeleton(const UnicodeString& pattern, UErrorCode& status);
  115. /**
  116. * Utility to return a unique skeleton from a given pattern. For example,
  117. * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
  118. * getSkeleton() works exactly like staticGetSkeleton().
  119. * Use staticGetSkeleton() instead of getSkeleton().
  120. *
  121. * @param pattern Input pattern, such as "dd/MMM"
  122. * @param status Output param set to success/failure code on exit,
  123. * which must not indicate a failure before the function call.
  124. * @return skeleton such as "MMMdd"
  125. * @stable ICU 3.8
  126. */
  127. UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status); /* {
  128. The function is commented out because it is a stable API calling a draft API.
  129. After staticGetSkeleton becomes stable, staticGetSkeleton can be used and
  130. these comments and the definition of getSkeleton in dtptngen.cpp should be removed.
  131. return staticGetSkeleton(pattern, status);
  132. }*/
  133. /**
  134. * Utility to return a unique base skeleton from a given pattern. This is
  135. * the same as the skeleton, except that differences in length are minimized
  136. * so as to only preserve the difference between string and numeric form. So
  137. * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
  138. * (notice the single d).
  139. *
  140. * @param pattern Input pattern, such as "dd/MMM"
  141. * @param status Output param set to success/failure code on exit,
  142. * which must not indicate a failure before the function call.
  143. * @return base skeleton, such as "MMMd"
  144. * @stable ICU 56
  145. */
  146. static UnicodeString staticGetBaseSkeleton(const UnicodeString& pattern, UErrorCode& status);
  147. /**
  148. * Utility to return a unique base skeleton from a given pattern. This is
  149. * the same as the skeleton, except that differences in length are minimized
  150. * so as to only preserve the difference between string and numeric form. So
  151. * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
  152. * (notice the single d).
  153. * getBaseSkeleton() works exactly like staticGetBaseSkeleton().
  154. * Use staticGetBaseSkeleton() instead of getBaseSkeleton().
  155. *
  156. * @param pattern Input pattern, such as "dd/MMM"
  157. * @param status Output param set to success/failure code on exit,
  158. * which must not indicate a failure before the function call.
  159. * @return base skeleton, such as "MMMd"
  160. * @stable ICU 3.8
  161. */
  162. UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); /* {
  163. The function is commented out because it is a stable API calling a draft API.
  164. After staticGetBaseSkeleton becomes stable, staticGetBaseSkeleton can be used and
  165. these comments and the definition of getBaseSkeleton in dtptngen.cpp should be removed.
  166. return staticGetBaseSkeleton(pattern, status);
  167. }*/
  168. /**
  169. * Adds a pattern to the generator. If the pattern has the same skeleton as
  170. * an existing pattern, and the override parameter is set, then the previous
  171. * value is overriden. Otherwise, the previous value is retained. In either
  172. * case, the conflicting status is set and previous vale is stored in
  173. * conflicting pattern.
  174. * <p>
  175. * Note that single-field patterns (like "MMM") are automatically added, and
  176. * don't need to be added explicitly!
  177. *
  178. * @param pattern Input pattern, such as "dd/MMM"
  179. * @param override When existing values are to be overridden use true,
  180. * otherwise use false.
  181. * @param conflictingPattern Previous pattern with the same skeleton.
  182. * @param status Output param set to success/failure code on exit,
  183. * which must not indicate a failure before the function call.
  184. * @return conflicting status. The value could be UDATPG_NO_CONFLICT,
  185. * UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
  186. * @stable ICU 3.8
  187. * <p>
  188. * <h4>Sample code</h4>
  189. * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
  190. * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample
  191. * <p>
  192. */
  193. UDateTimePatternConflict addPattern(const UnicodeString& pattern,
  194. UBool override,
  195. UnicodeString& conflictingPattern,
  196. UErrorCode& status);
  197. /**
  198. * An AppendItem format is a pattern used to append a field if there is no
  199. * good match. For example, suppose that the input skeleton is "GyyyyMMMd",
  200. * and there is no matching pattern internally, but there is a pattern
  201. * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the
  202. * G. The way these two are conjoined is by using the AppendItemFormat for G
  203. * (era). So if that value is, say "{0}, {1}" then the final resulting
  204. * pattern is "d-MM-yyyy, G".
  205. * <p>
  206. * There are actually three available variables: {0} is the pattern so far,
  207. * {1} is the element we are adding, and {2} is the name of the element.
  208. * <p>
  209. * This reflects the way that the CLDR data is organized.
  210. *
  211. * @param field such as UDATPG_ERA_FIELD.
  212. * @param value pattern, such as "{0}, {1}"
  213. * @stable ICU 3.8
  214. */
  215. void setAppendItemFormat(UDateTimePatternField field, const UnicodeString& value);
  216. /**
  217. * Getter corresponding to setAppendItemFormat. Values below 0 or at or
  218. * above UDATPG_FIELD_COUNT are illegal arguments.
  219. *
  220. * @param field such as UDATPG_ERA_FIELD.
  221. * @return append pattern for field
  222. * @stable ICU 3.8
  223. */
  224. const UnicodeString& getAppendItemFormat(UDateTimePatternField field) const;
  225. /**
  226. * Sets the names of field, eg "era" in English for ERA. These are only
  227. * used if the corresponding AppendItemFormat is used, and if it contains a
  228. * {2} variable.
  229. * <p>
  230. * This reflects the way that the CLDR data is organized.
  231. *
  232. * @param field such as UDATPG_ERA_FIELD.
  233. * @param value name of the field
  234. * @stable ICU 3.8
  235. */
  236. void setAppendItemName(UDateTimePatternField field, const UnicodeString& value);
  237. /**
  238. * Getter corresponding to setAppendItemNames. Values below 0 or at or above
  239. * UDATPG_FIELD_COUNT are illegal arguments.
  240. *
  241. * @param field such as UDATPG_ERA_FIELD.
  242. * @return name for field
  243. * @stable ICU 3.8
  244. */
  245. const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
  246. /**
  247. * The DateTimeFormat is a message format pattern used to compose date and
  248. * time patterns. The default pattern in the root locale is "{1} {0}", where
  249. * {1} will be replaced by the date pattern and {0} will be replaced by the
  250. * time pattern; however, other locales may specify patterns such as
  251. * "{1}, {0}" or "{1} 'at' {0}", etc.
  252. * <p>
  253. * This is used when the input skeleton contains both date and time fields,
  254. * but there is not a close match among the added patterns. For example,
  255. * suppose that this object was created by adding "dd-MMM" and "hh:mm", and
  256. * its datetimeFormat is the default "{1} {0}". Then if the input skeleton
  257. * is "MMMdhmm", there is not an exact match, so the input skeleton is
  258. * broken up into two components "MMMd" and "hmm". There are close matches
  259. * for those two skeletons, so the result is put together with this pattern,
  260. * resulting in "d-MMM h:mm".
  261. *
  262. * @param dateTimeFormat
  263. * message format pattern, here {1} will be replaced by the date
  264. * pattern and {0} will be replaced by the time pattern.
  265. * @stable ICU 3.8
  266. */
  267. void setDateTimeFormat(const UnicodeString& dateTimeFormat);
  268. /**
  269. * Getter corresponding to setDateTimeFormat.
  270. * @return DateTimeFormat.
  271. * @stable ICU 3.8
  272. */
  273. const UnicodeString& getDateTimeFormat() const;
  274. /**
  275. * Return the best pattern matching the input skeleton. It is guaranteed to
  276. * have all of the fields in the skeleton.
  277. *
  278. * @param skeleton
  279. * The skeleton is a pattern containing only the variable fields.
  280. * For example, "MMMdd" and "mmhh" are skeletons.
  281. * @param status Output param set to success/failure code on exit,
  282. * which must not indicate a failure before the function call.
  283. * @return bestPattern
  284. * The best pattern found from the given skeleton.
  285. * @stable ICU 3.8
  286. * <p>
  287. * <h4>Sample code</h4>
  288. * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
  289. * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample
  290. * <p>
  291. */
  292. UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
  293. /**
  294. * Return the best pattern matching the input skeleton. It is guaranteed to
  295. * have all of the fields in the skeleton.
  296. *
  297. * @param skeleton
  298. * The skeleton is a pattern containing only the variable fields.
  299. * For example, "MMMdd" and "mmhh" are skeletons.
  300. * @param options
  301. * Options for forcing the length of specified fields in the
  302. * returned pattern to match those in the skeleton (when this
  303. * would not happen otherwise). For default behavior, use
  304. * UDATPG_MATCH_NO_OPTIONS.
  305. * @param status
  306. * Output param set to success/failure code on exit,
  307. * which must not indicate a failure before the function call.
  308. * @return bestPattern
  309. * The best pattern found from the given skeleton.
  310. * @stable ICU 4.4
  311. */
  312. UnicodeString getBestPattern(const UnicodeString& skeleton,
  313. UDateTimePatternMatchOptions options,
  314. UErrorCode& status);
  315. /**
  316. * Adjusts the field types (width and subtype) of a pattern to match what is
  317. * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
  318. * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
  319. * "dd-MMMM hh:mm". This is used internally to get the best match for the
  320. * input skeleton, but can also be used externally.
  321. *
  322. * @param pattern Input pattern
  323. * @param skeleton
  324. * The skeleton is a pattern containing only the variable fields.
  325. * For example, "MMMdd" and "mmhh" are skeletons.
  326. * @param status Output param set to success/failure code on exit,
  327. * which must not indicate a failure before the function call.
  328. * @return pattern adjusted to match the skeleton fields widths and subtypes.
  329. * @stable ICU 3.8
  330. * <p>
  331. * <h4>Sample code</h4>
  332. * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
  333. * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample
  334. * <p>
  335. */
  336. UnicodeString replaceFieldTypes(const UnicodeString& pattern,
  337. const UnicodeString& skeleton,
  338. UErrorCode& status);
  339. /**
  340. * Adjusts the field types (width and subtype) of a pattern to match what is
  341. * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
  342. * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
  343. * "dd-MMMM hh:mm". This is used internally to get the best match for the
  344. * input skeleton, but can also be used externally.
  345. *
  346. * @param pattern Input pattern
  347. * @param skeleton
  348. * The skeleton is a pattern containing only the variable fields.
  349. * For example, "MMMdd" and "mmhh" are skeletons.
  350. * @param options
  351. * Options controlling whether the length of specified fields in the
  352. * pattern are adjusted to match those in the skeleton (when this
  353. * would not happen otherwise). For default behavior, use
  354. * UDATPG_MATCH_NO_OPTIONS.
  355. * @param status
  356. * Output param set to success/failure code on exit,
  357. * which must not indicate a failure before the function call.
  358. * @return pattern adjusted to match the skeleton fields widths and subtypes.
  359. * @stable ICU 4.4
  360. */
  361. UnicodeString replaceFieldTypes(const UnicodeString& pattern,
  362. const UnicodeString& skeleton,
  363. UDateTimePatternMatchOptions options,
  364. UErrorCode& status);
  365. /**
  366. * Return a list of all the skeletons (in canonical form) from this class.
  367. *
  368. * Call getPatternForSkeleton() to get the corresponding pattern.
  369. *
  370. * @param status Output param set to success/failure code on exit,
  371. * which must not indicate a failure before the function call.
  372. * @return StringEnumeration with the skeletons.
  373. * The caller must delete the object.
  374. * @stable ICU 3.8
  375. */
  376. StringEnumeration* getSkeletons(UErrorCode& status) const;
  377. /**
  378. * Get the pattern corresponding to a given skeleton.
  379. * @param skeleton
  380. * @return pattern corresponding to a given skeleton.
  381. * @stable ICU 3.8
  382. */
  383. const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const;
  384. /**
  385. * Return a list of all the base skeletons (in canonical form) from this class.
  386. *
  387. * @param status Output param set to success/failure code on exit,
  388. * which must not indicate a failure before the function call.
  389. * @return a StringEnumeration with the base skeletons.
  390. * The caller must delete the object.
  391. * @stable ICU 3.8
  392. */
  393. StringEnumeration* getBaseSkeletons(UErrorCode& status) const;
  394. #ifndef U_HIDE_INTERNAL_API
  395. /**
  396. * Return a list of redundant patterns are those which if removed, make no
  397. * difference in the resulting getBestPattern values. This method returns a
  398. * list of them, to help check the consistency of the patterns used to build
  399. * this generator.
  400. *
  401. * @param status Output param set to success/failure code on exit,
  402. * which must not indicate a failure before the function call.
  403. * @return a StringEnumeration with the redundant pattern.
  404. * The caller must delete the object.
  405. * @internal ICU 3.8
  406. */
  407. StringEnumeration* getRedundants(UErrorCode& status);
  408. #endif /* U_HIDE_INTERNAL_API */
  409. /**
  410. * The decimal value is used in formatting fractions of seconds. If the
  411. * skeleton contains fractional seconds, then this is used with the
  412. * fractional seconds. For example, suppose that the input pattern is
  413. * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and
  414. * the decimal string is ",". Then the resulting pattern is modified to be
  415. * "H:mm:ss,SSSS"
  416. *
  417. * @param decimal
  418. * @stable ICU 3.8
  419. */
  420. void setDecimal(const UnicodeString& decimal);
  421. /**
  422. * Getter corresponding to setDecimal.
  423. * @return UnicodeString corresponding to the decimal point
  424. * @stable ICU 3.8
  425. */
  426. const UnicodeString& getDecimal() const;
  427. /**
  428. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  429. *
  430. * @stable ICU 3.8
  431. */
  432. virtual UClassID getDynamicClassID() const;
  433. /**
  434. * ICU "poor man's RTTI", returns a UClassID for this class.
  435. *
  436. * @stable ICU 3.8
  437. */
  438. static UClassID U_EXPORT2 getStaticClassID(void);
  439. private:
  440. /**
  441. * Constructor.
  442. * @stable ICU 3.8
  443. */
  444. DateTimePatternGenerator(UErrorCode & status);
  445. /**
  446. * Constructor.
  447. * @stable ICU 3.8
  448. */
  449. DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
  450. /**
  451. * Copy constructor.
  452. * @param other DateTimePatternGenerator to copy
  453. * @stable ICU 3.8
  454. */
  455. DateTimePatternGenerator(const DateTimePatternGenerator& other);
  456. /**
  457. * Default assignment operator.
  458. * @param other DateTimePatternGenerator to copy
  459. * @stable ICU 3.8
  460. */
  461. DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
  462. Locale pLocale; // pattern locale
  463. FormatParser *fp;
  464. DateTimeMatcher* dtMatcher;
  465. DistanceInfo *distanceInfo;
  466. PatternMap *patternMap;
  467. UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
  468. UnicodeString appendItemNames[UDATPG_FIELD_COUNT];
  469. UnicodeString dateTimeFormat;
  470. UnicodeString decimal;
  471. DateTimeMatcher *skipMatcher;
  472. Hashtable *fAvailableFormatKeyHash;
  473. UnicodeString emptyString;
  474. UChar fDefaultHourFormatChar;
  475. int32_t fAllowedHourFormats[7]; // Actually an array of AllowedHourFormat enum type, ending with UNKNOWN.
  476. /* internal flags masks for adjustFieldTypes etc. */
  477. enum {
  478. kDTPGNoFlags = 0,
  479. kDTPGFixFractionalSeconds = 1,
  480. kDTPGSkeletonUsesCapJ = 2,
  481. kDTPGSkeletonUsesLowB = 3,
  482. kDTPGSkeletonUsesCapB = 4
  483. };
  484. void initData(const Locale &locale, UErrorCode &status);
  485. void addCanonicalItems(UErrorCode &status);
  486. void addICUPatterns(const Locale& locale, UErrorCode& status);
  487. void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
  488. void getCalendarTypeToUse(const Locale& locale, CharString& destination, UErrorCode& err);
  489. void consumeShortTimePattern(const UnicodeString& shortTimePattern, UErrorCode& status);
  490. void addCLDRData(const Locale& locale, UErrorCode& status);
  491. UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status);
  492. void initHashtable(UErrorCode& status);
  493. void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
  494. void setDecimalSymbols(const Locale& locale, UErrorCode& status);
  495. UDateTimePatternField getAppendFormatNumber(const char* field) const;
  496. UDateTimePatternField getAppendNameNumber(const char* field) const;
  497. UnicodeString& getMutableAppendItemName(UDateTimePatternField field);
  498. void getAppendName(UDateTimePatternField field, UnicodeString& value);
  499. int32_t getCanonicalIndex(const UnicodeString& field);
  500. const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
  501. UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
  502. UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
  503. int32_t getTopBitNumber(int32_t foundMask);
  504. void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
  505. UBool isAvailableFormatSet(const UnicodeString &key) const;
  506. void copyHashtable(Hashtable *other, UErrorCode &status);
  507. UBool isCanonicalItem(const UnicodeString& item) const;
  508. static void U_CALLCONV loadAllowedHourFormatsData(UErrorCode &status);
  509. void getAllowedHourFormats(const Locale &locale, UErrorCode &status);
  510. struct AppendItemFormatsSink;
  511. struct AppendItemNamesSink;
  512. struct AvailableFormatsSink;
  513. } ;// end class DateTimePatternGenerator
  514. U_NAMESPACE_END
  515. #endif