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