Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

dtfmtsym.h

00001 /*  
00002 ********************************************************************************
00003 *   Copyright (C) 1997-2003, 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 
00071 class U_I18N_API DateFormatSymbols : public UObject {
00072 public:
00086     DateFormatSymbols(UErrorCode& status);
00087 
00098     DateFormatSymbols(const Locale& locale,
00099                       UErrorCode& status);
00100 
00117     DateFormatSymbols(const char *type, UErrorCode& status);
00118 
00132     DateFormatSymbols(const Locale& locale,
00133                       const char *type,
00134                       UErrorCode& status);
00135 
00140     DateFormatSymbols(const DateFormatSymbols&);
00141 
00146     DateFormatSymbols& operator=(const DateFormatSymbols&);
00147 
00153     ~DateFormatSymbols();
00154 
00162     UBool operator==(const DateFormatSymbols& other) const;
00163 
00171     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00172 
00180     const UnicodeString* getEras(int32_t& count) const;
00181 
00188     void setEras(const UnicodeString* eras, int32_t count);
00189 
00196     const UnicodeString* getMonths(int32_t& count) const;
00197 
00205     void setMonths(const UnicodeString* months, int32_t count);
00206 
00214     const UnicodeString* getShortMonths(int32_t& count) const;
00215 
00222     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00223 
00230     const UnicodeString* getWeekdays(int32_t& count) const;
00231 
00238     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00239 
00246     const UnicodeString* getShortWeekdays(int32_t& count) const;
00247 
00254     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00255 
00262     const UnicodeString* getAmPmStrings(int32_t& count) const;
00263 
00270     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00271 
00279     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00280 
00288     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00289 
00295     static const UChar *getPatternUChars(void);
00296 
00303     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00304 
00311     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00312 
00318     virtual inline UClassID getDynamicClassID() const;
00319 
00325     static inline UClassID getStaticClassID();
00326 
00327 private:
00331     static const char fgErasTag[];   // resource bundle tag for era names
00332     static const char fgMonthNamesTag[]; // resource bundle tag for month names
00333     static const char fgMonthAbbreviationsTag[]; // resource bundle tag for month abbreviations
00334     static const char fgDayNamesTag[];   // resource bundle tag for day names
00335     static const char fgDayAbbreviationsTag[];   // resource bundle tag for day abbreviations
00336     static const char fgAmPmMarkersTag[];    // resource bundle tag for AM/PM strings
00337 
00338     static const char fgZoneStringsTag[];    // resource bundle tag for time zone names
00339     static const char fgLocalPatternCharsTag[];  // resource bundle tag for localized pattern characters
00340 
00341     friend class SimpleDateFormat;
00342     friend class DateFormatSymbolsSingleSetter; // see udat.cpp
00343 
00347     UnicodeString*  fEras;
00348     int32_t         fErasCount;
00349 
00353     UnicodeString*  fMonths;
00354     int32_t         fMonthsCount;
00355 
00359     UnicodeString*  fShortMonths;
00360     int32_t         fShortMonthsCount;
00361 
00365     UnicodeString*  fWeekdays;
00366     int32_t         fWeekdaysCount;
00367 
00371     UnicodeString*  fShortWeekdays;
00372     int32_t         fShortWeekdaysCount;
00373 
00377     UnicodeString*  fAmPms;
00378     int32_t         fAmPmsCount;
00379 
00383     UnicodeString** fZoneStrings;
00384     int32_t         fZoneStringsRowCount;
00385     int32_t         fZoneStringsColCount;
00386 
00390     UnicodeString   fLocalPatternChars;
00391 
00396     static const char fgClassID;
00397 
00398 private:
00399 
00400     /* Sizes for the last resort string arrays */
00401     typedef enum LastResortSize {
00402         kMonthNum = 13,
00403         kMonthLen = 3,
00404 
00405         kDayNum = 8,
00406         kDayLen = 2,
00407 
00408         kAmPmNum = 2,
00409         kAmPmLen = 3,
00410 
00411         kEraNum = 2,
00412         kEraLen = 3,
00413 
00414         kZoneNum = 5,
00415         kZoneLen = 4
00416     } LastResortSize;
00417 
00418     DateFormatSymbols(); // default constructor not implemented
00419 
00420     void initField(UnicodeString **field, int32_t& length, const ResourceBundle data, UErrorCode &status);
00421     void initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status);
00422 
00432     static ResourceBundle
00433       getData(ResourceBundle &rb, const char *tag, const char *type, UErrorCode& status);
00434 
00435 
00445     void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
00446 
00455     static void assignArray(UnicodeString*& dstArray,
00456                             int32_t& dstCount,
00457                             const UnicodeString* srcArray,
00458                             int32_t srcCount);
00459 
00470     static UBool arrayCompare(const UnicodeString* array1,
00471                              const UnicodeString* array2,
00472                              int32_t count);
00473 
00479     void createZoneStrings(const UnicodeString *const * otherStrings);
00480 
00491     int32_t getZoneIndex(const UnicodeString& ID) const;
00492 
00493     // Internal method; see source for documentation
00494     int32_t _getZoneIndex(const UnicodeString& id) const;
00495 
00499     void dispose(void);
00500 
00505     void copyData(const DateFormatSymbols& other);
00506 
00510     void disposeZoneStrings(void);
00511 };
00512 
00513 inline UClassID
00514 DateFormatSymbols::getStaticClassID()
00515 { return (UClassID)&fgClassID; }
00516 
00517 inline UClassID
00518 DateFormatSymbols::getDynamicClassID() const
00519 { return DateFormatSymbols::getStaticClassID(); }
00520 
00521 U_NAMESPACE_END
00522 
00523 #endif /* #if !UCONFIG_NO_FORMATTING */
00524 
00525 #endif // _DTFMTSYM
00526 //eof

Generated on Wed Sep 3 17:47:08 2003 for ICU 2.6 by doxygen 1.3.2