ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dtfmtsym.h
Go to the documentation of this file.
1 /*
2 ********************************************************************************
3 * Copyright (C) 1997-2014, 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/udat.h"
29 #include "unicode/ures.h"
30
36 U_NAMESPACE_BEGIN
37
38 /* forward declaration */
39 class SimpleDateFormat;
40 class Hashtable;
41
79 class U_I18N_API DateFormatSymbols U_FINAL : public UObject {
80 public:
94 DateFormatSymbols(UErrorCode& status);
95
106 DateFormatSymbols(const Locale& locale,
107 UErrorCode& status);
108
109 #ifndef U_HIDE_INTERNAL_API
110
126 DateFormatSymbols(const char *type, UErrorCode& status);
127
141 DateFormatSymbols(const Locale& locale,
142 const char *type,
143 UErrorCode& status);
144 #endif /* U_HIDE_INTERNAL_API */
145
150 DateFormatSymbols(const DateFormatSymbols&);
151
156 DateFormatSymbols& operator=(const DateFormatSymbols&);
157
163 virtual ~DateFormatSymbols();
164
172 UBool operator==(const DateFormatSymbols& other) const;
173
181 UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
182
190 const UnicodeString* getEras(int32_t& count) const;
191
198 void setEras(const UnicodeString* eras, int32_t count);
199
207 const UnicodeString* getEraNames(int32_t& count) const;
208
215 void setEraNames(const UnicodeString* eraNames, int32_t count);
216
224 const UnicodeString* getNarrowEras(int32_t& count) const;
225
232 void setNarrowEras(const UnicodeString* narrowEras, int32_t count);
233
240 const UnicodeString* getMonths(int32_t& count) const;
241
249 void setMonths(const UnicodeString* months, int32_t count);
250
258 const UnicodeString* getShortMonths(int32_t& count) const;
259
266 void setShortMonths(const UnicodeString* shortMonths, int32_t count);
267
272 enum DtContextType {
273 FORMAT,
274 STANDALONE,
275 DT_CONTEXT_COUNT
276 };
277
282 enum DtWidthType {
283 ABBREVIATED,
284 WIDE,
285 NARROW,
290 SHORT,
293 DT_WIDTH_COUNT = 4
294 };
295
304 const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
305
315 void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
316
323 const UnicodeString* getWeekdays(int32_t& count) const;
324
325
332 void setWeekdays(const UnicodeString* weekdays, int32_t count);
333
341 const UnicodeString* getShortWeekdays(int32_t& count) const;
342
350 void setShortWeekdays(const UnicodeString* abbrevWeekdays, int32_t count);
351
360 const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
361
370 void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
371
381 const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
382
393 void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
394
401 const UnicodeString* getAmPmStrings(int32_t& count) const;
402
409 void setAmPmStrings(const UnicodeString* ampms, int32_t count);
410
411 #ifndef U_HIDE_DRAFT_API
412
422 const UnicodeString* getYearNames(int32_t& count,
423 DtContextType context, DtWidthType width) const;
424
434 void setYearNames(const UnicodeString* yearNames, int32_t count,
435 DtContextType context, DtWidthType width);
436
447 const UnicodeString* getZodiacNames(int32_t& count,
448 DtContextType context, DtWidthType width) const;
449
459 void setZodiacNames(const UnicodeString* zodiacNames, int32_t count,
460 DtContextType context, DtWidthType width);
461
462 #endif /* U_HIDE_DRAFT_API */
463
464 #ifndef U_HIDE_INTERNAL_API
465
473 enum EMonthPatternType
474 {
475 kLeapMonthPatternFormatWide,
476 kLeapMonthPatternFormatAbbrev,
477 kLeapMonthPatternFormatNarrow,
478 kLeapMonthPatternStandaloneWide,
479 kLeapMonthPatternStandaloneAbbrev,
480 kLeapMonthPatternStandaloneNarrow,
481 kLeapMonthPatternNumeric,
482 kMonthPatternsCount
483 };
484
497 const UnicodeString* getLeapMonthPatterns(int32_t& count) const;
498
499 #endif /* U_HIDE_INTERNAL_API */
500
501 #ifndef U_HIDE_DEPRECATED_API
502
509 const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
510 #endif /* U_HIDE_DEPRECATED_API */
511
523 void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
524
530 static const UChar * U_EXPORT2 getPatternUChars(void);
531
542 UnicodeString& getLocalPatternChars(UnicodeString& result) const;
543
550 void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
551
557 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
558
559 /* The following type and kCapContextUsageTypeCount cannot be #ifndef U_HIDE_INTERNAL_API,
560 they are needed for .h file declarations. */
565 enum ECapitalizationContextUsageType
566 {
567 #ifndef U_HIDE_INTERNAL_API
568 kCapContextUsageOther = 0,
569 kCapContextUsageMonthFormat, /* except narrow */
570 kCapContextUsageMonthStandalone, /* except narrow */
571 kCapContextUsageMonthNarrow,
572 kCapContextUsageDayFormat, /* except narrow */
573 kCapContextUsageDayStandalone, /* except narrow */
574 kCapContextUsageDayNarrow,
575 kCapContextUsageEraWide,
576 kCapContextUsageEraAbbrev,
577 kCapContextUsageEraNarrow,
578 kCapContextUsageZoneLong,
579 kCapContextUsageZoneShort,
580 kCapContextUsageMetazoneLong,
581 kCapContextUsageMetazoneShort,
582 #endif /* U_HIDE_INTERNAL_API */
583 kCapContextUsageTypeCount = 14
584 };
585
591 virtual UClassID getDynamicClassID() const;
592
598 static UClassID U_EXPORT2 getStaticClassID();
599
600 private:
601
602 friend class SimpleDateFormat;
603 friend class DateFormatSymbolsSingleSetter; // see udat.cpp
604
608 UnicodeString* fEras;
609 int32_t fErasCount;
610
614 UnicodeString* fEraNames;
615 int32_t fEraNamesCount;
616
620 UnicodeString* fNarrowEras;
621 int32_t fNarrowErasCount;
622
626 UnicodeString* fMonths;
627 int32_t fMonthsCount;
628
632 UnicodeString* fShortMonths;
633 int32_t fShortMonthsCount;
634
638 UnicodeString* fNarrowMonths;
639 int32_t fNarrowMonthsCount;
640
644 UnicodeString* fStandaloneMonths;
645 int32_t fStandaloneMonthsCount;
646
650 UnicodeString* fStandaloneShortMonths;
651 int32_t fStandaloneShortMonthsCount;
652
656 UnicodeString* fStandaloneNarrowMonths;
657 int32_t fStandaloneNarrowMonthsCount;
658
662 UnicodeString* fWeekdays;
663 int32_t fWeekdaysCount;
664
668 UnicodeString* fShortWeekdays;
669 int32_t fShortWeekdaysCount;
670
674 UnicodeString* fShorterWeekdays;
675 int32_t fShorterWeekdaysCount;
676
680 UnicodeString* fNarrowWeekdays;
681 int32_t fNarrowWeekdaysCount;
682
686 UnicodeString* fStandaloneWeekdays;
687 int32_t fStandaloneWeekdaysCount;
688
692 UnicodeString* fStandaloneShortWeekdays;
693 int32_t fStandaloneShortWeekdaysCount;
694
698 UnicodeString* fStandaloneShorterWeekdays;
699 int32_t fStandaloneShorterWeekdaysCount;
700
704 UnicodeString* fStandaloneNarrowWeekdays;
705 int32_t fStandaloneNarrowWeekdaysCount;
706
710 UnicodeString* fAmPms;
711 int32_t fAmPmsCount;
712
716 UnicodeString *fQuarters;
717 int32_t fQuartersCount;
718
722 UnicodeString *fShortQuarters;
723 int32_t fShortQuartersCount;
724
728 UnicodeString *fStandaloneQuarters;
729 int32_t fStandaloneQuartersCount;
730
734 UnicodeString *fStandaloneShortQuarters;
735 int32_t fStandaloneShortQuartersCount;
736
740 UnicodeString *fLeapMonthPatterns;
741 int32_t fLeapMonthPatternsCount;
742
748 UnicodeString *fShortYearNames;
749 int32_t fShortYearNamesCount;
750
756 UnicodeString *fShortZodiacNames;
757 int32_t fShortZodiacNamesCount;
758
796 UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings
797 UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale
798 int32_t fZoneStringsRowCount;
799 int32_t fZoneStringsColCount;
800
801 Locale fZSFLocale; // Locale used for getting ZoneStringFormat
802
806 UnicodeString fLocalPatternChars;
807
813 UBool fCapitalization[kCapContextUsageTypeCount][2];
814
815 private:
819 char validLocale[ULOC_FULLNAME_CAPACITY];
820 char actualLocale[ULOC_FULLNAME_CAPACITY];
821
822 DateFormatSymbols(); // default constructor not implemented
823
833 void initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
834
843 static void assignArray(UnicodeString*& dstArray,
844 int32_t& dstCount,
845 const UnicodeString* srcArray,
846 int32_t srcCount);
847
858 static UBool arrayCompare(const UnicodeString* array1,
859 const UnicodeString* array2,
860 int32_t count);
861
867 void createZoneStrings(const UnicodeString *const * otherStrings);
868
872 void dispose(void);
873
878 void copyData(const DateFormatSymbols& other);
879
883 void initZoneStringsArray(void);
884
888 void disposeZoneStrings(void);
889
894 static UDateFormatField U_EXPORT2 getPatternCharIndex(UChar c);
895
899 static UBool U_EXPORT2 isNumericField(UDateFormatField f, int32_t count);
900
904 static UBool U_EXPORT2 isNumericPatternChar(UChar c, int32_t count);
905 };
906
907 U_NAMESPACE_END
908
909 #endif /* #if !UCONFIG_NO_FORMATTING */
910
911 #endif // _DTFMTSYM
912 //eof