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

- Search for |

- File List
- Globals

# dtfmtsym.h

Go to the documentation of this file.

    00001 /*
    00002 ********************************************************************************
    00003 *   Copyright (C) 1997-2008, International Business Machines
    00004 *   Corporation and others.  All Rights Reserved.
    00005 ********************************************************************************
    00006 *
    00007 * File DTFMTSYM.H
    00008 *
    00009 * Modification History:
    00010 *
    00011 *   Date        Name        Description
    00012 *   02/19/97    aliu        Converted from java.
    00013 *    07/21/98    stephen        Added getZoneIndex()
    00014 *                            Changed to match C++ conventions
    00015 ********************************************************************************
    00016 */
    00017
    00018 #ifndef DTFMTSYM_H
    00019 #define DTFMTSYM_H
    00020
    00021 #include "unicode/utypes.h"
    00022
    00023 #if !UCONFIG_NO_FORMATTING
    00024
    00025 #include "unicode/calendar.h"
    00026 #include "unicode/uobject.h"
    00027 #include "unicode/locid.h"
    00028 #include "unicode/ures.h"
    00029
    00035 U_NAMESPACE_BEGIN
    00036
    00037 /* forward declaration */
    00038 class SimpleDateFormat;
    00039 class Hashtable;
    00040 class ZoneStringFormat;
    00041 class SafeZoneStringFormatPtr;
    00042
    00080 class U_I18N_API DateFormatSymbols : public UObject {
    00081 public:
    00095     DateFormatSymbols(UErrorCode& status);
    00096
    00107     DateFormatSymbols(const Locale& locale,
    00108                       UErrorCode& status);
    00109
    00126     DateFormatSymbols(const char *type, UErrorCode& status);
    00127
    00141     DateFormatSymbols(const Locale& locale,
    00142                       const char *type,
    00143                       UErrorCode& status);
    00144
    00149     DateFormatSymbols(const DateFormatSymbols&);
    00150
    00155     DateFormatSymbols& operator=(const DateFormatSymbols&);
    00156
    00162     virtual ~DateFormatSymbols();
    00163
    00171     UBool operator==(const DateFormatSymbols& other) const;
    00172
    00180     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
    00181
    00189     const UnicodeString* getEras(int32_t& count) const;
    00190
    00197     void setEras(const UnicodeString* eras, int32_t count);
    00198
    00206     const UnicodeString* getEraNames(int32_t& count) const;
    00207
    00214     void setEraNames(const UnicodeString* eraNames, int32_t count);
    00215
    00223     const UnicodeString* getNarrowEras(int32_t& count) const;
    00224
    00231     void setNarrowEras(const UnicodeString* narrowEras, int32_t count);
    00232
    00239     const UnicodeString* getMonths(int32_t& count) const;
    00240
    00248     void setMonths(const UnicodeString* months, int32_t count);
    00249
    00257     const UnicodeString* getShortMonths(int32_t& count) const;
    00258
    00265     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
    00266
    00271     enum DtContextType {
    00272          FORMAT,
    00273          STANDALONE,
    00274          DT_CONTEXT_COUNT
    00275     };
    00276
    00281     enum DtWidthType {
    00282          ABBREVIATED,
    00283          WIDE,
    00284          NARROW,
    00285          DT_WIDTH_COUNT
    00286     };
    00287
    00296     const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
    00297
    00307     void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
    00308
    00315     const UnicodeString* getWeekdays(int32_t& count) const;
    00316
    00317
    00324     void setWeekdays(const UnicodeString* weekdays, int32_t count);
    00325
    00332     const UnicodeString* getShortWeekdays(int32_t& count) const;
    00333
    00340     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
    00341
    00350     const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
    00351
    00360     void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
    00361
    00371     const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
    00372
    00383     void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
    00384
    00391     const UnicodeString* getAmPmStrings(int32_t& count) const;
    00392
    00399     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
    00400
    00408     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
    00409
    00417     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
    00418
    00424     static const UChar * U_EXPORT2 getPatternUChars(void);
    00425
    00436     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
    00437
    00444     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
    00445
    00451     Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
    00452
    00458     virtual UClassID getDynamicClassID() const;
    00459
    00465     static UClassID U_EXPORT2 getStaticClassID();
    00466
    00467 private:
    00468
    00469     friend class SimpleDateFormat;
    00470     friend class DateFormatSymbolsSingleSetter; // see udat.cpp
    00471
    00475     UnicodeString*  fEras;
    00476     int32_t         fErasCount;
    00477
    00481     UnicodeString*  fEraNames;
    00482     int32_t         fEraNamesCount;
    00483
    00487     UnicodeString*  fNarrowEras;
    00488     int32_t         fNarrowErasCount;
    00489
    00493     UnicodeString*  fMonths;
    00494     int32_t         fMonthsCount;
    00495
    00499     UnicodeString*  fShortMonths;
    00500     int32_t         fShortMonthsCount;
    00501
    00505     UnicodeString*  fNarrowMonths;
    00506     int32_t         fNarrowMonthsCount;
    00507
    00511     UnicodeString*  fStandaloneMonths;
    00512     int32_t         fStandaloneMonthsCount;
    00513
    00517     UnicodeString*  fStandaloneShortMonths;
    00518     int32_t         fStandaloneShortMonthsCount;
    00519
    00523     UnicodeString*  fStandaloneNarrowMonths;
    00524     int32_t         fStandaloneNarrowMonthsCount;
    00525
    00529     UnicodeString*  fWeekdays;
    00530     int32_t         fWeekdaysCount;
    00531
    00535     UnicodeString*  fShortWeekdays;
    00536     int32_t         fShortWeekdaysCount;
    00537
    00541     UnicodeString*  fNarrowWeekdays;
    00542     int32_t         fNarrowWeekdaysCount;
    00543
    00547     UnicodeString*  fStandaloneWeekdays;
    00548     int32_t         fStandaloneWeekdaysCount;
    00549
    00553     UnicodeString*  fStandaloneShortWeekdays;
    00554     int32_t         fStandaloneShortWeekdaysCount;
    00555
    00559     UnicodeString*  fStandaloneNarrowWeekdays;
    00560     int32_t         fStandaloneNarrowWeekdaysCount;
    00561
    00565     UnicodeString*  fAmPms;
    00566     int32_t         fAmPmsCount;
    00567
    00571     UnicodeString  *fQuarters;
    00572     int32_t         fQuartersCount;
    00573
    00577     UnicodeString  *fShortQuarters;
    00578     int32_t         fShortQuartersCount;
    00579
    00583     UnicodeString  *fStandaloneQuarters;
    00584     int32_t         fStandaloneQuartersCount;
    00585
    00589     UnicodeString  *fStandaloneShortQuarters;
    00590     int32_t         fStandaloneShortQuartersCount;
    00591
    00595     UnicodeString   **fZoneStrings;         // Zone string array set by setZoneStrings
    00596     UnicodeString   **fLocaleZoneStrings;   // Zone string array created by the locale
    00597     int32_t         fZoneStringsRowCount;
    00598     int32_t         fZoneStringsColCount;
    00599
    00600     const ZoneStringFormat  *fZoneStringFormat;
    00601     ZoneStringFormat        *fZSFLocal;         // Local ZoneStringFormat instance
    00602     SafeZoneStringFormatPtr *fZSFCachePtr;      // Cached ZoneStringFormat
    00603     Locale                  fZSFLocale;         // Locale used for getting ZoneStringFormat
    00604
    00608     UnicodeString   fGmtFormat;
    00609
    00613     UnicodeString  *fGmtHourFormats;
    00614     int32_t         fGmtHourFormatsCount;
    00615
    00616     enum GMTHourType {
    00617         GMT_NEGATIVE_HMS = 0,
    00618         GMT_NEGATIVE_HM,
    00619         GMT_POSITIVE_HMS,
    00620         GMT_POSITIVE_HM,
    00621         GMT_HOUR_COUNT
    00622     };
    00623
    00627     UnicodeString   fLocalPatternChars;
    00628
    00629 private:
    00633     char validLocale[ULOC_FULLNAME_CAPACITY];
    00634     char actualLocale[ULOC_FULLNAME_CAPACITY];
    00635
    00636     DateFormatSymbols(); // default constructor not implemented
    00637
    00647     void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
    00648
    00657     static void assignArray(UnicodeString*& dstArray,
    00658                             int32_t& dstCount,
    00659                             const UnicodeString* srcArray,
    00660                             int32_t srcCount);
    00661
    00672     static UBool arrayCompare(const UnicodeString* array1,
    00673                              const UnicodeString* array2,
    00674                              int32_t count);
    00675
    00681     void createZoneStrings(const UnicodeString *const * otherStrings);
    00682
    00686     void dispose(void);
    00687
    00692     void copyData(const DateFormatSymbols& other);
    00693
    00694
    00698     const ZoneStringFormat* getZoneStringFormat(void) const;
    00699
    00703     void initZoneStringFormat(void);
    00704
    00708     void initZoneStringsArray(void);
    00709
    00713     void disposeZoneStrings(void);
    00714 };
    00715
    00716 U_NAMESPACE_END
    00717
    00718 #endif /* #if !UCONFIG_NO_FORMATTING */
    00719
    00720 #endif // _DTFMTSYM
    00721 //eof