ICU 4.8.1.1  4.8.1.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-2011, 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 
79 public:
94 
105  DateFormatSymbols(const Locale& locale,
106  UErrorCode& status);
107 
124  DateFormatSymbols(const char *type, UErrorCode& status);
125 
139  DateFormatSymbols(const Locale& locale,
140  const char *type,
141  UErrorCode& status);
142 
148 
153  DateFormatSymbols& operator=(const DateFormatSymbols&);
154 
160  virtual ~DateFormatSymbols();
161 
169  UBool operator==(const DateFormatSymbols& other) const;
170 
178  UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
179 
187  const UnicodeString* getEras(int32_t& count) const;
188 
195  void setEras(const UnicodeString* eras, int32_t count);
196 
204  const UnicodeString* getEraNames(int32_t& count) const;
205 
212  void setEraNames(const UnicodeString* eraNames, int32_t count);
213 
221  const UnicodeString* getNarrowEras(int32_t& count) const;
222 
229  void setNarrowEras(const UnicodeString* narrowEras, int32_t count);
230 
237  const UnicodeString* getMonths(int32_t& count) const;
238 
246  void setMonths(const UnicodeString* months, int32_t count);
247 
255  const UnicodeString* getShortMonths(int32_t& count) const;
256 
263  void setShortMonths(const UnicodeString* shortMonths, int32_t count);
264 
270  FORMAT,
271  STANDALONE,
272  DT_CONTEXT_COUNT
273  };
274 
279  enum DtWidthType {
280  ABBREVIATED,
281  WIDE,
282  NARROW,
283  DT_WIDTH_COUNT
284  };
285 
294  const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
295 
305  void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
306 
313  const UnicodeString* getWeekdays(int32_t& count) const;
314 
315 
322  void setWeekdays(const UnicodeString* weekdays, int32_t count);
323 
330  const UnicodeString* getShortWeekdays(int32_t& count) const;
331 
338  void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
339 
348  const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
349 
358  void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
359 
369  const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
370 
381  void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
382 
389  const UnicodeString* getAmPmStrings(int32_t& count) const;
390 
397  void setAmPmStrings(const UnicodeString* ampms, int32_t count);
398 
406  const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
407 
419  void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
420 
426  static const UChar * U_EXPORT2 getPatternUChars(void);
427 
438  UnicodeString& getLocalPatternChars(UnicodeString& result) const;
439 
446  void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
447 
453  Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
454 
460  virtual UClassID getDynamicClassID() const;
461 
467  static UClassID U_EXPORT2 getStaticClassID();
468 
469 private:
470 
471  friend class SimpleDateFormat;
472  friend class DateFormatSymbolsSingleSetter; // see udat.cpp
473 
477  UnicodeString* fEras;
478  int32_t fErasCount;
479 
483  UnicodeString* fEraNames;
484  int32_t fEraNamesCount;
485 
489  UnicodeString* fNarrowEras;
490  int32_t fNarrowErasCount;
491 
495  UnicodeString* fMonths;
496  int32_t fMonthsCount;
497 
501  UnicodeString* fShortMonths;
502  int32_t fShortMonthsCount;
503 
507  UnicodeString* fNarrowMonths;
508  int32_t fNarrowMonthsCount;
509 
513  UnicodeString* fStandaloneMonths;
514  int32_t fStandaloneMonthsCount;
515 
519  UnicodeString* fStandaloneShortMonths;
520  int32_t fStandaloneShortMonthsCount;
521 
525  UnicodeString* fStandaloneNarrowMonths;
526  int32_t fStandaloneNarrowMonthsCount;
527 
531  UnicodeString* fWeekdays;
532  int32_t fWeekdaysCount;
533 
537  UnicodeString* fShortWeekdays;
538  int32_t fShortWeekdaysCount;
539 
543  UnicodeString* fNarrowWeekdays;
544  int32_t fNarrowWeekdaysCount;
545 
549  UnicodeString* fStandaloneWeekdays;
550  int32_t fStandaloneWeekdaysCount;
551 
555  UnicodeString* fStandaloneShortWeekdays;
556  int32_t fStandaloneShortWeekdaysCount;
557 
561  UnicodeString* fStandaloneNarrowWeekdays;
562  int32_t fStandaloneNarrowWeekdaysCount;
563 
567  UnicodeString* fAmPms;
568  int32_t fAmPmsCount;
569 
573  UnicodeString *fQuarters;
574  int32_t fQuartersCount;
575 
579  UnicodeString *fShortQuarters;
580  int32_t fShortQuartersCount;
581 
585  UnicodeString *fStandaloneQuarters;
586  int32_t fStandaloneQuartersCount;
587 
591  UnicodeString *fStandaloneShortQuarters;
592  int32_t fStandaloneShortQuartersCount;
593 
631  UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings
632  UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale
633  int32_t fZoneStringsRowCount;
634  int32_t fZoneStringsColCount;
635 
636  Locale fZSFLocale; // Locale used for getting ZoneStringFormat
637 
641  UnicodeString fGmtZero;
642 
646  UnicodeString fGmtFormat;
647 
651  UnicodeString *fGmtHourFormats;
652  int32_t fGmtHourFormatsCount;
653 
654  enum GMTHourType {
655  GMT_NEGATIVE_HMS = 0,
656  GMT_NEGATIVE_HM,
657  GMT_POSITIVE_HMS,
658  GMT_POSITIVE_HM,
659  GMT_HOUR_COUNT
660  };
661 
665  UnicodeString fLocalPatternChars;
666 
667 private:
671  char validLocale[ULOC_FULLNAME_CAPACITY];
672  char actualLocale[ULOC_FULLNAME_CAPACITY];
673 
674  DateFormatSymbols(); // default constructor not implemented
675 
685  void initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
686 
695  static void assignArray(UnicodeString*& dstArray,
696  int32_t& dstCount,
697  const UnicodeString* srcArray,
698  int32_t srcCount);
699 
710  static UBool arrayCompare(const UnicodeString* array1,
711  const UnicodeString* array2,
712  int32_t count);
713 
719  void createZoneStrings(const UnicodeString *const * otherStrings);
720 
724  void dispose(void);
725 
730  void copyData(const DateFormatSymbols& other);
731 
735  void initZoneStringsArray(void);
736 
740  void disposeZoneStrings(void);
741 };
742 
744 
745 #endif /* #if !UCONFIG_NO_FORMATTING */
746 
747 #endif // _DTFMTSYM
748 //eof
UBool operator!=(const DateFormatSymbols &other) const
Return true if another object is semantically unequal to this one.
Definition: dtfmtsym.h:178
SimpleDateFormat is a concrete class for formatting and parsing dates in a language-independent manne...
Definition: smpdtfmt.h:216
#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
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:521
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
C++ API: Calendar object.
DtWidthType
Selector for date formatting width.
Definition: dtfmtsym.h:279
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:188
#define U_EXPORT2
Definition: platform.h:314
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:325
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:215
void * UClassID
UClassID is used to identify classes without using RTTI, since RTTI is not yet supported by all C++ c...
Definition: utypes.h:385
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:639
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:336
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:236
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:78
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
DtContextType
Selector for date formatting context.
Definition: dtfmtsym.h:269
C API: Resource Bundle.
int8_t UBool
The ICU boolean type.
Definition: umachine.h:228