1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*******************************************************************************
31b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert* Copyright (C) 2007-2015, International Business Machines Corporation and
4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* others. All Rights Reserved.
5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*******************************************************************************
6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* File DTPTNGEN.H
8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*******************************************************************************
10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/
11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef __DTPTNGEN_H__
13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define __DTPTNGEN_H__
14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/datefmt.h"
16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/locid.h"
17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/udat.h"
18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/udatpg.h"
19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_BEGIN
21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
22c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
23c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * \file
24c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * \brief C++ API: Date/Time Pattern Generator
25c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
26c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
27c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass Hashtable;
29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass FormatParser;
30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass DateTimeMatcher;
31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass DistanceInfo;
32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass PatternMap;
33b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruclass PtnSkeleton;
341b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubertclass SharedDateTimePatternGenerator;
35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This class provides flexible generation of date format patterns, like "yy-MM-dd".
38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The user can build up the generator by adding successive patterns. Once that
39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is done, a query can be made using a "skeleton", which is a pattern which just
40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * includes the desired fields and lengths. The generator will return the "best fit"
41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pattern corresponding to that skeleton.
42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>The main method people will use is getBestPattern(String skeleton),
43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * since normally this class is pre-built with data from a particular locale.
44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * However, generators can be built directly from other data as well.
45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p><i>Issue: may be useful to also have a function that returns the list of
46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * fields in a pattern, in order, since we have that internally.
47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * That would be useful for getting the UI order of field elements.</i>
48b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 3.8
49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru**/
50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass U_I18N_API DateTimePatternGenerator : public UObject {
51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querupublic:
52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Construct a flexible generator according to default locale.
54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
56b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    static DateTimePatternGenerator* U_EXPORT2 createInstance(UErrorCode& status);
59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Construct a flexible generator according to data for a given locale.
62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param uLocale
63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
65b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLocale, UErrorCode& status);
68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
691b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert#ifndef U_HIDE_INTERNAL_API
701b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert
711b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert    /**
721b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * For ICU use only
731b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     *
741b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * @internal
751b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     */
761b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert    static DateTimePatternGenerator* U_EXPORT2 internalMakeInstance(const Locale& uLocale, UErrorCode& status);
771b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert
781b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert#endif /* U_HIDE_INTERNAL_API */
791b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert
80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Create an empty generator, to be constructed with addPattern(...) etc.
82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
84b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Destructor.
90b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    virtual ~DateTimePatternGenerator();
93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Clone DateTimePatternGenerator object. Clients are responsible for
96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * deleting the DateTimePatternGenerator object cloned.
97b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DateTimePatternGenerator* clone() const;
100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /**
102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * Return true if another object is semantically equal to this one.
103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *
104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * @param other    the DateTimePatternGenerator object to be compared with.
105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * @return         true if other is semantically equal to this.
106b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru      * @stable ICU 3.8
107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      */
108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UBool operator==(const DateTimePatternGenerator& other) const;
109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Return true if another object is semantically unequal to this one.
112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param other    the DateTimePatternGenerator object to be compared with.
114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return         true if other is semantically unequal to this.
115b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UBool operator!=(const DateTimePatternGenerator& other) const;
118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Utility to return a unique skeleton from a given pattern. For example,
121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param pattern   Input pattern, such as "dd/MMM"
124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *                  which must not indicate a failure before the function call.
126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return skeleton such as "MMMdd"
127b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status);
130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Utility to return a unique base skeleton from a given pattern. This is
133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * the same as the skeleton, except that differences in length are minimized
134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * so as to only preserve the difference between string and numeric form. So
135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * (notice the single d).
137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param pattern  Input pattern, such as "dd/MMM"
139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return base skeleton, such as "Md"
142b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status);
145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Adds a pattern to the generator. If the pattern has the same skeleton as
148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * an existing pattern, and the override parameter is set, then the previous
149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * value is overriden. Otherwise, the previous value is retained. In either
150b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * case, the conflicting status is set and previous vale is stored in
151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * conflicting pattern.
152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * <p>
153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Note that single-field patterns (like "MMM") are automatically added, and
154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * don't need to be added explicitly!
155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param pattern   Input pattern, such as "dd/MMM"
157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param override  When existing values are to be overridden use true,
158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *                   otherwise use false.
159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param conflictingPattern  Previous pattern with the same skeleton.
160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return conflicting status.  The value could be UDATPG_NO_CONFLICT,
163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *                             UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
164b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
16559d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <p>
16659d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <h4>Sample code</h4>
16759d709d503bab6e2b61931737e662dd293b40578ccornelius	 * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
16859d709d503bab6e2b61931737e662dd293b40578ccornelius	 * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample
16959d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <p>
170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UDateTimePatternConflict addPattern(const UnicodeString& pattern,
172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                        UBool override,
173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                        UnicodeString& conflictingPattern,
174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                        UErrorCode& status);
175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * An AppendItem format is a pattern used to append a field if there is no
178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * good match. For example, suppose that the input skeleton is "GyyyyMMMd",
179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * and there is no matching pattern internally, but there is a pattern
180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the
181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * G. The way these two are conjoined is by using the AppendItemFormat for G
182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * (era). So if that value is, say "{0}, {1}" then the final resulting
183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * pattern is "d-MM-yyyy, G".
184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * <p>
185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * There are actually three available variables: {0} is the pattern so far,
186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * {1} is the element we are adding, and {2} is the name of the element.
187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * <p>
188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * This reflects the way that the CLDR data is organized.
189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param field  such as UDATPG_ERA_FIELD.
191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param value  pattern, such as "{0}, {1}"
192b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void setAppendItemFormat(UDateTimePatternField field, const UnicodeString& value);
195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Getter corresponding to setAppendItemFormat. Values below 0 or at or
198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * above UDATPG_FIELD_COUNT are illegal arguments.
199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param  field  such as UDATPG_ERA_FIELD.
201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return append pattern for field
202b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const UnicodeString& getAppendItemFormat(UDateTimePatternField field) const;
205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Sets the names of field, eg "era" in English for ERA. These are only
208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * used if the corresponding AppendItemFormat is used, and if it contains a
209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * {2} variable.
210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * <p>
211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * This reflects the way that the CLDR data is organized.
212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param field   such as UDATPG_ERA_FIELD.
214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param value   name of the field
215b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void setAppendItemName(UDateTimePatternField field, const UnicodeString& value);
218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Getter corresponding to setAppendItemNames. Values below 0 or at or above
221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * UDATPG_FIELD_COUNT are illegal arguments.
222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param field  such as UDATPG_ERA_FIELD.
224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return name for field
225b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
2301b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * The DateTimeFormat is a message format pattern used to compose date and
2311b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * time patterns. The default pattern in the root locale is "{1} {0}", where
2321b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * {1} will be replaced by the date pattern and {0} will be replaced by the
2331b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * time pattern; however, other locales may specify patterns such as
2341b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * "{1}, {0}" or "{1} 'at' {0}", etc.
235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * <p>
236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * This is used when the input skeleton contains both date and time fields,
237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * but there is not a close match among the added patterns. For example,
238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * suppose that this object was created by adding "dd-MMM" and "hh:mm", and
2391b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * its datetimeFormat is the default "{1} {0}". Then if the input skeleton
240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * is "MMMdhmm", there is not an exact match, so the input skeleton is
241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * broken up into two components "MMMd" and "hmm". There are close matches
242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * for those two skeletons, so the result is put together with this pattern,
243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * resulting in "d-MMM h:mm".
244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param dateTimeFormat
2461b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     *            message format pattern, here {1} will be replaced by the date
2471b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     *            pattern and {0} will be replaced by the time pattern.
248b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void setDateTimeFormat(const UnicodeString& dateTimeFormat);
251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Getter corresponding to setDateTimeFormat.
254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return DateTimeFormat.
255b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const UnicodeString& getDateTimeFormat() const;
258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Return the best pattern matching the input skeleton. It is guaranteed to
261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * have all of the fields in the skeleton.
262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param skeleton
264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *            The skeleton is a pattern containing only the variable fields.
265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *            For example, "MMMdd" and "mmhh" are skeletons.
266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return bestPattern
269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *            The best pattern found from the given skeleton.
270b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
27159d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <p>
27259d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <h4>Sample code</h4>
27359d709d503bab6e2b61931737e662dd293b40578ccornelius	 * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
27459d709d503bab6e2b61931737e662dd293b40578ccornelius	 * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample
27559d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <p>
276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
28150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Return the best pattern matching the input skeleton. It is guaranteed to
28250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * have all of the fields in the skeleton.
28350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
28450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param skeleton
28550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            The skeleton is a pattern containing only the variable fields.
28650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            For example, "MMMdd" and "mmhh" are skeletons.
28750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param options
28850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            Options for forcing the length of specified fields in the
28950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            returned pattern to match those in the skeleton (when this
29050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            would not happen otherwise). For default behavior, use
29150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            UDATPG_MATCH_NO_OPTIONS.
29250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status
29350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            Output param set to success/failure code on exit,
29450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            which must not indicate a failure before the function call.
29550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return bestPattern
29650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            The best pattern found from the given skeleton.
29727f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable ICU 4.4
29850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
29950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     UnicodeString getBestPattern(const UnicodeString& skeleton,
30050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UDateTimePatternMatchOptions options,
30150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status);
30250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
30350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
30450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Adjusts the field types (width and subtype) of a pattern to match what is
306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * "dd-MMMM hh:mm". This is used internally to get the best match for the
309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * input skeleton, but can also be used externally.
310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param pattern Input pattern
312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param skeleton
313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *            The skeleton is a pattern containing only the variable fields.
314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *            For example, "MMMdd" and "mmhh" are skeletons.
315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return pattern adjusted to match the skeleton fields widths and subtypes.
318b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
31959d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <p>
32059d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <h4>Sample code</h4>
32159d709d503bab6e2b61931737e662dd293b40578ccornelius	 * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
32259d709d503bab6e2b61931737e662dd293b40578ccornelius	 * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample
32359d709d503bab6e2b61931737e662dd293b40578ccornelius	 * <p>
324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UnicodeString replaceFieldTypes(const UnicodeString& pattern,
326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                     const UnicodeString& skeleton,
327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                     UErrorCode& status);
328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
33050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Adjusts the field types (width and subtype) of a pattern to match what is
33150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
33250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
33350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * "dd-MMMM hh:mm". This is used internally to get the best match for the
33450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * input skeleton, but can also be used externally.
33550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
33650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param pattern Input pattern
33750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param skeleton
33850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            The skeleton is a pattern containing only the variable fields.
33950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            For example, "MMMdd" and "mmhh" are skeletons.
34050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param options
34150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            Options controlling whether the length of specified fields in the
34250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            pattern are adjusted to match those in the skeleton (when this
34350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            would not happen otherwise). For default behavior, use
34450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            UDATPG_MATCH_NO_OPTIONS.
34550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status
34650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            Output param set to success/failure code on exit,
34750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *            which must not indicate a failure before the function call.
34850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return pattern adjusted to match the skeleton fields widths and subtypes.
34927f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable ICU 4.4
35050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
35150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     UnicodeString replaceFieldTypes(const UnicodeString& pattern,
35250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                     const UnicodeString& skeleton,
35350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                     UDateTimePatternMatchOptions options,
35450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                     UErrorCode& status);
35550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
35650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Return a list of all the skeletons (in canonical form) from this class.
358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Call getPatternForSkeleton() to get the corresponding pattern.
360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return StringEnumeration with the skeletons.
364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *         The caller must delete the object.
365b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     StringEnumeration* getSkeletons(UErrorCode& status) const;
368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /**
370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * Get the pattern corresponding to a given skeleton.
371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * @param skeleton
372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * @return pattern corresponding to a given skeleton.
373b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru      * @stable ICU 3.8
374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      */
375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const;
376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Return a list of all the base skeletons (in canonical form) from this class.
379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param status  Output param set to success/failure code on exit,
381b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *               which must not indicate a failure before the function call.
382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return a StringEnumeration with the base skeletons.
383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *         The caller must delete the object.
384b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     StringEnumeration* getBaseSkeletons(UErrorCode& status) const;
38783a171d1a62abf406f7f44ae671823d5ec20db7dCraig Cornelius
38883a171d1a62abf406f7f44ae671823d5ec20db7dCraig Cornelius#ifndef U_HIDE_INTERNAL_API
389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /**
390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * Return a list of redundant patterns are those which if removed, make no
391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * difference in the resulting getBestPattern values. This method returns a
392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * list of them, to help check the consistency of the patterns used to build
393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * this generator.
394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *
395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * @param status  Output param set to success/failure code on exit,
396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *               which must not indicate a failure before the function call.
397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * @return a StringEnumeration with the redundant pattern.
398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *         The caller must delete the object.
399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * @internal ICU 3.8
400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      */
401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     StringEnumeration* getRedundants(UErrorCode& status);
40283a171d1a62abf406f7f44ae671823d5ec20db7dCraig Cornelius#endif  /* U_HIDE_INTERNAL_API */
40383a171d1a62abf406f7f44ae671823d5ec20db7dCraig Cornelius
404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * The decimal value is used in formatting fractions of seconds. If the
406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * skeleton contains fractional seconds, then this is used with the
407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * fractional seconds. For example, suppose that the input pattern is
408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and
409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * the decimal string is ",". Then the resulting pattern is modified to be
410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * "H:mm:ss,SSSS"
411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param decimal
413b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void setDecimal(const UnicodeString& decimal);
416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Getter corresponding to setDecimal.
419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @return UnicodeString corresponding to the decimal point
420b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const UnicodeString& getDecimal() const;
423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * ICU "poor man's RTTI", returns a UClassID for the actual class.
426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
427b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    virtual UClassID getDynamicClassID() const;
430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * ICU "poor man's RTTI", returns a UClassID for this class.
433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     *
434b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruprivate:
439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Constructor.
441b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DateTimePatternGenerator(UErrorCode & status);
444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Constructor.
447b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Copy constructor.
453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param other DateTimePatternGenerator to copy
454b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DateTimePatternGenerator(const DateTimePatternGenerator& other);
457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * Default assignment operator.
460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     * @param other DateTimePatternGenerator to copy
461b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru     * @stable ICU 3.8
462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     */
463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    Locale pLocale;  // pattern locale
466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    FormatParser *fp;
467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DateTimeMatcher* dtMatcher;
468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DistanceInfo *distanceInfo;
469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    PatternMap *patternMap;
470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString appendItemNames[UDATPG_FIELD_COUNT];
472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString dateTimeFormat;
473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString decimal;
474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DateTimeMatcher *skipMatcher;
475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    Hashtable *fAvailableFormatKeyHash;
476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString hackPattern;
477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UnicodeString emptyString;
478b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UChar fDefaultHourFormatChar;
47959d709d503bab6e2b61931737e662dd293b40578ccornelius
48059d709d503bab6e2b61931737e662dd293b40578ccornelius    /* internal flags masks for adjustFieldTypes etc. */
48159d709d503bab6e2b61931737e662dd293b40578ccornelius    enum {
48259d709d503bab6e2b61931737e662dd293b40578ccornelius        kDTPGNoFlags = 0,
48359d709d503bab6e2b61931737e662dd293b40578ccornelius        kDTPGFixFractionalSeconds = 1,
48459d709d503bab6e2b61931737e662dd293b40578ccornelius        kDTPGSkeletonUsesCapJ = 2
48559d709d503bab6e2b61931737e662dd293b40578ccornelius    };
486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
487c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    void initData(const Locale &locale, UErrorCode &status);
488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void addCanonicalItems();
489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void addICUPatterns(const Locale& locale, UErrorCode& status);
490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
4916d5deb12725f146643d443090dfa11b206df528aJean-Baptiste Queru    void addCLDRData(const Locale& locale, UErrorCode& status);
492b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status);
493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void initHashtable(UErrorCode& status);
494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void setDecimalSymbols(const Locale& locale, UErrorCode& status);
496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UDateTimePatternField getAppendFormatNumber(const char* field) const;
497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UDateTimePatternField getAppendNameNumber(const char* field) const;
498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void getAppendName(UDateTimePatternField field, UnicodeString& value);
499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    int32_t getCanonicalIndex(const UnicodeString& field);
500b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
50159d709d503bab6e2b61931737e662dd293b40578ccornelius    UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
50259d709d503bab6e2b61931737e662dd293b40578ccornelius    UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    int32_t getTopBitNumber(int32_t foundMask);
504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UBool isAvailableFormatSet(const UnicodeString &key) const;
506c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    void copyHashtable(Hashtable *other, UErrorCode &status);
507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UBool isCanonicalItem(const UnicodeString& item) const;
508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} ;// end class DateTimePatternGenerator
509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_END
511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif
513