dtitvinf.h

Go to the documentation of this file.
00001 /*
00002  *******************************************************************************
00003  * Copyright (C) 2008-2011, International Business Machines Corporation and
00004  * others. All Rights Reserved.
00005  *******************************************************************************
00006  *
00007  * File DTITVINF.H
00008  *
00009  *******************************************************************************
00010  */
00011 
00012 #ifndef __DTITVINF_H__
00013 #define __DTITVINF_H__
00014 
00015 #include "unicode/utypes.h"
00016 
00022 #if !UCONFIG_NO_FORMATTING
00023 
00024 #include "unicode/udat.h"
00025 #include "unicode/locid.h"
00026 #include "unicode/ucal.h"
00027 #include "unicode/dtptngen.h"
00028 
00029 U_NAMESPACE_BEGIN
00030 
00151 class U_I18N_API DateIntervalInfo : public UObject {
00152 public:
00153 #ifndef U_HIDE_INTERNAL_API
00154 
00167     DateIntervalInfo(UErrorCode& status);
00168 #endif  /* U_HIDE_INTERNAL_API */
00169 
00170 
00178     DateIntervalInfo(const Locale& locale, UErrorCode& status);
00179 
00180 
00185     DateIntervalInfo(const DateIntervalInfo&);
00186 
00191     DateIntervalInfo& operator=(const DateIntervalInfo&);
00192 
00199     virtual DateIntervalInfo* clone(void) const;
00200 
00206     virtual ~DateIntervalInfo();
00207 
00208 
00216     virtual UBool operator==(const DateIntervalInfo& other) const;
00217 
00225     UBool operator!=(const DateIntervalInfo& other) const;
00226 
00227 
00228 
00261     void setIntervalPattern(const UnicodeString& skeleton, 
00262                             UCalendarDateFields lrgDiffCalUnit, 
00263                             const UnicodeString& intervalPattern,
00264                             UErrorCode& status);
00265 
00276     UnicodeString& getIntervalPattern(const UnicodeString& skeleton,
00277                                       UCalendarDateFields field,
00278                                       UnicodeString& result,
00279                                       UErrorCode& status) const; 
00280 
00287     UnicodeString& getFallbackIntervalPattern(UnicodeString& result) const;
00288 
00289 
00303     void setFallbackIntervalPattern(const UnicodeString& fallbackPattern,
00304                                     UErrorCode& status);
00305 
00306 
00313     UBool getDefaultOrder() const;
00314 
00315 
00321     virtual UClassID getDynamicClassID() const;
00322 
00328     static UClassID U_EXPORT2 getStaticClassID();
00329 
00330 
00331 private:
00340     friend class DateIntervalFormat;
00341 
00347     enum IntervalPatternIndex
00348     {
00349         kIPI_ERA,
00350         kIPI_YEAR,
00351         kIPI_MONTH,
00352         kIPI_DATE,
00353         kIPI_AM_PM,
00354         kIPI_HOUR,
00355         kIPI_MINUTE,
00356         kIPI_MAX_INDEX
00357     };
00358 public:
00359 #ifndef U_HIDE_INTERNAL_API
00360 
00364      enum {
00365          kMaxIntervalPatternIndex = kIPI_MAX_INDEX
00366      };
00367 #endif  /* U_HIDE_INTERNAL_API */
00368 private:
00369 
00370 
00377     void initializeData(const Locale& locale, UErrorCode& status);
00378 
00379 
00380     /* Set Interval pattern.
00381      *
00382      * It sets interval pattern into the hash map.
00383      *
00384      * @param skeleton         skeleton on which the interval pattern based
00385      * @param lrgDiffCalUnit   the largest different calendar unit.
00386      * @param intervalPattern  the interval pattern on the largest different
00387      *                         calendar unit.
00388      * @param status           output param set to success/failure code on exit
00389      * @internal ICU 4.0
00390      */
00391     void setIntervalPatternInternally(const UnicodeString& skeleton,
00392                                       UCalendarDateFields lrgDiffCalUnit,
00393                                       const UnicodeString& intervalPattern,
00394                                       UErrorCode& status); 
00395 
00396 
00416     const UnicodeString* getBestSkeleton(const UnicodeString& skeleton,
00417                                          int8_t& bestMatchDistanceInfo) const;
00418 
00419 
00428     static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton, 
00429                                         int32_t* skeletonFieldWidth);
00430 
00431 
00444     static UBool U_EXPORT2 stringNumeric(int32_t fieldWidth,
00445                                          int32_t anotherFieldWidth,
00446                                          char patternLetter);
00447 
00448 
00463     static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex(
00464                                                       UCalendarDateFields field,
00465                                                       UErrorCode& status);
00466 
00467 
00474     void deleteHash(Hashtable* hTable);
00475 
00476 
00484     Hashtable* initHash(UErrorCode& status);
00485 
00486 
00487 
00496     void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
00497 
00498 
00499     // data members
00500     // fallback interval pattern 
00501     UnicodeString fFallbackIntervalPattern;
00502     // default order
00503     UBool fFirstDateInPtnIsLaterDate;
00504 
00505     // HashMap<UnicodeString, UnicodeString[kIPI_MAX_INDEX]>
00506     // HashMap( skeleton, pattern[largest_different_field] )
00507     Hashtable* fIntervalPatterns;
00508 
00509 };// end class DateIntervalInfo
00510 
00511 
00512 inline UBool
00513 DateIntervalInfo::operator!=(const DateIntervalInfo& other) const {
00514     return !operator==(other);
00515 }
00516 
00517 
00518 U_NAMESPACE_END
00519 
00520 #endif
00521 
00522 #endif
00523 

Generated on 27 Oct 2013 for ICU 50.1.2 by  doxygen 1.4.7