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

- Search for |

- File List
- Globals

# dtitvinf.h

Go to the documentation of this file.

    00001 /*
    00002  *******************************************************************************
    00003  * Copyright (C) 2008-2009, 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 //#include "dtitv_impl.h"
    00029
    00034 union UHashTok;
    00035
    00036
    00037 U_NAMESPACE_BEGIN
    00038
    00039 U_CDECL_BEGIN
    00040
    00044 UBool U_CALLCONV dtitvinfHashTableValueComparator(UHashTok val1, UHashTok val2) ;
    00045
    00046 U_CDECL_END
    00047
    00048
    00168 class U_I18N_API DateIntervalInfo : public UObject {
    00169 public:
    00183     DateIntervalInfo(UErrorCode& status);
    00184
    00185
    00193     DateIntervalInfo(const Locale& locale, UErrorCode& status);
    00194
    00195
    00200     DateIntervalInfo(const DateIntervalInfo&);
    00201
    00206     DateIntervalInfo& operator=(const DateIntervalInfo&);
    00207
    00214     virtual DateIntervalInfo* clone(void) const;
    00215
    00221     virtual ~DateIntervalInfo();
    00222
    00223
    00231     virtual UBool operator==(const DateIntervalInfo& other) const;
    00232
    00240     UBool operator!=(const DateIntervalInfo& other) const;
    00241
    00242
    00243
    00276     void setIntervalPattern(const UnicodeString& skeleton,
    00277                             UCalendarDateFields lrgDiffCalUnit,
    00278                             const UnicodeString& intervalPattern,
    00279                             UErrorCode& status);
    00280
    00291     UnicodeString& getIntervalPattern(const UnicodeString& skeleton,
    00292                                       UCalendarDateFields field,
    00293                                       UnicodeString& result,
    00294                                       UErrorCode& status) const;
    00295
    00302     UnicodeString& getFallbackIntervalPattern(UnicodeString& result) const;
    00303
    00304
    00318     void setFallbackIntervalPattern(const UnicodeString& fallbackPattern,
    00319                                     UErrorCode& status);
    00320
    00321
    00328     UBool getDefaultOrder() const;
    00329
    00330
    00336     virtual UClassID getDynamicClassID() const;
    00337
    00343     static UClassID U_EXPORT2 getStaticClassID();
    00344
    00345
    00346 private:
    00355     friend class DateIntervalFormat;
    00356
    00357     friend UBool U_CALLCONV dtitvinfHashTableValueComparator(UHashTok val1, UHashTok val2) ;
    00358
    00364     enum IntervalPatternIndex
    00365     {
    00366         kIPI_ERA,
    00367         kIPI_YEAR,
    00368         kIPI_MONTH,
    00369         kIPI_DATE,
    00370         kIPI_AM_PM,
    00371         kIPI_HOUR,
    00372         kIPI_MINUTE,
    00373         kIPI_MAX_INDEX
    00374     };
    00375
    00382     void initializeData(const Locale& locale, UErrorCode& status);
    00383
    00384
    00385     /* Set Interval pattern.
    00386      *
    00387      * It sets interval pattern into the hash map.
    00388      *
    00389      * @param skeleton         skeleton on which the interval pattern based
    00390      * @param lrgDiffCalUnit   the largest different calendar unit.
    00391      * @param intervalPattern  the interval pattern on the largest different
    00392      *                         calendar unit.
    00393      * @param status           output param set to success/failure code on exit
    00394      * @internal ICU 4.0
    00395      */
    00396     void setIntervalPatternInternally(const UnicodeString& skeleton,
    00397                                       UCalendarDateFields lrgDiffCalUnit,
    00398                                       const UnicodeString& intervalPattern,
    00399                                       UErrorCode& status);
    00400
    00401
    00421     const UnicodeString* getBestSkeleton(const UnicodeString& skeleton,
    00422                                          int8_t& bestMatchDistanceInfo) const;
    00423
    00424
    00433     static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton,
    00434                                         int32_t* skeletonFieldWidth);
    00435
    00436
    00449     static UBool U_EXPORT2 stringNumeric(int32_t fieldWidth,
    00450                                          int32_t anotherFieldWidth,
    00451                                          char patternLetter);
    00452
    00453
    00468     static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex(
    00469                                                       UCalendarDateFields field,
    00470                                                       UErrorCode& status);
    00471
    00472
    00479     void deleteHash(Hashtable* hTable);
    00480
    00481
    00489     Hashtable* initHash(UErrorCode& status);
    00490
    00491
    00492
    00501     void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
    00502
    00503
    00504     // data members
    00505     // fallback interval pattern
    00506     UnicodeString fFallbackIntervalPattern;
    00507     // default order
    00508     UBool fFirstDateInPtnIsLaterDate;
    00509
    00510     // HashMap<UnicodeString, UnicodeString[kIPI_MAX_INDEX]>
    00511     // HashMap( skeleton, pattern[largest_different_field] )
    00512     Hashtable* fIntervalPatterns;
    00513
    00514 };// end class DateIntervalInfo
    00515
    00516
    00517 inline UBool
    00518 DateIntervalInfo::operator!=(const DateIntervalInfo& other) const {
    00519     return !operator==(other);
    00520 }
    00521
    00522
    00523 U_NAMESPACE_END
    00524
    00525 #endif
    00526
    00527 #endif
    00528