ICU 4.2.1
 All Data Structures 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-2008, 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 
36 
37 /* forward declaration */
38 class SimpleDateFormat;
39 class Hashtable;
40 class ZoneStringFormat;
41 class SafeZoneStringFormatPtr;
42 
81 public:
96 
107  DateFormatSymbols(const Locale& locale,
108  UErrorCode& status);
109 
126  DateFormatSymbols(const char *type, UErrorCode& status);
127 
141  DateFormatSymbols(const Locale& locale,
142  const char *type,
143  UErrorCode& status);
144 
150 
155  DateFormatSymbols& operator=(const DateFormatSymbols&);
156 
162  virtual ~DateFormatSymbols();
163 
171  UBool operator==(const DateFormatSymbols& other) const;
172 
180  UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
181 
189  const UnicodeString* getEras(int32_t& count) const;
190 
197  void setEras(const UnicodeString* eras, int32_t count);
198 
206  const UnicodeString* getEraNames(int32_t& count) const;
207 
214  void setEraNames(const UnicodeString* eraNames, int32_t count);
215 
223  const UnicodeString* getNarrowEras(int32_t& count) const;
224 
231  void setNarrowEras(const UnicodeString* narrowEras, int32_t count);
232 
239  const UnicodeString* getMonths(int32_t& count) const;
240 
248  void setMonths(const UnicodeString* months, int32_t count);
249 
257  const UnicodeString* getShortMonths(int32_t& count) const;
258 
265  void setShortMonths(const UnicodeString* shortMonths, int32_t count);
266 
272  FORMAT,
273  STANDALONE,
274  DT_CONTEXT_COUNT
275  };
276 
281  enum DtWidthType {
282  ABBREVIATED,
283  WIDE,
284  NARROW,
285  DT_WIDTH_COUNT
286  };
287 
296  const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
297 
307  void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
308 
315  const UnicodeString* getWeekdays(int32_t& count) const;
316 
317 
324  void setWeekdays(const UnicodeString* weekdays, int32_t count);
325 
332  const UnicodeString* getShortWeekdays(int32_t& count) const;
333 
340  void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
341 
350  const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
351 
360  void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
361 
371  const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
372 
383  void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
384 
391  const UnicodeString* getAmPmStrings(int32_t& count) const;
392 
399  void setAmPmStrings(const UnicodeString* ampms, int32_t count);
400 
408  const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
409 
417  void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
418 
424  static const UChar * U_EXPORT2 getPatternUChars(void);
425 
436  UnicodeString& getLocalPatternChars(UnicodeString& result) const;
437 
444  void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
445 
451  Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
452 
458  virtual UClassID getDynamicClassID() const;
459 
465  static UClassID U_EXPORT2 getStaticClassID();
466 
467 private:
468 
469  friend class SimpleDateFormat;
470  friend class DateFormatSymbolsSingleSetter; // see udat.cpp
471 
475  UnicodeString* fEras;
476  int32_t fErasCount;
477 
481  UnicodeString* fEraNames;
482  int32_t fEraNamesCount;
483 
487  UnicodeString* fNarrowEras;
488  int32_t fNarrowErasCount;
489 
493  UnicodeString* fMonths;
494  int32_t fMonthsCount;
495 
499  UnicodeString* fShortMonths;
500  int32_t fShortMonthsCount;
501 
505  UnicodeString* fNarrowMonths;
506  int32_t fNarrowMonthsCount;
507 
511  UnicodeString* fStandaloneMonths;
512  int32_t fStandaloneMonthsCount;
513 
517  UnicodeString* fStandaloneShortMonths;
518  int32_t fStandaloneShortMonthsCount;
519 
523  UnicodeString* fStandaloneNarrowMonths;
524  int32_t fStandaloneNarrowMonthsCount;
525 
529  UnicodeString* fWeekdays;
530  int32_t fWeekdaysCount;
531 
535  UnicodeString* fShortWeekdays;
536  int32_t fShortWeekdaysCount;
537 
541  UnicodeString* fNarrowWeekdays;
542  int32_t fNarrowWeekdaysCount;
543 
547  UnicodeString* fStandaloneWeekdays;
548  int32_t fStandaloneWeekdaysCount;
549 
553  UnicodeString* fStandaloneShortWeekdays;
554  int32_t fStandaloneShortWeekdaysCount;
555 
559  UnicodeString* fStandaloneNarrowWeekdays;
560  int32_t fStandaloneNarrowWeekdaysCount;
561 
565  UnicodeString* fAmPms;
566  int32_t fAmPmsCount;
567 
571  UnicodeString *fQuarters;
572  int32_t fQuartersCount;
573 
577  UnicodeString *fShortQuarters;
578  int32_t fShortQuartersCount;
579 
583  UnicodeString *fStandaloneQuarters;
584  int32_t fStandaloneQuartersCount;
585 
589  UnicodeString *fStandaloneShortQuarters;
590  int32_t fStandaloneShortQuartersCount;
591 
595  UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings
596  UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale
597  int32_t fZoneStringsRowCount;
598  int32_t fZoneStringsColCount;
599 
600  const ZoneStringFormat *fZoneStringFormat;
601  ZoneStringFormat *fZSFLocal; // Local ZoneStringFormat instance
602  SafeZoneStringFormatPtr *fZSFCachePtr; // Cached ZoneStringFormat
603  Locale fZSFLocale; // Locale used for getting ZoneStringFormat
604 
608  UnicodeString fGmtFormat;
609 
613  UnicodeString *fGmtHourFormats;
614  int32_t fGmtHourFormatsCount;
615 
616  enum GMTHourType {
617  GMT_NEGATIVE_HMS = 0,
618  GMT_NEGATIVE_HM,
619  GMT_POSITIVE_HMS,
620  GMT_POSITIVE_HM,
621  GMT_HOUR_COUNT
622  };
623 
627  UnicodeString fLocalPatternChars;
628 
629 private:
633  char validLocale[ULOC_FULLNAME_CAPACITY];
634  char actualLocale[ULOC_FULLNAME_CAPACITY];
635 
636  DateFormatSymbols(); // default constructor not implemented
637 
647  void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
648 
657  static void assignArray(UnicodeString*& dstArray,
658  int32_t& dstCount,
659  const UnicodeString* srcArray,
660  int32_t srcCount);
661 
672  static UBool arrayCompare(const UnicodeString* array1,
673  const UnicodeString* array2,
674  int32_t count);
675 
681  void createZoneStrings(const UnicodeString *const * otherStrings);
682 
686  void dispose(void);
687 
692  void copyData(const DateFormatSymbols& other);
693 
694 
698  const ZoneStringFormat* getZoneStringFormat(void) const;
699 
703  void initZoneStringFormat(void);
704 
708  void initZoneStringsArray(void);
709 
713  void disposeZoneStrings(void);
714 };
715 
717 
718 #endif /* #if !UCONFIG_NO_FORMATTING */
719 
720 #endif // _DTFMTSYM
721 //eof
UBool operator!=(const DateFormatSymbols &other) const
Return true if another object is semantically unequal to this one.
Definition: dtfmtsym.h:180
SimpleDateFormat is a concrete class for formatting and parsing dates in a language-independent manne...
Definition: smpdtfmt.h:213
#define ULOC_FULLNAME_CAPACITY
Useful constant for the maximum size of the whole locale ID (including the terminating NULL and all k...
Definition: uloc.h:262
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:475
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:183
C++ API: Calendar object.
DtWidthType
Selector for date formatting width.
Definition: dtfmtsym.h:281
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:187
#define U_EXPORT2
Definition: platform.h:338
C++ API: Common ICU base class UObject.
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:299
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API If the compiler doesn't support namespaces...
Definition: uversion.h:184
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:212
void * UClassID
UClassID is used to identify classes without using RTTI, since RTTI is not yet supported by all C++ c...
Definition: utypes.h:339
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:593
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:314
C++ API: Locale ID object.
Basic definitions for ICU, for both C and C++ APIs.
#define FALSE
The FALSE value of a UBool.
Definition: umachine.h:216
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:181
DateFormatSymbols is a public class for encapsulating localizable date-time formatting data – includi...
Definition: dtfmtsym.h:80
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
DtContextType
Selector for date formatting context.
Definition: dtfmtsym.h:271
C API: Resource Bundle.
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208