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