Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

dtfmtsym.h

Go to the documentation of this file.
00001 /*  
00002 ********************************************************************************
00003 *   Copyright (C) 1997-2001, 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/uobject.h"
00026 #include "unicode/locid.h"
00027 #include "unicode/resbund.h"
00028 
00029 U_NAMESPACE_BEGIN
00030 
00031 /* forward declaration */
00032 class SimpleDateFormat;
00033 
00064 class U_I18N_API DateFormatSymbols : public UObject {
00065 public:
00079     DateFormatSymbols(UErrorCode& status);
00080 
00091     DateFormatSymbols(const Locale& locale,
00092                       UErrorCode& status);
00093 
00098     DateFormatSymbols(const DateFormatSymbols&);
00099 
00104     DateFormatSymbols& operator=(const DateFormatSymbols&);
00105 
00111     ~DateFormatSymbols();
00112 
00120     UBool operator==(const DateFormatSymbols& other) const;
00121 
00129     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00130 
00138     const UnicodeString* getEras(int32_t& count) const;
00139 
00146     void setEras(const UnicodeString* eras, int32_t count);
00147 
00154     const UnicodeString* getMonths(int32_t& count) const;
00155 
00163     void setMonths(const UnicodeString* months, int32_t count);
00164 
00172     const UnicodeString* getShortMonths(int32_t& count) const;
00173 
00180     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00181 
00188     const UnicodeString* getWeekdays(int32_t& count) const;
00189 
00196     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00197 
00204     const UnicodeString* getShortWeekdays(int32_t& count) const;
00205 
00212     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00213 
00220     const UnicodeString* getAmPmStrings(int32_t& count) const;
00221 
00228     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00229 
00237     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00238 
00246     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00247 
00248 #ifdef ICU_DATEFORMATSYMBOLS_USE_DEPRECATES
00249 
00253     static const UnicodeString& getPatternChars(void);
00254 #endif /* ICU_DATEFORMATSYMBOLS_USE_DEPRECATES */
00255 
00261     static const UChar *getPatternUChars(void);
00262 
00269     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00270 
00277     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00278 
00284     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00285 
00291     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00292 
00293 private:
00297     static const char fgErasTag[];   // resource bundle tag for era names
00298     static const char fgMonthNamesTag[]; // resource bundle tag for month names
00299     static const char fgMonthAbbreviationsTag[]; // resource bundle tag for month abbreviations
00300     static const char fgDayNamesTag[];   // resource bundle tag for day names
00301     static const char fgDayAbbreviationsTag[];   // resource bundle tag for day abbreviations
00302     static const char fgAmPmMarkersTag[];    // resource bundle tag for AM/PM strings
00303 
00304     static const char fgZoneStringsTag[];    // resource bundle tag for time zone names
00305     static const char fgLocalPatternCharsTag[];  // resource bundle tag for localized pattern characters
00306 
00307     friend class SimpleDateFormat;
00308     friend class DateFormatSymbolsSingleSetter; // see udat.cpp
00309 
00313     UnicodeString*  fEras;
00314     int32_t         fErasCount;
00315 
00319     UnicodeString*  fMonths;
00320     int32_t         fMonthsCount;
00321 
00325     UnicodeString*  fShortMonths;
00326     int32_t         fShortMonthsCount;
00327 
00331     UnicodeString*  fWeekdays;
00332     int32_t         fWeekdaysCount;
00333 
00337     UnicodeString*  fShortWeekdays;
00338     int32_t         fShortWeekdaysCount;
00339 
00343     UnicodeString*  fAmPms;
00344     int32_t         fAmPmsCount;
00345 
00349     UnicodeString** fZoneStrings;
00350     int32_t         fZoneStringsRowCount;
00351     int32_t         fZoneStringsColCount;
00352 
00356     UnicodeString   fLocalPatternChars;
00357 
00362     static const char fgClassID;
00363 
00364 private:
00365 
00366     /* Sizes for the last resort string arrays */
00367     typedef enum LastResortSize {
00368         kMonthNum = 13,
00369         kMonthLen = 3,
00370 
00371         kDayNum = 8,
00372         kDayLen = 2,
00373 
00374         kAmPmNum = 2,
00375         kAmPmLen = 3,
00376 
00377         kEraNum = 2,
00378         kEraLen = 3,
00379 
00380         kZoneNum = 5,
00381         kZoneLen = 4
00382     } LastResortSize;
00383 
00384     void initField(UnicodeString **field, int32_t& length, const ResourceBundle data, UErrorCode &status);
00385     void initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status);
00386 
00395     void initializeData(const Locale&, UErrorCode& status, UBool useLastResortData = FALSE);
00396 
00405     static void assignArray(UnicodeString*& dstArray,
00406                             int32_t& dstCount,
00407                             const UnicodeString* srcArray,
00408                             int32_t srcCount);
00409 
00420     static UBool arrayCompare(const UnicodeString* array1,
00421                              const UnicodeString* array2,
00422                              int32_t count);
00423 
00429     void createZoneStrings(const UnicodeString *const * otherStrings);
00430 
00441     int32_t getZoneIndex(const UnicodeString& ID) const;
00442 
00443     // Internal method; see source for documentation
00444     int32_t _getZoneIndex(const UnicodeString& id) const;
00445 
00449     void dispose(void);
00450 
00455     void copyData(const DateFormatSymbols& other);
00456 
00460     void disposeZoneStrings(void);
00461 };
00462 
00463 U_NAMESPACE_END
00464 
00465 #endif /* #if !UCONFIG_NO_FORMATTING */
00466 
00467 #endif // _DTFMTSYM
00468 //eof

Generated on Wed Dec 18 16:49:34 2002 for ICU 2.4 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001