dtfmtsym.h

Go to the documentation of this file.
00001 /* 00002 ******************************************************************************** 00003 * Copyright (C) 1997-2004, 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 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; 00319 00325 virtual UClassID getDynamicClassID() const; 00326 00332 static UClassID getStaticClassID(); 00333 00334 private: 00335 00336 friend class SimpleDateFormat; 00337 friend class DateFormatSymbolsSingleSetter; // see udat.cpp 00338 00342 UnicodeString* fEras; 00343 int32_t fErasCount; 00344 00348 UnicodeString* fMonths; 00349 int32_t fMonthsCount; 00350 00354 UnicodeString* fShortMonths; 00355 int32_t fShortMonthsCount; 00356 00360 UnicodeString* fWeekdays; 00361 int32_t fWeekdaysCount; 00362 00366 UnicodeString* fShortWeekdays; 00367 int32_t fShortWeekdaysCount; 00368 00372 UnicodeString* fAmPms; 00373 int32_t fAmPmsCount; 00374 00378 UnicodeString** fZoneStrings; 00379 int32_t fZoneStringsRowCount; 00380 int32_t fZoneStringsColCount; 00381 00385 UnicodeString fLocalPatternChars; 00386 00387 private: 00391 char validLocale[ULOC_FULLNAME_CAPACITY]; 00392 char actualLocale[ULOC_FULLNAME_CAPACITY]; 00393 00394 00395 /* Sizes for the last resort string arrays */ 00396 typedef enum LastResortSize { 00397 kMonthNum = 13, 00398 kMonthLen = 3, 00399 00400 kDayNum = 8, 00401 kDayLen = 2, 00402 00403 kAmPmNum = 2, 00404 kAmPmLen = 3, 00405 00406 kEraNum = 2, 00407 kEraLen = 3, 00408 00409 kZoneNum = 5, 00410 kZoneLen = 4 00411 } LastResortSize; 00412 00413 DateFormatSymbols(); // default constructor not implemented 00414 00415 void initField(UnicodeString **field, int32_t& length, const ResourceBundle &data, UErrorCode &status); 00416 void initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status); 00417 00427 void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE); 00428 00437 static void assignArray(UnicodeString*& dstArray, 00438 int32_t& dstCount, 00439 const UnicodeString* srcArray, 00440 int32_t srcCount); 00441 00452 static UBool arrayCompare(const UnicodeString* array1, 00453 const UnicodeString* array2, 00454 int32_t count); 00455 00461 void createZoneStrings(const UnicodeString *const * otherStrings); 00462 00473 int32_t getZoneIndex(const UnicodeString& ID) const; 00474 00475 // Internal method; see source for documentation 00476 int32_t _getZoneIndex(const UnicodeString& id) const; 00477 00481 void dispose(void); 00482 00487 void copyData(const DateFormatSymbols& other); 00488 00492 void disposeZoneStrings(void); 00493 }; 00494 00495 U_NAMESPACE_END 00496 00497 #endif /* #if !UCONFIG_NO_FORMATTING */ 00498 00499 #endif // _DTFMTSYM 00500 //eof

Generated on Fri Jun 18 12:35:57 2004 for ICU by doxygen 1.3.7