Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: source/i18n/unicode/dtptngen.h

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/i18n/unicode/dtitvinf.h ('k') | source/i18n/unicode/filteredbrk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * Copyright (C) 2007-2013, International Business Machines Corporation and 3 * Copyright (C) 2007-2015, International Business Machines Corporation and
4 * others. All Rights Reserved. 4 * others. All Rights Reserved.
5 ******************************************************************************* 5 *******************************************************************************
6 * 6 *
7 * File DTPTNGEN.H 7 * File DTPTNGEN.H
8 * 8 *
9 ******************************************************************************* 9 *******************************************************************************
10 */ 10 */
11 11
12 #ifndef __DTPTNGEN_H__ 12 #ifndef __DTPTNGEN_H__
13 #define __DTPTNGEN_H__ 13 #define __DTPTNGEN_H__
(...skipping 10 matching lines...) Expand all
24 * \brief C++ API: Date/Time Pattern Generator 24 * \brief C++ API: Date/Time Pattern Generator
25 */ 25 */
26 26
27 27
28 class Hashtable; 28 class Hashtable;
29 class FormatParser; 29 class FormatParser;
30 class DateTimeMatcher; 30 class DateTimeMatcher;
31 class DistanceInfo; 31 class DistanceInfo;
32 class PatternMap; 32 class PatternMap;
33 class PtnSkeleton; 33 class PtnSkeleton;
34 class SharedDateTimePatternGenerator;
34 35
35 /** 36 /**
36 * This class provides flexible generation of date format patterns, like "yy-MM- dd". 37 * This class provides flexible generation of date format patterns, like "yy-MM- dd".
37 * The user can build up the generator by adding successive patterns. Once that 38 * The user can build up the generator by adding successive patterns. Once that
38 * is done, a query can be made using a "skeleton", which is a pattern which jus t 39 * is done, a query can be made using a "skeleton", which is a pattern which jus t
39 * includes the desired fields and lengths. The generator will return the "best fit" 40 * includes the desired fields and lengths. The generator will return the "best fit"
40 * pattern corresponding to that skeleton. 41 * pattern corresponding to that skeleton.
41 * <p>The main method people will use is getBestPattern(String skeleton), 42 * <p>The main method people will use is getBestPattern(String skeleton),
42 * since normally this class is pre-built with data from a particular locale. 43 * since normally this class is pre-built with data from a particular locale.
43 * However, generators can be built directly from other data as well. 44 * However, generators can be built directly from other data as well.
(...skipping 14 matching lines...) Expand all
58 59
59 /** 60 /**
60 * Construct a flexible generator according to data for a given locale. 61 * Construct a flexible generator according to data for a given locale.
61 * @param uLocale 62 * @param uLocale
62 * @param status Output param set to success/failure code on exit, 63 * @param status Output param set to success/failure code on exit,
63 * which must not indicate a failure before the function call. 64 * which must not indicate a failure before the function call.
64 * @stable ICU 3.8 65 * @stable ICU 3.8
65 */ 66 */
66 static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLoc ale, UErrorCode& status); 67 static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLoc ale, UErrorCode& status);
67 68
69 #ifndef U_HIDE_INTERNAL_API
70
71 /**
72 * For ICU use only
73 *
74 * @internal
75 */
76 static DateTimePatternGenerator* U_EXPORT2 internalMakeInstance(const Locale & uLocale, UErrorCode& status);
77
78 #endif /* U_HIDE_INTERNAL_API */
79
68 /** 80 /**
69 * Create an empty generator, to be constructed with addPattern(...) etc. 81 * Create an empty generator, to be constructed with addPattern(...) etc.
70 * @param status Output param set to success/failure code on exit, 82 * @param status Output param set to success/failure code on exit,
71 * which must not indicate a failure before the function call. 83 * which must not indicate a failure before the function call.
72 * @stable ICU 3.8 84 * @stable ICU 3.8
73 */ 85 */
74 static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status); 86 static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
75 87
76 /** 88 /**
77 * Destructor. 89 * Destructor.
(...skipping 19 matching lines...) Expand all
97 109
98 /** 110 /**
99 * Return true if another object is semantically unequal to this one. 111 * Return true if another object is semantically unequal to this one.
100 * 112 *
101 * @param other the DateTimePatternGenerator object to be compared with. 113 * @param other the DateTimePatternGenerator object to be compared with.
102 * @return true if other is semantically unequal to this. 114 * @return true if other is semantically unequal to this.
103 * @stable ICU 3.8 115 * @stable ICU 3.8
104 */ 116 */
105 UBool operator!=(const DateTimePatternGenerator& other) const; 117 UBool operator!=(const DateTimePatternGenerator& other) const;
106 118
119 #ifndef U_HIDE_DRAFT_API
107 /** 120 /**
108 * Utility to return a unique skeleton from a given pattern. For example, 121 * Utility to return a unique skeleton from a given pattern. For example,
109 * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". 122 * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
110 * 123 *
111 * @param pattern Input pattern, such as "dd/MMM" 124 * @param pattern Input pattern, such as "dd/MMM"
112 * @param status Output param set to success/failure code on exit, 125 * @param status Output param set to success/failure code on exit,
113 * which must not indicate a failure before the function ca ll. 126 * which must not indicate a failure before the function ca ll.
114 * @return skeleton such as "MMMdd" 127 * @return skeleton such as "MMMdd"
128 * @draft ICU 56
129 */
130 static UnicodeString staticGetSkeleton(const UnicodeString& pattern, UErrorC ode& status);
131 #endif /* U_HIDE_DRAFT_API */
132
133 /**
134 * Utility to return a unique skeleton from a given pattern. For example,
135 * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
136 * getSkeleton() works exactly like staticGetSkeleton().
137 * Use staticGetSkeleton() instead of getSkeleton().
138 *
139 * @param pattern Input pattern, such as "dd/MMM"
140 * @param status Output param set to success/failure code on exit,
141 * which must not indicate a failure before the function ca ll.
142 * @return skeleton such as "MMMdd"
115 * @stable ICU 3.8 143 * @stable ICU 3.8
116 */ 144 */
117 UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status); 145 UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status) {
146 return staticGetSkeleton(pattern, status);
147 }
148
149 #ifndef U_HIDE_DRAFT_API
150 /**
151 * Utility to return a unique base skeleton from a given pattern. This is
152 * the same as the skeleton, except that differences in length are minimized
153 * so as to only preserve the difference between string and numeric form. So
154 * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
155 * (notice the single d).
156 *
157 * @param pattern Input pattern, such as "dd/MMM"
158 * @param status Output param set to success/failure code on exit,
159 * which must not indicate a failure before the function call.
160 * @return base skeleton, such as "MMMd"
161 * @draft ICU 56
162 */
163 static UnicodeString staticGetBaseSkeleton(const UnicodeString& pattern, UEr rorCode& status);
164 #endif /* U_HIDE_DRAFT_API */
118 165
119 /** 166 /**
120 * Utility to return a unique base skeleton from a given pattern. This is 167 * Utility to return a unique base skeleton from a given pattern. This is
121 * the same as the skeleton, except that differences in length are minimized 168 * the same as the skeleton, except that differences in length are minimized
122 * so as to only preserve the difference between string and numeric form. So 169 * so as to only preserve the difference between string and numeric form. So
123 * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd" 170 * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
124 * (notice the single d). 171 * (notice the single d).
172 * getBaseSkeleton() works exactly like staticGetBaseSkeleton().
173 * Use staticGetBaseSkeleton() instead of getBaseSkeleton().
125 * 174 *
126 * @param pattern Input pattern, such as "dd/MMM" 175 * @param pattern Input pattern, such as "dd/MMM"
127 * @param status Output param set to success/failure code on exit, 176 * @param status Output param set to success/failure code on exit,
128 * which must not indicate a failure before the function call. 177 * which must not indicate a failure before the function call.
129 * @return base skeleton, such as "Md" 178 * @return base skeleton, such as "MMMd"
130 * @stable ICU 3.8 179 * @stable ICU 3.8
131 */ 180 */
132 UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& stat us); 181 UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& stat us) {
182 return staticGetBaseSkeleton(pattern, status);
183 }
133 184
134 /** 185 /**
135 * Adds a pattern to the generator. If the pattern has the same skeleton as 186 * Adds a pattern to the generator. If the pattern has the same skeleton as
136 * an existing pattern, and the override parameter is set, then the previous 187 * an existing pattern, and the override parameter is set, then the previous
137 * value is overriden. Otherwise, the previous value is retained. In either 188 * value is overriden. Otherwise, the previous value is retained. In either
138 * case, the conflicting status is set and previous vale is stored in 189 * case, the conflicting status is set and previous vale is stored in
139 * conflicting pattern. 190 * conflicting pattern.
140 * <p> 191 * <p>
141 * Note that single-field patterns (like "MMM") are automatically added, and 192 * Note that single-field patterns (like "MMM") are automatically added, and
142 * don't need to be added explicitly! 193 * don't need to be added explicitly!
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 * Getter corresponding to setAppendItemNames. Values below 0 or at or above 259 * Getter corresponding to setAppendItemNames. Values below 0 or at or above
209 * UDATPG_FIELD_COUNT are illegal arguments. 260 * UDATPG_FIELD_COUNT are illegal arguments.
210 * 261 *
211 * @param field such as UDATPG_ERA_FIELD. 262 * @param field such as UDATPG_ERA_FIELD.
212 * @return name for field 263 * @return name for field
213 * @stable ICU 3.8 264 * @stable ICU 3.8
214 */ 265 */
215 const UnicodeString& getAppendItemName(UDateTimePatternField field) const; 266 const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
216 267
217 /** 268 /**
218 * The date time format is a message format pattern used to compose date and 269 * The DateTimeFormat is a message format pattern used to compose date and
219 * time patterns. The default value is "{0} {1}", where {0} will be replaced 270 * time patterns. The default pattern in the root locale is "{1} {0}", where
220 * by the date pattern and {1} will be replaced by the time pattern. 271 * {1} will be replaced by the date pattern and {0} will be replaced by the
272 * time pattern; however, other locales may specify patterns such as
273 * "{1}, {0}" or "{1} 'at' {0}", etc.
221 * <p> 274 * <p>
222 * This is used when the input skeleton contains both date and time fields, 275 * This is used when the input skeleton contains both date and time fields,
223 * but there is not a close match among the added patterns. For example, 276 * but there is not a close match among the added patterns. For example,
224 * suppose that this object was created by adding "dd-MMM" and "hh:mm", and 277 * suppose that this object was created by adding "dd-MMM" and "hh:mm", and
225 * its datetimeFormat is the default "{0} {1}". Then if the input skeleton 278 * its datetimeFormat is the default "{1} {0}". Then if the input skeleton
226 * is "MMMdhmm", there is not an exact match, so the input skeleton is 279 * is "MMMdhmm", there is not an exact match, so the input skeleton is
227 * broken up into two components "MMMd" and "hmm". There are close matches 280 * broken up into two components "MMMd" and "hmm". There are close matches
228 * for those two skeletons, so the result is put together with this pattern, 281 * for those two skeletons, so the result is put together with this pattern,
229 * resulting in "d-MMM h:mm". 282 * resulting in "d-MMM h:mm".
230 * 283 *
231 * @param dateTimeFormat 284 * @param dateTimeFormat
232 * message format pattern, here {0} will be replaced by the date 285 * message format pattern, here {1} will be replaced by the date
233 * pattern and {1} will be replaced by the time pattern. 286 * pattern and {0} will be replaced by the time pattern.
234 * @stable ICU 3.8 287 * @stable ICU 3.8
235 */ 288 */
236 void setDateTimeFormat(const UnicodeString& dateTimeFormat); 289 void setDateTimeFormat(const UnicodeString& dateTimeFormat);
237 290
238 /** 291 /**
239 * Getter corresponding to setDateTimeFormat. 292 * Getter corresponding to setDateTimeFormat.
240 * @return DateTimeFormat. 293 * @return DateTimeFormat.
241 * @stable ICU 3.8 294 * @stable ICU 3.8
242 */ 295 */
243 const UnicodeString& getDateTimeFormat() const; 296 const UnicodeString& getDateTimeFormat() const;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 int32_t getTopBitNumber(int32_t foundMask); 542 int32_t getTopBitNumber(int32_t foundMask);
490 void setAvailableFormat(const UnicodeString &key, UErrorCode& status); 543 void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
491 UBool isAvailableFormatSet(const UnicodeString &key) const; 544 UBool isAvailableFormatSet(const UnicodeString &key) const;
492 void copyHashtable(Hashtable *other, UErrorCode &status); 545 void copyHashtable(Hashtable *other, UErrorCode &status);
493 UBool isCanonicalItem(const UnicodeString& item) const; 546 UBool isCanonicalItem(const UnicodeString& item) const;
494 } ;// end class DateTimePatternGenerator 547 } ;// end class DateTimePatternGenerator
495 548
496 U_NAMESPACE_END 549 U_NAMESPACE_END
497 550
498 #endif 551 #endif
OLDNEW
« no previous file with comments | « source/i18n/unicode/dtitvinf.h ('k') | source/i18n/unicode/filteredbrk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698