OLD | NEW |
1 /* | 1 /* |
2 ***************************************************************************** | 2 ***************************************************************************** |
3 * Copyright (C) 2014, International Business Machines Corporation and | 3 * Copyright (C) 2014-2015, International Business Machines Corporation and |
4 * others. | 4 * others. |
5 * All Rights Reserved. | 5 * All Rights Reserved. |
6 ***************************************************************************** | 6 ***************************************************************************** |
7 * | 7 * |
8 * File RELDATEFMT.H | 8 * File RELDATEFMT.H |
9 ***************************************************************************** | 9 ***************************************************************************** |
10 */ | 10 */ |
11 | 11 |
12 #ifndef __RELDATEFMT_H | 12 #ifndef __RELDATEFMT_H |
13 #define __RELDATEFMT_H | 13 #define __RELDATEFMT_H |
14 | 14 |
15 #include "unicode/utypes.h" | 15 #include "unicode/utypes.h" |
16 #include "unicode/uobject.h" | 16 #include "unicode/uobject.h" |
17 #include "unicode/udisplaycontext.h" | 17 #include "unicode/udisplaycontext.h" |
18 #include "unicode/locid.h" | 18 #include "unicode/locid.h" |
19 | 19 |
20 /** | 20 /** |
21 * \file | 21 * \file |
22 * \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow" | 22 * \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow" |
23 */ | 23 */ |
24 | 24 |
25 #if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION | 25 #if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION |
26 | 26 |
27 #ifndef U_HIDE_DRAFT_API | |
28 | |
29 /** | 27 /** |
30 * The formatting style | 28 * The formatting style |
31 * @draft ICU 54 | 29 * @stable ICU 54 |
32 */ | 30 */ |
33 typedef enum UDateRelativeDateTimeFormatterStyle { | 31 typedef enum UDateRelativeDateTimeFormatterStyle { |
34 | |
35 /** | 32 /** |
36 * Everything spelled out. | 33 * Everything spelled out. |
37 * @draft ICU 54 | 34 * @stable ICU 54 |
38 */ | 35 */ |
39 UDAT_STYLE_LONG, | 36 UDAT_STYLE_LONG, |
40 | 37 |
41 /** | 38 /** |
42 * Abbreviations used when possible. | 39 * Abbreviations used when possible. |
43 * @draft ICU 54 | 40 * @stable ICU 54 |
44 */ | 41 */ |
45 UDAT_STYLE_SHORT, | 42 UDAT_STYLE_SHORT, |
46 | 43 |
47 /** | 44 /** |
48 * Use the shortest possible form. | 45 * Use the shortest possible form. |
49 * @draft ICU 54 | 46 * @stable ICU 54 |
50 */ | 47 */ |
51 UDAT_STYLE_NARROW, | 48 UDAT_STYLE_NARROW, |
52 | 49 |
53 /** | 50 /** |
54 * The number of styles. | 51 * The number of styles. |
55 * @draft ICU 54 | 52 * @stable ICU 54 |
56 */ | 53 */ |
57 UDAT_STYLE_COUNT | 54 UDAT_STYLE_COUNT |
58 } UDateRelativeDateTimeFormatterStyle; | 55 } UDateRelativeDateTimeFormatterStyle; |
59 | 56 |
60 /** | 57 /** |
61 * Represents the unit for formatting a relative date. e.g "in 5 days" | 58 * Represents the unit for formatting a relative date. e.g "in 5 days" |
62 * or "in 3 months" | 59 * or "in 3 months" |
63 * @draft ICU 53 | 60 * @stable ICU 53 |
64 */ | 61 */ |
65 typedef enum UDateRelativeUnit { | 62 typedef enum UDateRelativeUnit { |
66 | 63 |
67 /** | 64 /** |
68 * Seconds | 65 * Seconds |
69 * @draft ICU 53 | 66 * @stable ICU 53 |
70 */ | 67 */ |
71 UDAT_RELATIVE_SECONDS, | 68 UDAT_RELATIVE_SECONDS, |
72 | 69 |
73 /** | 70 /** |
74 * Minutes | 71 * Minutes |
75 * @draft ICU 53 | 72 * @stable ICU 53 |
76 */ | 73 */ |
77 UDAT_RELATIVE_MINUTES, | 74 UDAT_RELATIVE_MINUTES, |
78 | 75 |
79 /** | 76 /** |
80 * Hours | 77 * Hours |
81 * @draft ICU 53 | 78 * @stable ICU 53 |
82 */ | 79 */ |
83 UDAT_RELATIVE_HOURS, | 80 UDAT_RELATIVE_HOURS, |
84 | 81 |
85 /** | 82 /** |
86 * Days | 83 * Days |
87 * @draft ICU 53 | 84 * @stable ICU 53 |
88 */ | 85 */ |
89 UDAT_RELATIVE_DAYS, | 86 UDAT_RELATIVE_DAYS, |
90 | 87 |
91 /** | 88 /** |
92 * Weeks | 89 * Weeks |
93 * @draft ICU 53 | 90 * @stable ICU 53 |
94 */ | 91 */ |
95 UDAT_RELATIVE_WEEKS, | 92 UDAT_RELATIVE_WEEKS, |
96 | 93 |
97 /** | 94 /** |
98 * Months | 95 * Months |
99 * @draft ICU 53 | 96 * @stable ICU 53 |
100 */ | 97 */ |
101 UDAT_RELATIVE_MONTHS, | 98 UDAT_RELATIVE_MONTHS, |
102 | 99 |
103 /** | 100 /** |
104 * Years | 101 * Years |
105 * @draft ICU 53 | 102 * @stable ICU 53 |
106 */ | 103 */ |
107 UDAT_RELATIVE_YEARS, | 104 UDAT_RELATIVE_YEARS, |
108 | 105 |
109 /** | 106 /** |
110 * Count of items in this enum. | 107 * Count of items in this enum. |
111 * @draft ICU 53 | 108 * @stable ICU 53 |
112 */ | 109 */ |
113 UDAT_RELATIVE_UNIT_COUNT | 110 UDAT_RELATIVE_UNIT_COUNT |
114 } UDateRelativeUnit; | 111 } UDateRelativeUnit; |
115 | 112 |
116 /** | 113 /** |
117 * Represents an absolute unit. | 114 * Represents an absolute unit. |
118 * @draft ICU 53 | 115 * @stable ICU 53 |
119 */ | 116 */ |
120 typedef enum UDateAbsoluteUnit { | 117 typedef enum UDateAbsoluteUnit { |
121 | 118 |
122 // Days of week have to remain together and in order from Sunday to | 119 // Days of week have to remain together and in order from Sunday to |
123 // Saturday. | 120 // Saturday. |
124 /** | 121 /** |
125 * Sunday | 122 * Sunday |
126 * @draft ICU 53 | 123 * @stable ICU 53 |
127 */ | 124 */ |
128 UDAT_ABSOLUTE_SUNDAY, | 125 UDAT_ABSOLUTE_SUNDAY, |
129 | 126 |
130 /** | 127 /** |
131 * Monday | 128 * Monday |
132 * @draft ICU 53 | 129 * @stable ICU 53 |
133 */ | 130 */ |
134 UDAT_ABSOLUTE_MONDAY, | 131 UDAT_ABSOLUTE_MONDAY, |
135 | 132 |
136 /** | 133 /** |
137 * Tuesday | 134 * Tuesday |
138 * @draft ICU 53 | 135 * @stable ICU 53 |
139 */ | 136 */ |
140 UDAT_ABSOLUTE_TUESDAY, | 137 UDAT_ABSOLUTE_TUESDAY, |
141 | 138 |
142 /** | 139 /** |
143 * Wednesday | 140 * Wednesday |
144 * @draft ICU 53 | 141 * @stable ICU 53 |
145 */ | 142 */ |
146 UDAT_ABSOLUTE_WEDNESDAY, | 143 UDAT_ABSOLUTE_WEDNESDAY, |
147 | 144 |
148 /** | 145 /** |
149 * Thursday | 146 * Thursday |
150 * @draft ICU 53 | 147 * @stable ICU 53 |
151 */ | 148 */ |
152 UDAT_ABSOLUTE_THURSDAY, | 149 UDAT_ABSOLUTE_THURSDAY, |
153 | 150 |
154 /** | 151 /** |
155 * Friday | 152 * Friday |
156 * @draft ICU 53 | 153 * @stable ICU 53 |
157 */ | 154 */ |
158 UDAT_ABSOLUTE_FRIDAY, | 155 UDAT_ABSOLUTE_FRIDAY, |
159 | 156 |
160 /** | 157 /** |
161 * Saturday | 158 * Saturday |
162 * @draft ICU 53 | 159 * @stable ICU 53 |
163 */ | 160 */ |
164 UDAT_ABSOLUTE_SATURDAY, | 161 UDAT_ABSOLUTE_SATURDAY, |
165 | 162 |
166 /** | 163 /** |
167 * Day | 164 * Day |
168 * @draft ICU 53 | 165 * @stable ICU 53 |
169 */ | 166 */ |
170 UDAT_ABSOLUTE_DAY, | 167 UDAT_ABSOLUTE_DAY, |
171 | 168 |
172 /** | 169 /** |
173 * Week | 170 * Week |
174 * @draft ICU 53 | 171 * @stable ICU 53 |
175 */ | 172 */ |
176 UDAT_ABSOLUTE_WEEK, | 173 UDAT_ABSOLUTE_WEEK, |
177 | 174 |
178 /** | 175 /** |
179 * Month | 176 * Month |
180 * @draft ICU 53 | 177 * @stable ICU 53 |
181 */ | 178 */ |
182 UDAT_ABSOLUTE_MONTH, | 179 UDAT_ABSOLUTE_MONTH, |
183 | 180 |
184 /** | 181 /** |
185 * Year | 182 * Year |
186 * @draft ICU 53 | 183 * @stable ICU 53 |
187 */ | 184 */ |
188 UDAT_ABSOLUTE_YEAR, | 185 UDAT_ABSOLUTE_YEAR, |
189 | 186 |
190 /** | 187 /** |
191 * Now | 188 * Now |
192 * @draft ICU 53 | 189 * @stable ICU 53 |
193 */ | 190 */ |
194 UDAT_ABSOLUTE_NOW, | 191 UDAT_ABSOLUTE_NOW, |
195 | 192 |
196 /** | 193 /** |
197 * Count of items in this enum. | 194 * Count of items in this enum. |
198 * @draft ICU 53 | 195 * @stable ICU 53 |
199 */ | 196 */ |
200 UDAT_ABSOLUTE_UNIT_COUNT | 197 UDAT_ABSOLUTE_UNIT_COUNT |
201 } UDateAbsoluteUnit; | 198 } UDateAbsoluteUnit; |
202 | 199 |
203 /** | 200 /** |
204 * Represents a direction for an absolute unit e.g "Next Tuesday" | 201 * Represents a direction for an absolute unit e.g "Next Tuesday" |
205 * or "Last Tuesday" | 202 * or "Last Tuesday" |
206 * @draft ICU 53 | 203 * @stable ICU 53 |
207 */ | 204 */ |
208 typedef enum UDateDirection { | 205 typedef enum UDateDirection { |
209 | 206 |
210 /** | 207 /** |
211 * Two before. Not fully supported in every locale. | 208 * Two before. Not fully supported in every locale. |
212 * @draft ICU 53 | 209 * @stable ICU 53 |
213 */ | 210 */ |
214 UDAT_DIRECTION_LAST_2, | 211 UDAT_DIRECTION_LAST_2, |
215 | 212 |
216 /** | 213 /** |
217 * Last | 214 * Last |
218 * @draft ICU 53 | 215 * @stable ICU 53 |
219 */ | 216 */ |
220 UDAT_DIRECTION_LAST, | 217 UDAT_DIRECTION_LAST, |
221 | 218 |
222 /** | 219 /** |
223 * This | 220 * This |
224 * @draft ICU 53 | 221 * @stable ICU 53 |
225 */ | 222 */ |
226 UDAT_DIRECTION_THIS, | 223 UDAT_DIRECTION_THIS, |
227 | 224 |
228 /** | 225 /** |
229 * Next | 226 * Next |
230 * @draft ICU 53 | 227 * @stable ICU 53 |
231 */ | 228 */ |
232 UDAT_DIRECTION_NEXT, | 229 UDAT_DIRECTION_NEXT, |
233 | 230 |
234 /** | 231 /** |
235 * Two after. Not fully supported in every locale. | 232 * Two after. Not fully supported in every locale. |
236 * @draft ICU 53 | 233 * @stable ICU 53 |
237 */ | 234 */ |
238 UDAT_DIRECTION_NEXT_2, | 235 UDAT_DIRECTION_NEXT_2, |
239 | 236 |
240 /** | 237 /** |
241 * Plain, which means the absence of a qualifier. | 238 * Plain, which means the absence of a qualifier. |
242 * @draft ICU 53 | 239 * @stable ICU 53 |
243 */ | 240 */ |
244 UDAT_DIRECTION_PLAIN, | 241 UDAT_DIRECTION_PLAIN, |
245 | 242 |
246 /** | 243 /** |
247 * Count of items in this enum. | 244 * Count of items in this enum. |
248 * @draft ICU 53 | 245 * @stable ICU 53 |
249 */ | 246 */ |
250 UDAT_DIRECTION_COUNT | 247 UDAT_DIRECTION_COUNT |
251 } UDateDirection; | 248 } UDateDirection; |
252 | 249 |
253 | 250 |
254 U_NAMESPACE_BEGIN | 251 U_NAMESPACE_BEGIN |
255 | 252 |
256 class RelativeDateTimeCacheData; | 253 class RelativeDateTimeCacheData; |
257 class SharedNumberFormat; | 254 class SharedNumberFormat; |
258 class SharedPluralRules; | 255 class SharedPluralRules; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_NOW, appendTo, status); | 316 * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_NOW, appendTo, status); |
320 * | 317 * |
321 * </pre> | 318 * </pre> |
322 * </blockquote> | 319 * </blockquote> |
323 * <p> | 320 * <p> |
324 * In the future, we may add more forms, such as abbreviated/short forms | 321 * In the future, we may add more forms, such as abbreviated/short forms |
325 * (3 secs ago), and relative day periods ("yesterday afternoon"), etc. | 322 * (3 secs ago), and relative day periods ("yesterday afternoon"), etc. |
326 * | 323 * |
327 * The RelativeDateTimeFormatter class is not intended for public subclassing. | 324 * The RelativeDateTimeFormatter class is not intended for public subclassing. |
328 * | 325 * |
329 * @draft ICU 53 | 326 * @stable ICU 53 |
330 */ | 327 */ |
331 class U_I18N_API RelativeDateTimeFormatter : public UObject { | 328 class U_I18N_API RelativeDateTimeFormatter : public UObject { |
332 public: | 329 public: |
333 | 330 |
334 /** | 331 /** |
335 * Create RelativeDateTimeFormatter with default locale. | 332 * Create RelativeDateTimeFormatter with default locale. |
336 * @draft ICU 53 | 333 * @stable ICU 53 |
337 */ | 334 */ |
338 RelativeDateTimeFormatter(UErrorCode& status); | 335 RelativeDateTimeFormatter(UErrorCode& status); |
339 | 336 |
340 /** | 337 /** |
341 * Create RelativeDateTimeFormatter with given locale. | 338 * Create RelativeDateTimeFormatter with given locale. |
342 * @draft ICU 53 | 339 * @stable ICU 53 |
343 */ | 340 */ |
344 RelativeDateTimeFormatter(const Locale& locale, UErrorCode& status); | 341 RelativeDateTimeFormatter(const Locale& locale, UErrorCode& status); |
345 | 342 |
346 /** | 343 /** |
347 * Create RelativeDateTimeFormatter with given locale and NumberFormat. | 344 * Create RelativeDateTimeFormatter with given locale and NumberFormat. |
348 * | 345 * |
349 * @param locale the locale | 346 * @param locale the locale |
350 * @param nfToAdopt Constructed object takes ownership of this pointer. | 347 * @param nfToAdopt Constructed object takes ownership of this pointer. |
351 * It is an error for caller to delete this pointer or change its | 348 * It is an error for caller to delete this pointer or change its |
352 * contents after calling this constructor. | 349 * contents after calling this constructor. |
353 * @status Any error is returned here. | 350 * @status Any error is returned here. |
354 * @draft ICU 53 | 351 * @stable ICU 53 |
355 */ | 352 */ |
356 RelativeDateTimeFormatter( | 353 RelativeDateTimeFormatter( |
357 const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status); | 354 const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status); |
358 | 355 |
359 /** | 356 /** |
360 * Create RelativeDateTimeFormatter with given locale, NumberFormat, | 357 * Create RelativeDateTimeFormatter with given locale, NumberFormat, |
361 * and capitalization context. | 358 * and capitalization context. |
362 * | 359 * |
363 * @param locale the locale | 360 * @param locale the locale |
364 * @param nfToAdopt Constructed object takes ownership of this pointer. | 361 * @param nfToAdopt Constructed object takes ownership of this pointer. |
365 * It is an error for caller to delete this pointer or change its | 362 * It is an error for caller to delete this pointer or change its |
366 * contents after calling this constructor. Caller may pass NULL for | 363 * contents after calling this constructor. Caller may pass NULL for |
367 * this argument if they want default number format behavior. | 364 * this argument if they want default number format behavior. |
368 * @param style the format style. The UDAT_RELATIVE bit field has no effect. | 365 * @param style the format style. The UDAT_RELATIVE bit field has no effect. |
369 * @param capitalizationContext A value from UDisplayContext that pertains t
o | 366 * @param capitalizationContext A value from UDisplayContext that pertains t
o |
370 * capitalization. | 367 * capitalization. |
371 * @status Any error is returned here. | 368 * @status Any error is returned here. |
372 * @draft ICU 54 | 369 * @stable ICU 54 |
373 */ | 370 */ |
374 RelativeDateTimeFormatter( | 371 RelativeDateTimeFormatter( |
375 const Locale& locale, | 372 const Locale& locale, |
376 NumberFormat *nfToAdopt, | 373 NumberFormat *nfToAdopt, |
377 UDateRelativeDateTimeFormatterStyle style, | 374 UDateRelativeDateTimeFormatterStyle style, |
378 UDisplayContext capitalizationContext, | 375 UDisplayContext capitalizationContext, |
379 UErrorCode& status); | 376 UErrorCode& status); |
380 | 377 |
381 /** | 378 /** |
382 * Copy constructor. | 379 * Copy constructor. |
383 * @draft ICU 53 | 380 * @stable ICU 53 |
384 */ | 381 */ |
385 RelativeDateTimeFormatter(const RelativeDateTimeFormatter& other); | 382 RelativeDateTimeFormatter(const RelativeDateTimeFormatter& other); |
386 | 383 |
387 /** | 384 /** |
388 * Assignment operator. | 385 * Assignment operator. |
389 * @draft ICU 53 | 386 * @stable ICU 53 |
390 */ | 387 */ |
391 RelativeDateTimeFormatter& operator=( | 388 RelativeDateTimeFormatter& operator=( |
392 const RelativeDateTimeFormatter& other); | 389 const RelativeDateTimeFormatter& other); |
393 | 390 |
394 /** | 391 /** |
395 * Destructor. | 392 * Destructor. |
396 * @draft ICU 53 | 393 * @stable ICU 53 |
397 */ | 394 */ |
398 virtual ~RelativeDateTimeFormatter(); | 395 virtual ~RelativeDateTimeFormatter(); |
399 | 396 |
400 /** | 397 /** |
401 * Formats a relative date with a quantity such as "in 5 days" or | 398 * Formats a relative date with a quantity such as "in 5 days" or |
402 * "3 months ago" | 399 * "3 months ago" |
403 * @param quantity The numerical amount e.g 5. This value is formatted | 400 * @param quantity The numerical amount e.g 5. This value is formatted |
404 * according to this object's NumberFormat object. | 401 * according to this object's NumberFormat object. |
405 * @param direction NEXT means a future relative date; LAST means a past | 402 * @param direction NEXT means a future relative date; LAST means a past |
406 * relative date. If direction is anything else, this method sets | 403 * relative date. If direction is anything else, this method sets |
407 * status to U_ILLEGAL_ARGUMENT_ERROR. | 404 * status to U_ILLEGAL_ARGUMENT_ERROR. |
408 * @param unit the unit e.g day? month? year? | 405 * @param unit the unit e.g day? month? year? |
409 * @param appendTo The string to which the formatted result will be | 406 * @param appendTo The string to which the formatted result will be |
410 * appended | 407 * appended |
411 * @param status ICU error code returned here. | 408 * @param status ICU error code returned here. |
412 * @return appendTo | 409 * @return appendTo |
413 * @draft ICU 53 | 410 * @stable ICU 53 |
414 */ | 411 */ |
415 UnicodeString& format( | 412 UnicodeString& format( |
416 double quantity, | 413 double quantity, |
417 UDateDirection direction, | 414 UDateDirection direction, |
418 UDateRelativeUnit unit, | 415 UDateRelativeUnit unit, |
419 UnicodeString& appendTo, | 416 UnicodeString& appendTo, |
420 UErrorCode& status) const; | 417 UErrorCode& status) const; |
421 | 418 |
422 /** | 419 /** |
423 * Formats a relative date without a quantity. | 420 * Formats a relative date without a quantity. |
424 * @param direction NEXT, LAST, THIS, etc. | 421 * @param direction NEXT, LAST, THIS, etc. |
425 * @param unit e.g SATURDAY, DAY, MONTH | 422 * @param unit e.g SATURDAY, DAY, MONTH |
426 * @param appendTo The string to which the formatted result will be | 423 * @param appendTo The string to which the formatted result will be |
427 * appended. If the value of direction is documented as not being fully | 424 * appended. If the value of direction is documented as not being fully |
428 * supported in all locales then this method leaves appendTo unchanged if | 425 * supported in all locales then this method leaves appendTo unchanged if |
429 * no format string is available. | 426 * no format string is available. |
430 * @param status ICU error code returned here. | 427 * @param status ICU error code returned here. |
431 * @return appendTo | 428 * @return appendTo |
432 * @draft ICU 53 | 429 * @stable ICU 53 |
433 */ | 430 */ |
434 UnicodeString& format( | 431 UnicodeString& format( |
435 UDateDirection direction, | 432 UDateDirection direction, |
436 UDateAbsoluteUnit unit, | 433 UDateAbsoluteUnit unit, |
437 UnicodeString& appendTo, | 434 UnicodeString& appendTo, |
438 UErrorCode& status) const; | 435 UErrorCode& status) const; |
439 | 436 |
440 /** | 437 /** |
441 * Combines a relative date string and a time string in this object's | 438 * Combines a relative date string and a time string in this object's |
442 * locale. This is done with the same date-time separator used for the | 439 * locale. This is done with the same date-time separator used for the |
443 * default calendar in this locale. | 440 * default calendar in this locale. |
444 * | 441 * |
445 * @param relativeDateString the relative date, e.g 'yesterday' | 442 * @param relativeDateString the relative date, e.g 'yesterday' |
446 * @param timeString the time e.g '3:45' | 443 * @param timeString the time e.g '3:45' |
447 * @param appendTo concatenated date and time appended here | 444 * @param appendTo concatenated date and time appended here |
448 * @param status ICU error code returned here. | 445 * @param status ICU error code returned here. |
449 * @return appendTo | 446 * @return appendTo |
450 * @draft ICU 53 | 447 * @stable ICU 53 |
451 */ | 448 */ |
452 UnicodeString& combineDateAndTime( | 449 UnicodeString& combineDateAndTime( |
453 const UnicodeString& relativeDateString, | 450 const UnicodeString& relativeDateString, |
454 const UnicodeString& timeString, | 451 const UnicodeString& timeString, |
455 UnicodeString& appendTo, | 452 UnicodeString& appendTo, |
456 UErrorCode& status) const; | 453 UErrorCode& status) const; |
457 | 454 |
458 /** | 455 /** |
459 * Returns the NumberFormat this object is using. | 456 * Returns the NumberFormat this object is using. |
460 * | 457 * |
461 * @draft ICU 53 | 458 * @stable ICU 53 |
462 */ | 459 */ |
463 const NumberFormat& getNumberFormat() const; | 460 const NumberFormat& getNumberFormat() const; |
464 | 461 |
465 /** | 462 /** |
466 * Returns the capitalization context. | 463 * Returns the capitalization context. |
467 * | 464 * |
468 * @draft ICU 54 | 465 * @stable ICU 54 |
469 */ | 466 */ |
470 UDisplayContext getCapitalizationContext() const; | 467 UDisplayContext getCapitalizationContext() const; |
471 | 468 |
472 /** | 469 /** |
473 * Returns the format style. | 470 * Returns the format style. |
474 * | 471 * |
475 * @draft ICU 54 | 472 * @stable ICU 54 |
476 */ | 473 */ |
477 UDateRelativeDateTimeFormatterStyle getFormatStyle() const; | 474 UDateRelativeDateTimeFormatterStyle getFormatStyle() const; |
| 475 |
478 private: | 476 private: |
479 const RelativeDateTimeCacheData* fCache; | 477 const RelativeDateTimeCacheData* fCache; |
480 const SharedNumberFormat *fNumberFormat; | 478 const SharedNumberFormat *fNumberFormat; |
481 const SharedPluralRules *fPluralRules; | 479 const SharedPluralRules *fPluralRules; |
482 UDateRelativeDateTimeFormatterStyle fStyle; | 480 UDateRelativeDateTimeFormatterStyle fStyle; |
483 UDisplayContext fContext; | 481 UDisplayContext fContext; |
484 const SharedBreakIterator *fOptBreakIterator; | 482 const SharedBreakIterator *fOptBreakIterator; |
485 Locale fLocale; | 483 Locale fLocale; |
486 void init( | 484 void init( |
487 NumberFormat *nfToAdopt, | 485 NumberFormat *nfToAdopt, |
488 BreakIterator *brkIter, | 486 BreakIterator *brkIter, |
489 UErrorCode &status); | 487 UErrorCode &status); |
490 void adjustForContext(UnicodeString &) const; | 488 void adjustForContext(UnicodeString &) const; |
491 }; | 489 }; |
492 | 490 |
493 U_NAMESPACE_END | 491 U_NAMESPACE_END |
494 | 492 |
495 #endif /* U_HIDE_DRAFT_API */ | |
496 | |
497 #endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION*/ | 493 #endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION*/ |
498 #endif | 494 #endif |
OLD | NEW |