]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/dtfmtsym.h
ICU-491.11.2.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / dtfmtsym.h
1 /*
2 ********************************************************************************
3 * Copyright (C) 1997-2012, 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
41 /**
42 * DateFormatSymbols is a public class for encapsulating localizable date-time
43 * formatting data -- including timezone data. DateFormatSymbols is used by
44 * DateFormat and SimpleDateFormat.
45 * <P>
46 * Rather than first creating a DateFormatSymbols to get a date-time formatter
47 * by using a SimpleDateFormat constructor, clients are encouraged to create a
48 * date-time formatter using the getTimeInstance(), getDateInstance(), or
49 * getDateTimeInstance() method in DateFormat. Each of these methods can return a
50 * date/time formatter initialized with a default format pattern along with the
51 * date-time formatting data for a given or default locale. After a formatter is
52 * created, clients may modify the format pattern using the setPattern function
53 * as so desired. For more information on using these formatter factory
54 * functions, see DateFormat.
55 * <P>
56 * If clients decide to create a date-time formatter with a particular format
57 * pattern and locale, they can do so with new SimpleDateFormat(aPattern,
58 * new DateFormatSymbols(aLocale)). This will load the appropriate date-time
59 * formatting data from the locale.
60 * <P>
61 * DateFormatSymbols objects are clonable. When clients obtain a
62 * DateFormatSymbols object, they can feel free to modify the date-time
63 * formatting data as necessary. For instance, clients can
64 * replace the localized date-time format pattern characters with the ones that
65 * they feel easy to remember. Or they can change the representative cities
66 * originally picked by default to using their favorite ones.
67 * <P>
68 * DateFormatSymbols are not expected to be subclassed. Data for a calendar is
69 * loaded out of resource bundles. The 'type' parameter indicates the type of
70 * calendar, for example, "gregorian" or "japanese". If the type is not gregorian
71 * (or NULL, or an empty string) then the type is appended to the resource name,
72 * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japanese' did
73 * not exist (even in root), then this class will fall back to just 'Eras', that is,
74 * Gregorian data. Therefore, the calendar implementor MUST ensure that the root
75 * locale at least contains any resources that are to be particularized for the
76 * calendar type.
77 */
78 class U_I18N_API DateFormatSymbols : public UObject {
79 public:
80 /**
81 * Construct a DateFormatSymbols object by loading format data from
82 * resources for the default locale, in the default calendar (Gregorian).
83 * <P>
84 * NOTE: This constructor will never fail; if it cannot get resource
85 * data for the default locale, it will return a last-resort object
86 * based on hard-coded strings.
87 *
88 * @param status Status code. Failure
89 * results if the resources for the default cannot be
90 * found or cannot be loaded
91 * @stable ICU 2.0
92 */
93 DateFormatSymbols(UErrorCode& status);
94
95 /**
96 * Construct a DateFormatSymbols object by loading format data from
97 * resources for the given locale, in the default calendar (Gregorian).
98 *
99 * @param locale Locale to load format data from.
100 * @param status Status code. Failure
101 * results if the resources for the locale cannot be
102 * found or cannot be loaded
103 * @stable ICU 2.0
104 */
105 DateFormatSymbols(const Locale& locale,
106 UErrorCode& status);
107
108 #ifndef U_HIDE_INTERNAL_API
109 /**
110 * Construct a DateFormatSymbols object by loading format data from
111 * resources for the default locale, in the default calendar (Gregorian).
112 * <P>
113 * NOTE: This constructor will never fail; if it cannot get resource
114 * data for the default locale, it will return a last-resort object
115 * based on hard-coded strings.
116 *
117 * @param type Type of calendar (as returned by Calendar::getType).
118 * Will be used to access the correct set of strings.
119 * (NULL or empty string defaults to "gregorian".)
120 * @param status Status code. Failure
121 * results if the resources for the default cannot be
122 * found or cannot be loaded
123 * @internal
124 */
125 DateFormatSymbols(const char *type, UErrorCode& status);
126
127 /**
128 * Construct a DateFormatSymbols object by loading format data from
129 * resources for the given locale, in the default calendar (Gregorian).
130 *
131 * @param locale Locale to load format data from.
132 * @param type Type of calendar (as returned by Calendar::getType).
133 * Will be used to access the correct set of strings.
134 * (NULL or empty string defaults to "gregorian".)
135 * @param status Status code. Failure
136 * results if the resources for the locale cannot be
137 * found or cannot be loaded
138 * @internal
139 */
140 DateFormatSymbols(const Locale& locale,
141 const char *type,
142 UErrorCode& status);
143 #endif /* U_HIDE_INTERNAL_API */
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 ownership.)
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 ownership)
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 retains 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", "February", 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, or NARROW.
293 * @return the month strings. (DateFormatSymbols retains ownership.)
294 * @stable ICU 3.4
295 */
296 const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
297
298 /**
299 * Sets month strings by width and context. For example: "January", "February", etc.
300 *
301 * @param months The new month strings. (not adopted; caller retains ownership)
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, or NARROW.
305 * @stable ICU 3.6
306 */
307 void setMonths(const UnicodeString* months, int32_t count, DtContextType context, 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, or NARROW
347 * @return the month strings. (DateFormatSymbols retains ownership.)
348 * @stable ICU 3.4
349 */
350 const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType 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 ownership)
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", "2nd 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, DtWidthType width) const;
372
373 /**
374 * Sets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
375 *
376 * @param quarters The new quarter strings. (not adopted; caller retains ownership)
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 ownership.)
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 ownership)
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 #ifndef U_HIDE_INTERNAL_API
402 /**
403 * Somewhat temporary constants for leap month pattern types, adequate for supporting
404 * just leap month patterns as needed for Chinese lunar calendar.
405 * Eventually we will add full support for different month pattern types (needed for
406 * other calendars such as Hindu) at which point this approach will be replaced by a
407 * more complete approach.
408 * @internal
409 */
410 enum EMonthPatternType
411 {
412 kLeapMonthPatternFormatWide,
413 kLeapMonthPatternFormatAbbrev,
414 kLeapMonthPatternFormatNarrow,
415 kLeapMonthPatternStandaloneWide,
416 kLeapMonthPatternStandaloneAbbrev,
417 kLeapMonthPatternStandaloneNarrow,
418 kLeapMonthPatternNumeric,
419 kMonthPatternsCount
420 };
421
422 /**
423 * Somewhat temporary function for getting complete set of leap month patterns for all
424 * contexts & widths, indexed by EMonthPatternType values. Returns NULL if calendar
425 * does not have leap month patterns. Note, there is currently no setter for this.
426 * Eventually we will add full support for different month pattern types (needed for
427 * other calendars such as Hindu) at which point this approach will be replaced by a
428 * more complete approach.
429 * @param count Filled in with length of the array (may be 0).
430 * @return The leap month patterns (DateFormatSymbols retains ownership).
431 * May be NULL if there are no leap month patterns for this calendar.
432 * @internal
433 */
434 const UnicodeString* getLeapMonthPatterns(int32_t& count) const;
435
436 #endif /* U_HIDE_INTERNAL_API */
437
438 #ifndef U_HIDE_DEPRECATED_API
439 /**
440 * Gets timezone strings. These strings are stored in a 2-dimensional array.
441 * @param rowCount Output param to receive number of rows.
442 * @param columnCount Output param to receive number of columns.
443 * @return The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.)
444 * @deprecated ICU 3.6
445 */
446 const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
447 #endif /* U_HIDE_DEPRECATED_API */
448
449 /**
450 * Sets timezone strings. These strings are stored in a 2-dimensional array.
451 * <p><b>Note:</b> SimpleDateFormat no longer use the zone strings stored in
452 * a DateFormatSymbols. Therefore, the time zone strings set by this mthod
453 * have no effects in an instance of SimpleDateFormat for formatting time
454 * zones.
455 * @param strings The timezone strings as a 2-d array to be copied. (not adopted; caller retains ownership)
456 * @param rowCount The number of rows (count of first index).
457 * @param columnCount The number of columns (count of second index).
458 * @stable ICU 2.0
459 */
460 void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
461
462 /**
463 * Get the non-localized date-time pattern characters.
464 * @return the non-localized date-time pattern characters
465 * @stable ICU 2.0
466 */
467 static const UChar * U_EXPORT2 getPatternUChars(void);
468
469 /**
470 * Gets localized date-time pattern characters. For example: 'u', 't', etc.
471 * <p>
472 * Note: ICU no longer provides localized date-time pattern characters for a locale
473 * starting ICU 3.8. This method returns the non-localized date-time pattern
474 * characters unless user defined localized data is set by setLocalPatternChars.
475 * @param result Output param which will receive the localized date-time pattern characters.
476 * @return A reference to 'result'.
477 * @stable ICU 2.0
478 */
479 UnicodeString& getLocalPatternChars(UnicodeString& result) const;
480
481 /**
482 * Sets localized date-time pattern characters. For example: 'u', 't', etc.
483 * @param newLocalPatternChars the new localized date-time
484 * pattern characters.
485 * @stable ICU 2.0
486 */
487 void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
488
489 /**
490 * Returns the locale for this object. Two flavors are available:
491 * valid and actual locale.
492 * @stable ICU 2.8
493 */
494 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
495
496 #ifndef U_HIDE_INTERNAL_API
497 /**
498 * Constants for capitalization context usage types.
499 * @internal
500 */
501 enum ECapitalizationContextUsageType
502 {
503 kCapContextUsageOther,
504 kCapContextUsageMonthFormat, /* except narrow */
505 kCapContextUsageMonthStandalone, /* except narrow */
506 kCapContextUsageMonthNarrow,
507 kCapContextUsageDayFormat, /* except narrow */
508 kCapContextUsageDayStandalone, /* except narrow */
509 kCapContextUsageDayNarrow,
510 kCapContextUsageEraWide,
511 kCapContextUsageEraAbbrev,
512 kCapContextUsageEraNarrow,
513 kCapContextUsageZoneLong,
514 kCapContextUsageZoneShort,
515 kCapContextUsageMetazoneLong,
516 kCapContextUsageMetazoneShort,
517 kCapContextUsageTypeCount
518 };
519 #endif /* U_HIDE_INTERNAL_API */
520
521 /**
522 * ICU "poor man's RTTI", returns a UClassID for the actual class.
523 *
524 * @stable ICU 2.2
525 */
526 virtual UClassID getDynamicClassID() const;
527
528 /**
529 * ICU "poor man's RTTI", returns a UClassID for this class.
530 *
531 * @stable ICU 2.2
532 */
533 static UClassID U_EXPORT2 getStaticClassID();
534
535 private:
536
537 friend class SimpleDateFormat;
538 friend class DateFormatSymbolsSingleSetter; // see udat.cpp
539
540 /**
541 * Abbreviated era strings. For example: "AD" and "BC".
542 */
543 UnicodeString* fEras;
544 int32_t fErasCount;
545
546 /**
547 * Era name strings. For example: "Anno Domini" and "Before Christ".
548 */
549 UnicodeString* fEraNames;
550 int32_t fEraNamesCount;
551
552 /**
553 * Narrow era strings. For example: "A" and "B".
554 */
555 UnicodeString* fNarrowEras;
556 int32_t fNarrowErasCount;
557
558 /**
559 * Month strings. For example: "January", "February", etc.
560 */
561 UnicodeString* fMonths;
562 int32_t fMonthsCount;
563
564 /**
565 * Short month strings. For example: "Jan", "Feb", etc.
566 */
567 UnicodeString* fShortMonths;
568 int32_t fShortMonthsCount;
569
570 /**
571 * Narrow month strings. For example: "J", "F", etc.
572 */
573 UnicodeString* fNarrowMonths;
574 int32_t fNarrowMonthsCount;
575
576 /**
577 * Standalone Month strings. For example: "January", "February", etc.
578 */
579 UnicodeString* fStandaloneMonths;
580 int32_t fStandaloneMonthsCount;
581
582 /**
583 * Standalone Short month strings. For example: "Jan", "Feb", etc.
584 */
585 UnicodeString* fStandaloneShortMonths;
586 int32_t fStandaloneShortMonthsCount;
587
588 /**
589 * Standalone Narrow month strings. For example: "J", "F", etc.
590 */
591 UnicodeString* fStandaloneNarrowMonths;
592 int32_t fStandaloneNarrowMonthsCount;
593
594 /**
595 * Weekday strings. For example: "Sunday", "Monday", etc.
596 */
597 UnicodeString* fWeekdays;
598 int32_t fWeekdaysCount;
599
600 /**
601 * Short weekday strings. For example: "Sun", "Mon", etc.
602 */
603 UnicodeString* fShortWeekdays;
604 int32_t fShortWeekdaysCount;
605
606 /**
607 * Narrow weekday strings. For example: "Sun", "Mon", etc.
608 */
609 UnicodeString* fNarrowWeekdays;
610 int32_t fNarrowWeekdaysCount;
611
612 /**
613 * Standalone Weekday strings. For example: "Sunday", "Monday", etc.
614 */
615 UnicodeString* fStandaloneWeekdays;
616 int32_t fStandaloneWeekdaysCount;
617
618 /**
619 * Standalone Short weekday strings. For example: "Sun", "Mon", etc.
620 */
621 UnicodeString* fStandaloneShortWeekdays;
622 int32_t fStandaloneShortWeekdaysCount;
623
624 /**
625 * Standalone Narrow weekday strings. For example: "Sun", "Mon", etc.
626 */
627 UnicodeString* fStandaloneNarrowWeekdays;
628 int32_t fStandaloneNarrowWeekdaysCount;
629
630 /**
631 * Ampm strings. For example: "AM" and "PM".
632 */
633 UnicodeString* fAmPms;
634 int32_t fAmPmsCount;
635
636 /**
637 * Quarter strings. For example: "1st quarter", "2nd quarter", etc.
638 */
639 UnicodeString *fQuarters;
640 int32_t fQuartersCount;
641
642 /**
643 * Short quarters. For example: "Q1", "Q2", etc.
644 */
645 UnicodeString *fShortQuarters;
646 int32_t fShortQuartersCount;
647
648 /**
649 * Standalone quarter strings. For example: "1st quarter", "2nd quarter", etc.
650 */
651 UnicodeString *fStandaloneQuarters;
652 int32_t fStandaloneQuartersCount;
653
654 /**
655 * Standalone short quarter strings. For example: "Q1", "Q2", etc.
656 */
657 UnicodeString *fStandaloneShortQuarters;
658 int32_t fStandaloneShortQuartersCount;
659
660 /**
661 * All leap month patterns, for example "{0}bis".
662 */
663 UnicodeString *fLeapMonthPatterns;
664 int32_t fLeapMonthPatternsCount;
665
666 /**
667 * (Format) Short cyclic year names, for example: "jia-zi", "yi-chou", ... "gui-hai"
668 */
669 UnicodeString* fShortYearNames;
670 int32_t fShortYearNamesCount;
671
672 /**
673 * Localized names of time zones in this locale. This is a
674 * two-dimensional array of strings of size n by m,
675 * where m is at least 5 and up to 7. Each of the n rows is an
676 * entry containing the localized names for a single TimeZone.
677 *
678 * Each such row contains (with i ranging from 0..n-1):
679 *
680 * zoneStrings[i][0] - time zone ID
681 * example: America/Los_Angeles
682 * zoneStrings[i][1] - long name of zone in standard time
683 * example: Pacific Standard Time
684 * zoneStrings[i][2] - short name of zone in standard time
685 * example: PST
686 * zoneStrings[i][3] - long name of zone in daylight savings time
687 * example: Pacific Daylight Time
688 * zoneStrings[i][4] - short name of zone in daylight savings time
689 * example: PDT
690 * zoneStrings[i][5] - location name of zone
691 * example: United States (Los Angeles)
692 * zoneStrings[i][6] - long generic name of zone
693 * example: Pacific Time
694 * zoneStrings[i][7] - short generic of zone
695 * example: PT
696 *
697 * The zone ID is not localized; it corresponds to the ID
698 * value associated with a system time zone object. All other entries
699 * are localized names. If a zone does not implement daylight savings
700 * time, the daylight savings time names are ignored.
701 *
702 * Note:CLDR 1.5 introduced metazone and its historical mappings.
703 * This simple two-dimensional array is no longer sufficient to represent
704 * localized names and its historic changes. Since ICU 3.8.1, localized
705 * zone names extracted from ICU locale data is stored in a ZoneStringFormat
706 * instance. But we still need to support the old way of customizing
707 * localized zone names, so we keep this field for the purpose.
708 */
709 UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings
710 UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale
711 int32_t fZoneStringsRowCount;
712 int32_t fZoneStringsColCount;
713
714 Locale fZSFLocale; // Locale used for getting ZoneStringFormat
715
716 /**
717 * Localized date-time pattern characters. For example: use 'u' as 'y'.
718 */
719 UnicodeString fLocalPatternChars;
720
721 #ifndef U_HIDE_INTERNAL_API
722 /**
723 * Capitalization transforms. For each usage type, the first array element indicates
724 * whether to titlecase for uiListOrMenu context, the second indicates whether to
725 * titlecase for stand-alone context.
726 */
727 UBool fCapitalization[kCapContextUsageTypeCount][2];
728 #endif
729
730
731 private:
732 /** valid/actual locale information
733 * these are always ICU locales, so the length should not be a problem
734 */
735 char validLocale[ULOC_FULLNAME_CAPACITY];
736 char actualLocale[ULOC_FULLNAME_CAPACITY];
737
738 DateFormatSymbols(); // default constructor not implemented
739
740 /**
741 * Called by the constructors to actually load data from the resources
742 *
743 * @param locale The locale to get symbols for.
744 * @param type Calendar Type (as from Calendar::getType())
745 * @param status Input/output parameter, set to success or
746 * failure code upon return.
747 * @param useLastResortData determine if use last resort data
748 */
749 void initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
750
751 /**
752 * Copy or alias an array in another object, as appropriate.
753 *
754 * @param dstArray the copy destination array.
755 * @param dstCount fill in with the lenth of 'dstArray'.
756 * @param srcArray the source array to be copied.
757 * @param srcCount the length of items to be copied from the 'srcArray'.
758 */
759 static void assignArray(UnicodeString*& dstArray,
760 int32_t& dstCount,
761 const UnicodeString* srcArray,
762 int32_t srcCount);
763
764 /**
765 * Return true if the given arrays' contents are equal, or if the arrays are
766 * identical (pointers are equal).
767 *
768 * @param array1 one array to be compared with.
769 * @param array2 another array to be compared with.
770 * @param count the length of items to be copied.
771 * @return true if the given arrays' contents are equal, or if the arrays are
772 * identical (pointers are equal).
773 */
774 static UBool arrayCompare(const UnicodeString* array1,
775 const UnicodeString* array2,
776 int32_t count);
777
778 /**
779 * Create a copy, in fZoneStrings, of the given zone strings array. The
780 * member variables fZoneStringsRowCount and fZoneStringsColCount should be
781 * set already by the caller.
782 */
783 void createZoneStrings(const UnicodeString *const * otherStrings);
784
785 /**
786 * Delete all the storage owned by this object.
787 */
788 void dispose(void);
789
790 /**
791 * Copy all of the other's data to this.
792 * @param other the object to be copied.
793 */
794 void copyData(const DateFormatSymbols& other);
795
796 /**
797 * Create zone strings array by locale if not yet available
798 */
799 void initZoneStringsArray(void);
800
801 /**
802 * Delete just the zone strings.
803 */
804 void disposeZoneStrings(void);
805 };
806
807 U_NAMESPACE_END
808
809 #endif /* #if !UCONFIG_NO_FORMATTING */
810
811 #endif // _DTFMTSYM
812 //eof