OLD | NEW |
| (Empty) |
1 /* | |
2 ******************************************************************************** | |
3 * Copyright (C) 1997-2010, International Business Machines | |
4 * Corporation and others. All Rights Reserved. | |
5 ******************************************************************************** | |
6 * | |
7 * File DTFMTSYM.H | |
8 * | |
9 * Modification History: | |
10 * | |
11 * Date Name Description | |
12 * 02/19/97 aliu Converted from java. | |
13 * 07/21/98 stephen Added getZoneIndex() | |
14 * Changed to match C++ conventions | |
15 ******************************************************************************** | |
16 */ | |
17 | |
18 #ifndef DTFMTSYM_H | |
19 #define DTFMTSYM_H | |
20 | |
21 #include "unicode/utypes.h" | |
22 | |
23 #if !UCONFIG_NO_FORMATTING | |
24 | |
25 #include "unicode/calendar.h" | |
26 #include "unicode/uobject.h" | |
27 #include "unicode/locid.h" | |
28 #include "unicode/ures.h" | |
29 | |
30 /** | |
31 * \file | |
32 * \brief C++ API: Symbols for formatting dates. | |
33 */ | |
34 | |
35 U_NAMESPACE_BEGIN | |
36 | |
37 /* forward declaration */ | |
38 class SimpleDateFormat; | |
39 class Hashtable; | |
40 class ZoneStringFormat; | |
41 class SafeZoneStringFormatPtr; | |
42 | |
43 /** | |
44 * DateFormatSymbols is a public class for encapsulating localizable date-time | |
45 * formatting data -- including timezone data. DateFormatSymbols is used by | |
46 * DateFormat and SimpleDateFormat. | |
47 * <P> | |
48 * Rather than first creating a DateFormatSymbols to get a date-time formatter | |
49 * by using a SimpleDateFormat constructor, clients are encouraged to create a | |
50 * date-time formatter using the getTimeInstance(), getDateInstance(), or | |
51 * getDateTimeInstance() method in DateFormat. Each of these methods can return
a | |
52 * date/time formatter initialized with a default format pattern along with the | |
53 * date-time formatting data for a given or default locale. After a formatter is | |
54 * created, clients may modify the format pattern using the setPattern function | |
55 * as so desired. For more information on using these formatter factory | |
56 * functions, see DateFormat. | |
57 * <P> | |
58 * If clients decide to create a date-time formatter with a particular format | |
59 * pattern and locale, they can do so with new SimpleDateFormat(aPattern, | |
60 * new DateFormatSymbols(aLocale)). This will load the appropriate date-time | |
61 * formatting data from the locale. | |
62 * <P> | |
63 * DateFormatSymbols objects are clonable. When clients obtain a | |
64 * DateFormatSymbols object, they can feel free to modify the date-time | |
65 * formatting data as necessary. For instance, clients can | |
66 * replace the localized date-time format pattern characters with the ones that | |
67 * they feel easy to remember. Or they can change the representative cities | |
68 * originally picked by default to using their favorite ones. | |
69 * <P> | |
70 * DateFormatSymbols are not expected to be subclassed. Data for a calendar is | |
71 * loaded out of resource bundles. The 'type' parameter indicates the type of | |
72 * calendar, for example, "gregorian" or "japanese". If the type is not gregori
an | |
73 * (or NULL, or an empty string) then the type is appended to the resource name, | |
74 * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japa
nese' did | |
75 * not exist (even in root), then this class will fall back to just 'Eras', that
is, | |
76 * Gregorian data. Therefore, the calendar implementor MUST ensure that the roo
t | |
77 * locale at least contains any resources that are to be particularized for the | |
78 * calendar type. | |
79 */ | |
80 class U_I18N_API DateFormatSymbols : public UObject { | |
81 public: | |
82 /** | |
83 * Construct a DateFormatSymbols object by loading format data from | |
84 * resources for the default locale, in the default calendar (Gregorian). | |
85 * <P> | |
86 * NOTE: This constructor will never fail; if it cannot get resource | |
87 * data for the default locale, it will return a last-resort object | |
88 * based on hard-coded strings. | |
89 * | |
90 * @param status Status code. Failure | |
91 * results if the resources for the default cannot be | |
92 * found or cannot be loaded | |
93 * @stable ICU 2.0 | |
94 */ | |
95 DateFormatSymbols(UErrorCode& status); | |
96 | |
97 /** | |
98 * Construct a DateFormatSymbols object by loading format data from | |
99 * resources for the given locale, in the default calendar (Gregorian). | |
100 * | |
101 * @param locale Locale to load format data from. | |
102 * @param status Status code. Failure | |
103 * results if the resources for the locale cannot be | |
104 * found or cannot be loaded | |
105 * @stable ICU 2.0 | |
106 */ | |
107 DateFormatSymbols(const Locale& locale, | |
108 UErrorCode& status); | |
109 | |
110 /** | |
111 * Construct a DateFormatSymbols object by loading format data from | |
112 * resources for the default locale, in the default calendar (Gregorian). | |
113 * <P> | |
114 * NOTE: This constructor will never fail; if it cannot get resource | |
115 * data for the default locale, it will return a last-resort object | |
116 * based on hard-coded strings. | |
117 * | |
118 * @param type Type of calendar (as returned by Calendar::getType). | |
119 * Will be used to access the correct set of strings. | |
120 * (NULL or empty string defaults to "gregorian".) | |
121 * @param status Status code. Failure | |
122 * results if the resources for the default cannot be | |
123 * found or cannot be loaded | |
124 * @internal | |
125 */ | |
126 DateFormatSymbols(const char *type, UErrorCode& status); | |
127 | |
128 /** | |
129 * Construct a DateFormatSymbols object by loading format data from | |
130 * resources for the given locale, in the default calendar (Gregorian). | |
131 * | |
132 * @param locale Locale to load format data from. | |
133 * @param type Type of calendar (as returned by Calendar::getType). | |
134 * Will be used to access the correct set of strings. | |
135 * (NULL or empty string defaults to "gregorian".) | |
136 * @param status Status code. Failure | |
137 * results if the resources for the locale cannot be | |
138 * found or cannot be loaded | |
139 * @internal | |
140 */ | |
141 DateFormatSymbols(const Locale& locale, | |
142 const char *type, | |
143 UErrorCode& status); | |
144 | |
145 /** | |
146 * Copy constructor. | |
147 * @stable ICU 2.0 | |
148 */ | |
149 DateFormatSymbols(const DateFormatSymbols&); | |
150 | |
151 /** | |
152 * Assignment operator. | |
153 * @stable ICU 2.0 | |
154 */ | |
155 DateFormatSymbols& operator=(const DateFormatSymbols&); | |
156 | |
157 /** | |
158 * Destructor. This is nonvirtual because this class is not designed to be | |
159 * subclassed. | |
160 * @stable ICU 2.0 | |
161 */ | |
162 virtual ~DateFormatSymbols(); | |
163 | |
164 /** | |
165 * Return true if another object is semantically equal to this one. | |
166 * | |
167 * @param other the DateFormatSymbols object to be compared with. | |
168 * @return true if other is semantically equal to this. | |
169 * @stable ICU 2.0 | |
170 */ | |
171 UBool operator==(const DateFormatSymbols& other) const; | |
172 | |
173 /** | |
174 * Return true if another object is semantically unequal to this one. | |
175 * | |
176 * @param other the DateFormatSymbols object to be compared with. | |
177 * @return true if other is semantically unequal to this. | |
178 * @stable ICU 2.0 | |
179 */ | |
180 UBool operator!=(const DateFormatSymbols& other) const { return !operator==(
other); } | |
181 | |
182 /** | |
183 * Gets abbreviated era strings. For example: "AD" and "BC". | |
184 * | |
185 * @param count Filled in with length of the array. | |
186 * @return the era strings. | |
187 * @stable ICU 2.0 | |
188 */ | |
189 const UnicodeString* getEras(int32_t& count) const; | |
190 | |
191 /** | |
192 * Sets abbreviated era strings. For example: "AD" and "BC". | |
193 * @param eras Array of era strings (DateFormatSymbols retains ownership.) | |
194 * @param count Filled in with length of the array. | |
195 * @stable ICU 2.0 | |
196 */ | |
197 void setEras(const UnicodeString* eras, int32_t count); | |
198 | |
199 /** | |
200 * Gets era name strings. For example: "Anno Domini" and "Before Christ". | |
201 * | |
202 * @param count Filled in with length of the array. | |
203 * @return the era name strings. | |
204 * @stable ICU 3.4 | |
205 */ | |
206 const UnicodeString* getEraNames(int32_t& count) const; | |
207 | |
208 /** | |
209 * Sets era name strings. For example: "Anno Domini" and "Before Christ". | |
210 * @param eraNames Array of era name strings (DateFormatSymbols retains own
ership.) | |
211 * @param count Filled in with length of the array. | |
212 * @stable ICU 3.6 | |
213 */ | |
214 void setEraNames(const UnicodeString* eraNames, int32_t count); | |
215 | |
216 /** | |
217 * Gets narrow era strings. For example: "A" and "B". | |
218 * | |
219 * @param count Filled in with length of the array. | |
220 * @return the narrow era strings. | |
221 * @stable ICU 4.2 | |
222 */ | |
223 const UnicodeString* getNarrowEras(int32_t& count) const; | |
224 | |
225 /** | |
226 * Sets narrow era strings. For example: "A" and "B". | |
227 * @param narrowEras Array of narrow era strings (DateFormatSymbols retains
ownership.) | |
228 * @param count Filled in with length of the array. | |
229 * @stable ICU 4.2 | |
230 */ | |
231 void setNarrowEras(const UnicodeString* narrowEras, int32_t count); | |
232 | |
233 /** | |
234 * Gets month strings. For example: "January", "February", etc. | |
235 * @param count Filled in with length of the array. | |
236 * @return the month strings. (DateFormatSymbols retains ownership.) | |
237 * @stable ICU 2.0 | |
238 */ | |
239 const UnicodeString* getMonths(int32_t& count) const; | |
240 | |
241 /** | |
242 * Sets month strings. For example: "January", "February", etc. | |
243 * | |
244 * @param months the new month strings. (not adopted; caller retains owne
rship) | |
245 * @param count Filled in with length of the array. | |
246 * @stable ICU 2.0 | |
247 */ | |
248 void setMonths(const UnicodeString* months, int32_t count); | |
249 | |
250 /** | |
251 * Gets short month strings. For example: "Jan", "Feb", etc. | |
252 * | |
253 * @param count Filled in with length of the array. | |
254 * @return the short month strings. (DateFormatSymbols retains ownership.) | |
255 * @stable ICU 2.0 | |
256 */ | |
257 const UnicodeString* getShortMonths(int32_t& count) const; | |
258 | |
259 /** | |
260 * Sets short month strings. For example: "Jan", "Feb", etc. | |
261 * @param count Filled in with length of the array. | |
262 * @param shortMonths the new short month strings. (not adopted; caller ret
ains ownership) | |
263 * @stable ICU 2.0 | |
264 */ | |
265 void setShortMonths(const UnicodeString* shortMonths, int32_t count); | |
266 | |
267 /** | |
268 * Selector for date formatting context | |
269 * @stable ICU 3.6 | |
270 */ | |
271 enum DtContextType { | |
272 FORMAT, | |
273 STANDALONE, | |
274 DT_CONTEXT_COUNT | |
275 }; | |
276 | |
277 /** | |
278 * Selector for date formatting width | |
279 * @stable ICU 3.6 | |
280 */ | |
281 enum DtWidthType { | |
282 ABBREVIATED, | |
283 WIDE, | |
284 NARROW, | |
285 DT_WIDTH_COUNT | |
286 }; | |
287 | |
288 /** | |
289 * Gets month strings by width and context. For example: "January", "Februar
y", etc. | |
290 * @param count Filled in with length of the array. | |
291 * @param context The formatting context, either FORMAT or STANDALONE | |
292 * @param width The width of returned strings, either WIDE, ABBREVIATED, o
r NARROW. | |
293 * @return the month strings. (DateFormatSymbols retains ownership.) | |
294 * @stable ICU 3.4 | |
295 */ | |
296 const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidt
hType width) const; | |
297 | |
298 /** | |
299 * Sets month strings by width and context. For example: "January", "Februar
y", etc. | |
300 * | |
301 * @param months The new month strings. (not adopted; caller retains owners
hip) | |
302 * @param count Filled in with length of the array. | |
303 * @param context The formatting context, either FORMAT or STANDALONE | |
304 * @param width The width of returned strings, either WIDE, ABBREVIATED, o
r NARROW. | |
305 * @stable ICU 3.6 | |
306 */ | |
307 void setMonths(const UnicodeString* months, int32_t count, DtContextType con
text, DtWidthType width); | |
308 | |
309 /** | |
310 * Gets weekday strings. For example: "Sunday", "Monday", etc. | |
311 * @param count Filled in with length of the array. | |
312 * @return the weekday strings. (DateFormatSymbols retains ownership.) | |
313 * @stable ICU 2.0 | |
314 */ | |
315 const UnicodeString* getWeekdays(int32_t& count) const; | |
316 | |
317 | |
318 /** | |
319 * Sets weekday strings. For example: "Sunday", "Monday", etc. | |
320 * @param weekdays the new weekday strings. (not adopted; caller retains
ownership) | |
321 * @param count Filled in with length of the array. | |
322 * @stable ICU 2.0 | |
323 */ | |
324 void setWeekdays(const UnicodeString* weekdays, int32_t count); | |
325 | |
326 /** | |
327 * Gets short weekday strings. For example: "Sun", "Mon", etc. | |
328 * @param count Filled in with length of the array. | |
329 * @return the short weekday strings. (DateFormatSymbols retains
ownership.) | |
330 * @stable ICU 2.0 | |
331 */ | |
332 const UnicodeString* getShortWeekdays(int32_t& count) const; | |
333 | |
334 /** | |
335 * Sets short weekday strings. For example: "Sun", "Mon", etc. | |
336 * @param shortWeekdays the new short weekday strings. (not adopted; caller
retains ownership) | |
337 * @param count Filled in with length of the array. | |
338 * @stable ICU 2.0 | |
339 */ | |
340 void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count); | |
341 | |
342 /** | |
343 * Gets weekday strings by width and context. For example: "Sunday", "Monday
", etc. | |
344 * @param count Filled in with length of the array. | |
345 * @param context The formatting context, either FORMAT or STANDALONE | |
346 * @param width The width of returned strings, either WIDE, ABBREVIATED, o
r NARROW | |
347 * @return the month strings. (DateFormatSymbols retains ownership.) | |
348 * @stable ICU 3.4 | |
349 */ | |
350 const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWi
dthType width) const; | |
351 | |
352 /** | |
353 * Sets weekday strings by width and context. For example: "Sunday", "Monday
", etc. | |
354 * @param weekdays The new weekday strings. (not adopted; caller retains ow
nership) | |
355 * @param count Filled in with length of the array. | |
356 * @param context The formatting context, either FORMAT or STANDALONE | |
357 * @param width The width of returned strings, either WIDE, ABBREVIATED,
or NARROW | |
358 * @stable ICU 3.6 | |
359 */ | |
360 void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType
context, DtWidthType width); | |
361 | |
362 /** | |
363 * Gets quarter strings by width and context. For example: "1st Quarter", "2
nd Quarter", etc. | |
364 * @param count Filled in with length of the array. | |
365 * @param context The formatting context, either FORMAT or STANDALONE | |
366 * @param width The width of returned strings, either WIDE or ABBREVIATED.
There | |
367 * are no NARROW quarters. | |
368 * @return the quarter strings. (DateFormatSymbols retains ownership.) | |
369 * @stable ICU 3.6 | |
370 */ | |
371 const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWi
dthType width) const; | |
372 | |
373 /** | |
374 * Sets quarter strings by width and context. For example: "1st Quarter", "2
nd Quarter", etc. | |
375 * | |
376 * @param quarters The new quarter strings. (not adopted; caller retains ow
nership) | |
377 * @param count Filled in with length of the array. | |
378 * @param context The formatting context, either FORMAT or STANDALONE | |
379 * @param width The width of returned strings, either WIDE or ABBREVIATED.
There | |
380 * are no NARROW quarters. | |
381 * @stable ICU 3.6 | |
382 */ | |
383 void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType
context, DtWidthType width); | |
384 | |
385 /** | |
386 * Gets AM/PM strings. For example: "AM" and "PM". | |
387 * @param count Filled in with length of the array. | |
388 * @return the weekday strings. (DateFormatSymbols retains owner
ship.) | |
389 * @stable ICU 2.0 | |
390 */ | |
391 const UnicodeString* getAmPmStrings(int32_t& count) const; | |
392 | |
393 /** | |
394 * Sets ampm strings. For example: "AM" and "PM". | |
395 * @param ampms the new ampm strings. (not adopted; caller retains ow
nership) | |
396 * @param count Filled in with length of the array. | |
397 * @stable ICU 2.0 | |
398 */ | |
399 void setAmPmStrings(const UnicodeString* ampms, int32_t count); | |
400 | |
401 /** | |
402 * Gets timezone strings. These strings are stored in a 2-dimensional array. | |
403 * @param rowCount Output param to receive number of rows. | |
404 * @param columnCount Output param to receive number of columns. | |
405 * @return The timezone strings as a 2-d array. (DateFormatSymb
ols retains ownership.) | |
406 * @deprecated ICU 3.6 | |
407 */ | |
408 const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount
) const; | |
409 | |
410 /** | |
411 * Sets timezone strings. These strings are stored in a 2-dimensional array. | |
412 * @param strings The timezone strings as a 2-d array to be copied. (n
ot adopted; caller retains ownership) | |
413 * @param rowCount The number of rows (count of first index). | |
414 * @param columnCount The number of columns (count of second index). | |
415 * @stable ICU 2.0 | |
416 */ | |
417 void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, i
nt32_t columnCount); | |
418 | |
419 /** | |
420 * Get the non-localized date-time pattern characters. | |
421 * @return the non-localized date-time pattern characters | |
422 * @stable ICU 2.0 | |
423 */ | |
424 static const UChar * U_EXPORT2 getPatternUChars(void); | |
425 | |
426 /** | |
427 * Gets localized date-time pattern characters. For example: 'u', 't', etc. | |
428 * <p> | |
429 * Note: ICU no longer provides localized date-time pattern characters for a
locale | |
430 * starting ICU 3.8. This method returns the non-localized date-time patter
n | |
431 * characters unless user defined localized data is set by setLocalPatternCh
ars. | |
432 * @param result Output param which will receive the localized date-time
pattern characters. | |
433 * @return A reference to 'result'. | |
434 * @stable ICU 2.0 | |
435 */ | |
436 UnicodeString& getLocalPatternChars(UnicodeString& result) const; | |
437 | |
438 /** | |
439 * Sets localized date-time pattern characters. For example: 'u', 't', etc. | |
440 * @param newLocalPatternChars the new localized date-time | |
441 * pattern characters. | |
442 * @stable ICU 2.0 | |
443 */ | |
444 void setLocalPatternChars(const UnicodeString& newLocalPatternChars); | |
445 | |
446 /** | |
447 * Returns the locale for this object. Two flavors are available: | |
448 * valid and actual locale. | |
449 * @stable ICU 2.8 | |
450 */ | |
451 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; | |
452 | |
453 /** | |
454 * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
455 * | |
456 * @stable ICU 2.2 | |
457 */ | |
458 virtual UClassID getDynamicClassID() const; | |
459 | |
460 /** | |
461 * ICU "poor man's RTTI", returns a UClassID for this class. | |
462 * | |
463 * @stable ICU 2.2 | |
464 */ | |
465 static UClassID U_EXPORT2 getStaticClassID(); | |
466 | |
467 private: | |
468 | |
469 friend class SimpleDateFormat; | |
470 friend class DateFormatSymbolsSingleSetter; // see udat.cpp | |
471 | |
472 /** | |
473 * Abbreviated era strings. For example: "AD" and "BC". | |
474 */ | |
475 UnicodeString* fEras; | |
476 int32_t fErasCount; | |
477 | |
478 /** | |
479 * Era name strings. For example: "Anno Domini" and "Before Christ". | |
480 */ | |
481 UnicodeString* fEraNames; | |
482 int32_t fEraNamesCount; | |
483 | |
484 /** | |
485 * Narrow era strings. For example: "A" and "B". | |
486 */ | |
487 UnicodeString* fNarrowEras; | |
488 int32_t fNarrowErasCount; | |
489 | |
490 /** | |
491 * Month strings. For example: "January", "February", etc. | |
492 */ | |
493 UnicodeString* fMonths; | |
494 int32_t fMonthsCount; | |
495 | |
496 /** | |
497 * Short month strings. For example: "Jan", "Feb", etc. | |
498 */ | |
499 UnicodeString* fShortMonths; | |
500 int32_t fShortMonthsCount; | |
501 | |
502 /** | |
503 * Narrow month strings. For example: "J", "F", etc. | |
504 */ | |
505 UnicodeString* fNarrowMonths; | |
506 int32_t fNarrowMonthsCount; | |
507 | |
508 /** | |
509 * Standalone Month strings. For example: "January", "February", etc. | |
510 */ | |
511 UnicodeString* fStandaloneMonths; | |
512 int32_t fStandaloneMonthsCount; | |
513 | |
514 /** | |
515 * Standalone Short month strings. For example: "Jan", "Feb", etc. | |
516 */ | |
517 UnicodeString* fStandaloneShortMonths; | |
518 int32_t fStandaloneShortMonthsCount; | |
519 | |
520 /** | |
521 * Standalone Narrow month strings. For example: "J", "F", etc. | |
522 */ | |
523 UnicodeString* fStandaloneNarrowMonths; | |
524 int32_t fStandaloneNarrowMonthsCount; | |
525 | |
526 /** | |
527 * Weekday strings. For example: "Sunday", "Monday", etc. | |
528 */ | |
529 UnicodeString* fWeekdays; | |
530 int32_t fWeekdaysCount; | |
531 | |
532 /** | |
533 * Short weekday strings. For example: "Sun", "Mon", etc. | |
534 */ | |
535 UnicodeString* fShortWeekdays; | |
536 int32_t fShortWeekdaysCount; | |
537 | |
538 /** | |
539 * Narrow weekday strings. For example: "Sun", "Mon", etc. | |
540 */ | |
541 UnicodeString* fNarrowWeekdays; | |
542 int32_t fNarrowWeekdaysCount; | |
543 | |
544 /** | |
545 * Standalone Weekday strings. For example: "Sunday", "Monday", etc. | |
546 */ | |
547 UnicodeString* fStandaloneWeekdays; | |
548 int32_t fStandaloneWeekdaysCount; | |
549 | |
550 /** | |
551 * Standalone Short weekday strings. For example: "Sun", "Mon", etc. | |
552 */ | |
553 UnicodeString* fStandaloneShortWeekdays; | |
554 int32_t fStandaloneShortWeekdaysCount; | |
555 | |
556 /** | |
557 * Standalone Narrow weekday strings. For example: "Sun", "Mon", etc. | |
558 */ | |
559 UnicodeString* fStandaloneNarrowWeekdays; | |
560 int32_t fStandaloneNarrowWeekdaysCount; | |
561 | |
562 /** | |
563 * Ampm strings. For example: "AM" and "PM". | |
564 */ | |
565 UnicodeString* fAmPms; | |
566 int32_t fAmPmsCount; | |
567 | |
568 /** | |
569 * Quarter strings. For example: "1st quarter", "2nd quarter", etc. | |
570 */ | |
571 UnicodeString *fQuarters; | |
572 int32_t fQuartersCount; | |
573 | |
574 /** | |
575 * Short quarters. For example: "Q1", "Q2", etc. | |
576 */ | |
577 UnicodeString *fShortQuarters; | |
578 int32_t fShortQuartersCount; | |
579 | |
580 /** | |
581 * Standalone quarter strings. For example: "1st quarter", "2nd quarter", et
c. | |
582 */ | |
583 UnicodeString *fStandaloneQuarters; | |
584 int32_t fStandaloneQuartersCount; | |
585 | |
586 /** | |
587 * Standalone short quarter strings. For example: "Q1", "Q2", etc. | |
588 */ | |
589 UnicodeString *fStandaloneShortQuarters; | |
590 int32_t fStandaloneShortQuartersCount; | |
591 | |
592 /** | |
593 * Localized names of time zones in this locale. This is a | |
594 * two-dimensional array of strings of size n by m, | |
595 * where m is at least 5 and up to 7. Each of the n rows is an | |
596 * entry containing the localized names for a single TimeZone. | |
597 * | |
598 * Each such row contains (with i ranging from 0..n-1): | |
599 * | |
600 * zoneStrings[i][0] - time zone ID | |
601 * example: America/Los_Angeles | |
602 * zoneStrings[i][1] - long name of zone in standard time | |
603 * example: Pacific Standard Time | |
604 * zoneStrings[i][2] - short name of zone in standard time | |
605 * example: PST | |
606 * zoneStrings[i][3] - long name of zone in daylight savings time | |
607 * example: Pacific Daylight Time | |
608 * zoneStrings[i][4] - short name of zone in daylight savings time | |
609 * example: PDT | |
610 * zoneStrings[i][5] - location name of zone | |
611 * example: United States (Los Angeles) | |
612 * zoneStrings[i][6] - long generic name of zone | |
613 * example: Pacific Time | |
614 * zoneStrings[i][7] - short generic of zone | |
615 * example: PT | |
616 * | |
617 * The zone ID is not localized; it corresponds to the ID | |
618 * value associated with a system time zone object. All other entries | |
619 * are localized names. If a zone does not implement daylight savings | |
620 * time, the daylight savings time names are ignored. | |
621 * | |
622 * Note:CLDR 1.5 introduced metazone and its historical mappings. | |
623 * This simple two-dimensional array is no longer sufficient to represent | |
624 * localized names and its historic changes. Since ICU 3.8.1, localized | |
625 * zone names extracted from ICU locale data is stored in a ZoneStringFormat | |
626 * instance. But we still need to support the old way of customizing | |
627 * localized zone names, so we keep this field for the purpose. | |
628 */ | |
629 UnicodeString **fZoneStrings; // Zone string array set by setZoneS
trings | |
630 UnicodeString **fLocaleZoneStrings; // Zone string array created by the
locale | |
631 int32_t fZoneStringsRowCount; | |
632 int32_t fZoneStringsColCount; | |
633 | |
634 const ZoneStringFormat *fZoneStringFormat; | |
635 ZoneStringFormat *fZSFLocal; // Local ZoneStringFormat instan
ce | |
636 SafeZoneStringFormatPtr *fZSFCachePtr; // Cached ZoneStringFormat | |
637 Locale fZSFLocale; // Locale used for getting ZoneS
tringFormat | |
638 | |
639 /** | |
640 * Pattern string used for localized time zone GMT format. For example, "GM
T{0}" | |
641 */ | |
642 UnicodeString fGmtFormat; | |
643 | |
644 /** | |
645 * Pattern strings used for formatting zone offset in a localized time zone
GMT string. | |
646 */ | |
647 UnicodeString *fGmtHourFormats; | |
648 int32_t fGmtHourFormatsCount; | |
649 | |
650 enum GMTHourType { | |
651 GMT_NEGATIVE_HMS = 0, | |
652 GMT_NEGATIVE_HM, | |
653 GMT_POSITIVE_HMS, | |
654 GMT_POSITIVE_HM, | |
655 GMT_HOUR_COUNT | |
656 }; | |
657 | |
658 /** | |
659 * Localized date-time pattern characters. For example: use 'u' as 'y'. | |
660 */ | |
661 UnicodeString fLocalPatternChars; | |
662 | |
663 private: | |
664 /** valid/actual locale information | |
665 * these are always ICU locales, so the length should not be a problem | |
666 */ | |
667 char validLocale[ULOC_FULLNAME_CAPACITY]; | |
668 char actualLocale[ULOC_FULLNAME_CAPACITY]; | |
669 | |
670 DateFormatSymbols(); // default constructor not implemented | |
671 | |
672 /** | |
673 * Called by the constructors to actually load data from the resources | |
674 * | |
675 * @param locale The locale to get symbols for. | |
676 * @param type Calendar Type (as from Calendar::getType()) | |
677 * @param status Input/output parameter, set to success or | |
678 * failure code upon return. | |
679 * @param useLastResortData determine if use last resort data | |
680 */ | |
681 void initializeData(const Locale&, const char *type, UErrorCode& status, UBo
ol useLastResortData = FALSE); | |
682 | |
683 /** | |
684 * Copy or alias an array in another object, as appropriate. | |
685 * | |
686 * @param dstArray the copy destination array. | |
687 * @param dstCount fill in with the lenth of 'dstArray'. | |
688 * @param srcArray the source array to be copied. | |
689 * @param srcCount the length of items to be copied from the 'srcArray'. | |
690 */ | |
691 static void assignArray(UnicodeString*& dstArray, | |
692 int32_t& dstCount, | |
693 const UnicodeString* srcArray, | |
694 int32_t srcCount); | |
695 | |
696 /** | |
697 * Return true if the given arrays' contents are equal, or if the arrays are | |
698 * identical (pointers are equal). | |
699 * | |
700 * @param array1 one array to be compared with. | |
701 * @param array2 another array to be compared with. | |
702 * @param count the length of items to be copied. | |
703 * @return true if the given arrays' contents are equal, or if the a
rrays are | |
704 * identical (pointers are equal). | |
705 */ | |
706 static UBool arrayCompare(const UnicodeString* array1, | |
707 const UnicodeString* array2, | |
708 int32_t count); | |
709 | |
710 /** | |
711 * Create a copy, in fZoneStrings, of the given zone strings array. The | |
712 * member variables fZoneStringsRowCount and fZoneStringsColCount should be | |
713 * set already by the caller. | |
714 */ | |
715 void createZoneStrings(const UnicodeString *const * otherStrings); | |
716 | |
717 /** | |
718 * Delete all the storage owned by this object. | |
719 */ | |
720 void dispose(void); | |
721 | |
722 /** | |
723 * Copy all of the other's data to this. | |
724 * @param other the object to be copied. | |
725 */ | |
726 void copyData(const DateFormatSymbols& other); | |
727 | |
728 | |
729 /** | |
730 * Returns a ZoneStringFormat, used only by SimpleDateFormat for now. | |
731 */ | |
732 const ZoneStringFormat* getZoneStringFormat(void) const; | |
733 | |
734 /** | |
735 * Create a ZoneStringFormat by locale if not yet availble | |
736 */ | |
737 void initZoneStringFormat(void); | |
738 | |
739 /** | |
740 * Create zone strings array by locale if not yet available | |
741 */ | |
742 void initZoneStringsArray(void); | |
743 | |
744 /** | |
745 * Delete just the zone strings. | |
746 */ | |
747 void disposeZoneStrings(void); | |
748 }; | |
749 | |
750 U_NAMESPACE_END | |
751 | |
752 #endif /* #if !UCONFIG_NO_FORMATTING */ | |
753 | |
754 #endif // _DTFMTSYM | |
755 //eof | |
OLD | NEW |