]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/dtfmtsym.h
ICU-8.11.2.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / dtfmtsym.h
1 /*
2 ********************************************************************************
3 * Copyright (C) 1997-2006, 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/uobject.h"
26 #include "unicode/locid.h"
27 #include "unicode/ures.h"
28
29 /**
30 * \file
31 * \brief C++ API: Symbols for formatting dates.
32 */
33
34 U_NAMESPACE_BEGIN
35
36 /* forward declaration */
37 class SimpleDateFormat;
38 class Hashtable;
39
40 /**
41 * DateFormatSymbols is a public class for encapsulating localizable date-time
42 * formatting data -- including timezone data. DateFormatSymbols is used by
43 * DateFormat and SimpleDateFormat.
44 * <P>
45 * Rather than first creating a DateFormatSymbols to get a date-time formatter
46 * by using a SimpleDateFormat constructor, clients are encouraged to create a
47 * date-time formatter using the getTimeInstance(), getDateInstance(), or
48 * getDateTimeInstance() method in DateFormat. Each of these methods can return a
49 * date/time formatter initialized with a default format pattern along with the
50 * date-time formatting data for a given or default locale. After a formatter is
51 * created, clients may modify the format pattern using the setPattern function
52 * as so desired. For more information on using these formatter factory
53 * functions, see DateFormat.
54 * <P>
55 * If clients decide to create a date-time formatter with a particular format
56 * pattern and locale, they can do so with new SimpleDateFormat(aPattern,
57 * new DateFormatSymbols(aLocale)). This will load the appropriate date-time
58 * formatting data from the locale.
59 * <P>
60 * DateFormatSymbols objects are clonable. When clients obtain a
61 * DateFormatSymbols object, they can feel free to modify the date-time
62 * formatting data as necessary. For instance, clients can
63 * replace the localized date-time format pattern characters with the ones that
64 * they feel easy to remember. Or they can change the representative cities
65 * originally picked by default to using their favorite ones.
66 * <P>
67 * DateFormatSymbols are not expected to be subclassed. Data for a calendar is
68 * loaded out of resource bundles. The 'type' parameter indicates the type of
69 * calendar, for example, "gregorian" or "japanese". If the type is not gregorian
70 * (or NULL, or an empty string) then the type is appended to the resource name,
71 * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japanese' did
72 * not exist (even in root), then this class will fall back to just 'Eras', that is,
73 * Gregorian data. Therefore, the calendar implementor MUST ensure that the root
74 * locale at least contains any resources that are to be particularized for the
75 * calendar type.
76 */
77 class U_I18N_API DateFormatSymbols : public UObject {
78 public:
79 /**
80 * Construct a DateFormatSymbols object by loading format data from
81 * resources for the default locale, in the default calendar (Gregorian).
82 * <P>
83 * NOTE: This constructor will never fail; if it cannot get resource
84 * data for the default locale, it will return a last-resort object
85 * based on hard-coded strings.
86 *
87 * @param status Status code. Failure
88 * results if the resources for the default cannot be
89 * found or cannot be loaded
90 * @stable ICU 2.0
91 */
92 DateFormatSymbols(UErrorCode& status);
93
94 /**
95 * Construct a DateFormatSymbols object by loading format data from
96 * resources for the given locale, in the default calendar (Gregorian).
97 *
98 * @param locale Locale to load format data from.
99 * @param status Status code. Failure
100 * results if the resources for the locale cannot be
101 * found or cannot be loaded
102 * @stable ICU 2.0
103 */
104 DateFormatSymbols(const Locale& locale,
105 UErrorCode& status);
106
107 /**
108 * Construct a DateFormatSymbols object by loading format data from
109 * resources for the default locale, in the default calendar (Gregorian).
110 * <P>
111 * NOTE: This constructor will never fail; if it cannot get resource
112 * data for the default locale, it will return a last-resort object
113 * based on hard-coded strings.
114 *
115 * @param type Type of calendar (as returned by Calendar::getType).
116 * Will be used to access the correct set of strings.
117 * (NULL or empty string defaults to "gregorian".)
118 * @param status Status code. Failure
119 * results if the resources for the default cannot be
120 * found or cannot be loaded
121 * @internal
122 */
123 DateFormatSymbols(const char *type, UErrorCode& status);
124
125 /**
126 * Construct a DateFormatSymbols object by loading format data from
127 * resources for the given locale, in the default calendar (Gregorian).
128 *
129 * @param locale Locale to load format data from.
130 * @param type Type of calendar (as returned by Calendar::getType).
131 * Will be used to access the correct set of strings.
132 * (NULL or empty string defaults to "gregorian".)
133 * @param status Status code. Failure
134 * results if the resources for the locale cannot be
135 * found or cannot be loaded
136 * @internal
137 */
138 DateFormatSymbols(const Locale& locale,
139 const char *type,
140 UErrorCode& status);
141
142 /**
143 * Copy constructor.
144 * @stable ICU 2.0
145 */
146 DateFormatSymbols(const DateFormatSymbols&);
147
148 /**
149 * Assignment operator.
150 * @stable ICU 2.0
151 */
152 DateFormatSymbols& operator=(const DateFormatSymbols&);
153
154 /**
155 * Destructor. This is nonvirtual because this class is not designed to be
156 * subclassed.
157 * @stable ICU 2.0
158 */
159 virtual ~DateFormatSymbols();
160
161 /**
162 * Return true if another object is semantically equal to this one.
163 *
164 * @param other the DateFormatSymbols object to be compared with.
165 * @return true if other is semantically equal to this.
166 * @stable ICU 2.0
167 */
168 UBool operator==(const DateFormatSymbols& other) const;
169
170 /**
171 * Return true if another object is semantically unequal to this one.
172 *
173 * @param other the DateFormatSymbols object to be compared with.
174 * @return true if other is semantically unequal to this.
175 * @stable ICU 2.0
176 */
177 UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
178
179 /**
180 * Gets era strings. For example: "AD" and "BC".
181 *
182 * @param count Filled in with length of the array.
183 * @return the era strings.
184 * @stable ICU 2.0
185 */
186 const UnicodeString* getEras(int32_t& count) const;
187
188 /**
189 * Sets era strings. For example: "AD" and "BC".
190 * @param eras Array of era strings (DateFormatSymbols retains ownership.)
191 * @param count Filled in with length of the array.
192 * @stable ICU 2.0
193 */
194 void setEras(const UnicodeString* eras, int32_t count);
195
196 /**
197 * Gets era name strings. For example: "Anno Domini" and "Before Christ".
198 *
199 * @param count Filled in with length of the array.
200 * @return the era name strings.
201 * @draft ICU 3.4
202 */
203 const UnicodeString* getEraNames(int32_t& count) const;
204
205 /**
206 * Sets era name strings. For example: "Anno Domini" and "Before Christ".
207 * @param eraNames Array of era name strings (DateFormatSymbols retains ownership.)
208 * @param count Filled in with length of the array.
209 * @draft ICU 3.6
210 */
211 void setEraNames(const UnicodeString* eraNames, int32_t count);
212
213 /**
214 * Gets month strings. For example: "January", "February", etc.
215 * @param count Filled in with length of the array.
216 * @return the month strings. (DateFormatSymbols retains ownership.)
217 * @stable ICU 2.0
218 */
219 const UnicodeString* getMonths(int32_t& count) const;
220
221 /**
222 * Sets month strings. For example: "January", "February", etc.
223 *
224 * @param months the new month strings. (not adopted; caller retains ownership)
225 * @param count Filled in with length of the array.
226 * @stable ICU 2.0
227 */
228 void setMonths(const UnicodeString* months, int32_t count);
229
230 /**
231 * Gets short month strings. For example: "Jan", "Feb", etc.
232 *
233 * @param count Filled in with length of the array.
234 * @return the short month strings. (DateFormatSymbols retains ownership.)
235 * @stable ICU 2.0
236 */
237 const UnicodeString* getShortMonths(int32_t& count) const;
238
239 /**
240 * Sets short month strings. For example: "Jan", "Feb", etc.
241 * @param count Filled in with length of the array.
242 * @param shortMonths the new short month strings. (not adopted; caller retains ownership)
243 * @stable ICU 2.0
244 */
245 void setShortMonths(const UnicodeString* shortMonths, int32_t count);
246
247 /**
248 * Selector for date formatting context
249 * @draft ICU 3.6
250 */
251 enum DtContextType {
252 FORMAT,
253 STANDALONE,
254 DT_CONTEXT_COUNT
255 };
256
257 /**
258 * Selector for date formatting width
259 * @draft ICU 3.6
260 */
261 enum DtWidthType {
262 ABBREVIATED,
263 WIDE,
264 NARROW,
265 DT_WIDTH_COUNT
266 };
267
268 /**
269 * Gets month strings by width and context. For example: "January", "February", etc.
270 * @param count Filled in with length of the array.
271 * @param context The formatting context, either FORMAT or STANDALONE
272 * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
273 * @return the month strings. (DateFormatSymbols retains ownership.)
274 * @draft ICU 3.4
275 */
276 const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
277
278 /**
279 * Sets month strings by width and context. For example: "January", "February", etc.
280 *
281 * @param months The new month strings. (not adopted; caller retains ownership)
282 * @param count Filled in with length of the array.
283 * @param context The formatting context, either FORMAT or STANDALONE
284 * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
285 * @draft ICU 3.6
286 */
287 void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
288
289 /**
290 * Gets weekday strings. For example: "Sunday", "Monday", etc.
291 * @param count Filled in with length of the array.
292 * @return the weekday strings. (DateFormatSymbols retains ownership.)
293 * @stable ICU 2.0
294 */
295 const UnicodeString* getWeekdays(int32_t& count) const;
296
297
298 /**
299 * Sets weekday strings. For example: "Sunday", "Monday", etc.
300 * @param weekdays the new weekday strings. (not adopted; caller retains ownership)
301 * @param count Filled in with length of the array.
302 * @stable ICU 2.0
303 */
304 void setWeekdays(const UnicodeString* weekdays, int32_t count);
305
306 /**
307 * Gets short weekday strings. For example: "Sun", "Mon", etc.
308 * @param count Filled in with length of the array.
309 * @return the short weekday strings. (DateFormatSymbols retains ownership.)
310 * @stable ICU 2.0
311 */
312 const UnicodeString* getShortWeekdays(int32_t& count) const;
313
314 /**
315 * Sets short weekday strings. For example: "Sun", "Mon", etc.
316 * @param shortWeekdays the new short weekday strings. (not adopted; caller retains ownership)
317 * @param count Filled in with length of the array.
318 * @stable ICU 2.0
319 */
320 void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
321
322 /**
323 * Gets weekday strings by width and context. For example: "Sunday", "Monday", etc.
324 * @param count Filled in with length of the array.
325 * @param context The formatting context, either FORMAT or STANDALONE
326 * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW
327 * @return the month strings. (DateFormatSymbols retains ownership.)
328 * @draft ICU 3.4
329 */
330 const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
331
332 /**
333 * Sets weekday strings by width and context. For example: "Sunday", "Monday", etc.
334 * @param weekdays The new weekday strings. (not adopted; caller retains ownership)
335 * @param count Filled in with length of the array.
336 * @param context The formatting context, either FORMAT or STANDALONE
337 * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW
338 * @draft ICU 3.6
339 */
340 void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
341
342 /**
343 * Gets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", 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 or ABBREVIATED. There
347 * are no NARROW quarters.
348 * @return the quarter strings. (DateFormatSymbols retains ownership.)
349 * @draft ICU 3.6
350 */
351 const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
352
353 /**
354 * Sets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
355 *
356 * @param quarters The new quarter strings. (not adopted; caller retains ownership)
357 * @param count Filled in with length of the array.
358 * @param context The formatting context, either FORMAT or STANDALONE
359 * @param width The width of returned strings, either WIDE or ABBREVIATED. There
360 * are no NARROW quarters.
361 * @draft ICU 3.6
362 */
363 void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
364
365 /**
366 * Gets AM/PM strings. For example: "AM" and "PM".
367 * @param count Filled in with length of the array.
368 * @return the weekday strings. (DateFormatSymbols retains ownership.)
369 * @stable ICU 2.0
370 */
371 const UnicodeString* getAmPmStrings(int32_t& count) const;
372
373 /**
374 * Sets ampm strings. For example: "AM" and "PM".
375 * @param ampms the new ampm strings. (not adopted; caller retains ownership)
376 * @param count Filled in with length of the array.
377 * @stable ICU 2.0
378 */
379 void setAmPmStrings(const UnicodeString* ampms, int32_t count);
380
381 /**
382 * Gets timezone strings. These strings are stored in a 2-dimensional array.
383 * @param rowCount Output param to receive number of rows.
384 * @param columnCount Output param to receive number of columns.
385 * @return The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.)
386 * @deprecated ICU 3.6
387 */
388 const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
389
390 /**
391 * Sets timezone strings. These strings are stored in a 2-dimensional array.
392 * @param strings The timezone strings as a 2-d array to be copied. (not adopted; caller retains ownership)
393 * @param rowCount The number of rows (count of first index).
394 * @param columnCount The number of columns (count of second index).
395 * @stable ICU 2.0
396 */
397 void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
398
399 /**
400 * Get the non-localized date-time pattern characters.
401 * @return the non-localized date-time pattern characters
402 * @stable ICU 2.0
403 */
404 static const UChar * U_EXPORT2 getPatternUChars(void);
405
406 /**
407 * Gets localized date-time pattern characters. For example: 'u', 't', etc.
408 * @param result Output param which will receive the localized date-time pattern characters.
409 * @return A reference to 'result'.
410 * @stable ICU 2.0
411 */
412 UnicodeString& getLocalPatternChars(UnicodeString& result) const;
413
414 /**
415 * Sets localized date-time pattern characters. For example: 'u', 't', etc.
416 * @param newLocalPatternChars the new localized date-time
417 * pattern characters.
418 * @stable ICU 2.0
419 */
420 void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
421
422 /**
423 * Returns the locale for this object. Two flavors are available:
424 * valid and actual locale.
425 * @stable ICU 2.8
426 */
427 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
428
429 /**
430 * ICU "poor man's RTTI", returns a UClassID for the actual class.
431 *
432 * @stable ICU 2.2
433 */
434 virtual UClassID getDynamicClassID() const;
435
436 /**
437 * ICU "poor man's RTTI", returns a UClassID for this class.
438 *
439 * @stable ICU 2.2
440 */
441 static UClassID U_EXPORT2 getStaticClassID();
442
443 /**
444 * The translation type of the translated zone strings
445 * @internal ICU 3.6
446 */
447 enum TimeZoneTranslationType {
448 TIMEZONE_SHORT_GENERIC,
449 TIMEZONE_SHORT_STANDARD,
450 TIMEZONE_SHORT_DAYLIGHT,
451 TIMEZONE_LONG_GENERIC,
452 TIMEZONE_LONG_STANDARD,
453 TIMEZONE_LONG_DAYLIGHT,
454 TIMEZONE_EXEMPLAR_CITY,
455 TIMEZONE_COUNT
456 };
457
458 /**
459 * Creates an enumeration of time zone IDs. The object is owned by the caller and should delete it after use.
460 * The time zone IDs are just for programmatic lookup. NOT LOCALIZED!!!
461 * @param status Input/output parameter, set to success or
462 * failure code upon return.
463 * @return A new StringEnumeration object
464 * @internal ICU 3.6
465 */
466 virtual StringEnumeration* createZoneStringIDs(UErrorCode &status);
467
468 /**
469 * Gets timezone string give the key and translation type
470 * @param ID The ID of zone strings, e.g: "America/Los_Angeles".
471 * The time zone ID is for programmatic lookup.
472 * @param type The translation type requested
473 * @param result Output parameter to recieve the translation string
474 * @param status Input/output parameter, set to success or
475 * failure code upon return.
476 * @return the input UnicodeString parameter for chaining
477 * @internal ICU 3.6
478 */
479 UnicodeString& getZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, UnicodeString &result, UErrorCode &status);
480
481 /**
482 * Sets timezone string for the given the ID and translation type
483 * @param ID The ID of zone strings, e.g: "America/Los_Angeles".
484 * The time zone ID is for programmatic lookup.
485 * @param type The translation type to set the value for
486 * @param value The string with which current translation needs to be replaced
487 * @param status Input/output parameter, set to success or
488 * @internal ICU 3.6
489 */
490 void setZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, const UnicodeString &value, UErrorCode &status);
491
492 private:
493
494 friend class SimpleDateFormat;
495 friend class DateFormatSymbolsSingleSetter; // see udat.cpp
496
497 /**
498 * Era strings. For example: "AD" and "BC".
499 */
500 UnicodeString* fEras;
501 int32_t fErasCount;
502
503 /**
504 * Era name strings. For example: "Anno Domini" and "Before Christ".
505 */
506 UnicodeString* fEraNames;
507 int32_t fEraNamesCount;
508
509 /**
510 * Month strings. For example: "January", "February", etc.
511 */
512 UnicodeString* fMonths;
513 int32_t fMonthsCount;
514
515 /**
516 * Short month strings. For example: "Jan", "Feb", etc.
517 */
518 UnicodeString* fShortMonths;
519 int32_t fShortMonthsCount;
520
521 /**
522 * Narrow month strings. For example: "J", "F", etc.
523 */
524 UnicodeString* fNarrowMonths;
525 int32_t fNarrowMonthsCount;
526
527 /**
528 * Standalone Month strings. For example: "January", "February", etc.
529 */
530 UnicodeString* fStandaloneMonths;
531 int32_t fStandaloneMonthsCount;
532
533 /**
534 * Standalone Short month strings. For example: "Jan", "Feb", etc.
535 */
536 UnicodeString* fStandaloneShortMonths;
537 int32_t fStandaloneShortMonthsCount;
538
539 /**
540 * Standalone Narrow month strings. For example: "J", "F", etc.
541 */
542 UnicodeString* fStandaloneNarrowMonths;
543 int32_t fStandaloneNarrowMonthsCount;
544
545 /**
546 * Weekday strings. For example: "Sunday", "Monday", etc.
547 */
548 UnicodeString* fWeekdays;
549 int32_t fWeekdaysCount;
550
551 /**
552 * Short weekday strings. For example: "Sun", "Mon", etc.
553 */
554 UnicodeString* fShortWeekdays;
555 int32_t fShortWeekdaysCount;
556
557 /**
558 * Narrow weekday strings. For example: "Sun", "Mon", etc.
559 */
560 UnicodeString* fNarrowWeekdays;
561 int32_t fNarrowWeekdaysCount;
562
563 /**
564 * Standalone Weekday strings. For example: "Sunday", "Monday", etc.
565 */
566 UnicodeString* fStandaloneWeekdays;
567 int32_t fStandaloneWeekdaysCount;
568
569 /**
570 * Standalone Short weekday strings. For example: "Sun", "Mon", etc.
571 */
572 UnicodeString* fStandaloneShortWeekdays;
573 int32_t fStandaloneShortWeekdaysCount;
574
575 /**
576 * Standalone Narrow weekday strings. For example: "Sun", "Mon", etc.
577 */
578 UnicodeString* fStandaloneNarrowWeekdays;
579 int32_t fStandaloneNarrowWeekdaysCount;
580
581 /**
582 * Ampm strings. For example: "AM" and "PM".
583 */
584 UnicodeString* fAmPms;
585 int32_t fAmPmsCount;
586
587 /**
588 * Quarter strings. For example: "1st quarter", "2nd quarter", etc.
589 */
590 UnicodeString *fQuarters;
591 int32_t fQuartersCount;
592
593 /**
594 * Short quarters. For example: "Q1", "Q2", etc.
595 */
596 UnicodeString *fShortQuarters;
597 int32_t fShortQuartersCount;
598
599 /**
600 * Standalone quarter strings. For example: "1st quarter", "2nd quarter", etc.
601 */
602 UnicodeString *fStandaloneQuarters;
603 int32_t fStandaloneQuartersCount;
604
605 /**
606 * Standalone short quarter strings. For example: "Q1", "Q2", etc.
607 */
608 UnicodeString *fStandaloneShortQuarters;
609 int32_t fStandaloneShortQuartersCount;
610
611 /**
612 * The format data of all the timezones in this locale.
613 */
614 UnicodeString** fZoneStrings;
615 int32_t fZoneStringsRowCount;
616 int32_t fZoneStringsColCount;
617 StringEnumeration* fZoneIDEnumeration;
618 Hashtable* fZoneStringsHash;
619 UResourceBundle* fResourceBundle;
620
621 /**
622 * Localized date-time pattern characters. For example: use 'u' as 'y'.
623 */
624 UnicodeString fLocalPatternChars;
625
626 private:
627 /** valid/actual locale information
628 * these are always ICU locales, so the length should not be a problem
629 */
630 char validLocale[ULOC_FULLNAME_CAPACITY];
631 char actualLocale[ULOC_FULLNAME_CAPACITY];
632
633 DateFormatSymbols(); // default constructor not implemented
634
635 /**
636 * Called by the constructors to actually load data from the resources
637 *
638 * @param locale The locale to get symbols for.
639 * @param type Calendar Type (as from Calendar::getType())
640 * @param status Input/output parameter, set to success or
641 * failure code upon return.
642 * @param useLastResortData determine if use last resort data
643 */
644 void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
645
646 /**
647 * Copy or alias an array in another object, as appropriate.
648 *
649 * @param dstArray the copy destination array.
650 * @param dstCount fill in with the lenth of 'dstArray'.
651 * @param srcArray the source array to be copied.
652 * @param srcCount the length of items to be copied from the 'srcArray'.
653 */
654 static void assignArray(UnicodeString*& dstArray,
655 int32_t& dstCount,
656 const UnicodeString* srcArray,
657 int32_t srcCount);
658
659 /**
660 * Return true if the given arrays' contents are equal, or if the arrays are
661 * identical (pointers are equal).
662 *
663 * @param array1 one array to be compared with.
664 * @param array2 another array to be compared with.
665 * @param count the length of items to be copied.
666 * @return true if the given arrays' contents are equal, or if the arrays are
667 * identical (pointers are equal).
668 */
669 static UBool arrayCompare(const UnicodeString* array1,
670 const UnicodeString* array2,
671 int32_t count);
672
673 /**
674 * Create a copy, in fZoneStrings, of the given zone strings array. The
675 * member variables fZoneStringsRowCount and fZoneStringsColCount should be
676 * set already by the caller.
677 */
678 void createZoneStrings(const UnicodeString *const * otherStrings);
679
680 /**
681 * Package private: used by SimpleDateFormat
682 * Gets the index for the given time zone ID to obtain the timezone
683 * strings for formatting. The time zone ID is just for programmatic
684 * lookup. NOT LOCALIZED!!!
685 * @param ID the given time zone ID.
686 * @return the index of the given time zone ID. Returns -1 if
687 * the given time zone ID can't be located in the DateFormatSymbols object.
688 * @see java.util.SimpleTimeZone
689 */
690 int32_t getZoneIndex(const UnicodeString& ID) const;
691
692 // Internal method; see source for documentation
693 int32_t _getZoneIndex(const UnicodeString& id) const;
694
695 /**
696 * Delete all the storage owned by this object.
697 */
698 void dispose(void);
699
700 /**
701 * Copy all of the other's data to this.
702 * @param other the object to be copied.
703 */
704 void copyData(const DateFormatSymbols& other);
705
706 /**
707 * Delete just the zone strings.
708 */
709 void disposeZoneStrings(void);
710 /**
711 * Initializes the zoneStrings hash and keys StringEnumeration after reading the zoneStrings resource
712 */
713 void initZoneStrings(UErrorCode &status);
714 /**
715 * initialzes the zoneStrings has and keys enumeration after reading the strings[][]. Required for backwards
716 * compatibility of setZoneStrings method
717 */
718 void initZoneStrings(const UnicodeString** strings, int32_t rowCount, int32_t collumnCount, UErrorCode& status);
719 /**
720 * initialization of the fZoneStrings data member
721 */
722 void initZoneStringsArray(UErrorCode& status);
723 /**
724 * Creates a deep clone of the Hashtable
725 */
726 Hashtable* createZoneStringsHash(const Hashtable* otherHash);
727
728 /**
729 * Fetches the key from the hashtable for a given ID.
730 * e.g: for a given ID such as PST returns "Americal/Los_Angeles"
731 * Used by SimpleDateFormat class.
732 * @param ID The id of the time zone for which the key needs to be fetched
733 * @param result Output parameter to recieve the key.
734 * @return the input UnicodeString object for chaining
735 */
736 UnicodeString& getZoneID(const UnicodeString& zid, UnicodeString& result, UErrorCode& status);
737
738 /**
739 * Fetches the zone type and zone string from the hashtable for a given key.
740 * e.g: for key: "Americal/Los_Angeles", text: "2004/1/1 PT 1:00" and start:9
741 * returns TIMEZONE_SHORT_GENERIC and "PT".
742 * Used by SimpleDateFormat class.
743 * @param ID the name of the timezone
744 * @param text the string containing the time zone translation
745 * @param start The position in string where time zone string starts
746 * @param type output parameter to recieve the type of time zone string
747 * @param value output parameter to recieve the the acutal time zone string
748 */
749 void getZoneType(const UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
750
751 /**
752 * Fetches the zone type and zone string from the hashtable by cycling through all elements in the hashtable.
753 * e.g: text: "2004/1/1 PT 1:00" and start:9
754 * returns "Americal/Los_Angeles", TIMEZONE_SHORT_GENERIC and "PT". Used by SimpleDateFormat class.
755 * Used by SimpleDateFormat class.
756 * @param ID output parameter to recieve the key name of the time zone
757 * @param text the string containing the time zone translation
758 * @param start The position in string where time zone string starts
759 * @param type output parameter to recieve the type of time zone string
760 * @param value output parameter to recieve the the acutal time zone string
761 * @param status output parameter to recive the error information
762 */
763 void findZoneIDTypeValue(UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
764
765 };
766
767 U_NAMESPACE_END
768
769 #endif /* #if !UCONFIG_NO_FORMATTING */
770
771 #endif // _DTFMTSYM
772 //eof