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

- File List
- Globals

# dtitvinf.h

Go to the documentation of this file.

    00001 /*
    00002  *******************************************************************************
    00003  * Copyright (C) 2008-2010, 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
    00158 class U_I18N_API DateIntervalInfo : public UObject {
    00159 public:
    00173     DateIntervalInfo(UErrorCode& status);
    00174
    00175
    00183     DateIntervalInfo(const Locale& locale, UErrorCode& status);
    00184
    00185
    00190     DateIntervalInfo(const DateIntervalInfo&);
    00191
    00196     DateIntervalInfo& operator=(const DateIntervalInfo&);
    00197
    00204     virtual DateIntervalInfo* clone(void) const;
    00205
    00211     virtual ~DateIntervalInfo();
    00212
    00213
    00221     virtual UBool operator==(const DateIntervalInfo& other) const;
    00222
    00230     UBool operator!=(const DateIntervalInfo& other) const;
    00231
    00232
    00233
    00266     void setIntervalPattern(const UnicodeString& skeleton,
    00267                             UCalendarDateFields lrgDiffCalUnit,
    00268                             const UnicodeString& intervalPattern,
    00269                             UErrorCode& status);
    00270
    00281     UnicodeString& getIntervalPattern(const UnicodeString& skeleton,
    00282                                       UCalendarDateFields field,
    00283                                       UnicodeString& result,
    00284                                       UErrorCode& status) const;
    00285
    00292     UnicodeString& getFallbackIntervalPattern(UnicodeString& result) const;
    00293
    00294
    00308     void setFallbackIntervalPattern(const UnicodeString& fallbackPattern,
    00309                                     UErrorCode& status);
    00310
    00311
    00318     UBool getDefaultOrder() const;
    00319
    00320
    00326     virtual UClassID getDynamicClassID() const;
    00327
    00333     static UClassID U_EXPORT2 getStaticClassID();
    00334
    00335
    00336 private:
    00345     friend class DateIntervalFormat;
    00346
    00352     enum IntervalPatternIndex
    00353     {
    00354         kIPI_ERA,
    00355         kIPI_YEAR,
    00356         kIPI_MONTH,
    00357         kIPI_DATE,
    00358         kIPI_AM_PM,
    00359         kIPI_HOUR,
    00360         kIPI_MINUTE,
    00361         kIPI_MAX_INDEX
    00362     };
    00363 public:
    00368      enum {
    00369         kMaxIntervalPatternIndex = kIPI_MAX_INDEX
    00370      };
    00371 private:
    00372
    00373
    00380     void initializeData(const Locale& locale, UErrorCode& status);
    00381
    00382
    00383     /* Set Interval pattern.
    00384      *
    00385      * It sets interval pattern into the hash map.
    00386      *
    00387      * @param skeleton         skeleton on which the interval pattern based
    00388      * @param lrgDiffCalUnit   the largest different calendar unit.
    00389      * @param intervalPattern  the interval pattern on the largest different
    00390      *                         calendar unit.
    00391      * @param status           output param set to success/failure code on exit
    00392      * @internal ICU 4.0
    00393      */
    00394     void setIntervalPatternInternally(const UnicodeString& skeleton,
    00395                                       UCalendarDateFields lrgDiffCalUnit,
    00396                                       const UnicodeString& intervalPattern,
    00397                                       UErrorCode& status);
    00398
    00399
    00419     const UnicodeString* getBestSkeleton(const UnicodeString& skeleton,
    00420                                          int8_t& bestMatchDistanceInfo) const;
    00421
    00422
    00431     static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton,
    00432                                         int32_t* skeletonFieldWidth);
    00433
    00434
    00447     static UBool U_EXPORT2 stringNumeric(int32_t fieldWidth,
    00448                                          int32_t anotherFieldWidth,
    00449                                          char patternLetter);
    00450
    00451
    00466     static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex(
    00467                                                       UCalendarDateFields field,
    00468                                                       UErrorCode& status);
    00469
    00470
    00477     void deleteHash(Hashtable* hTable);
    00478
    00479
    00487     Hashtable* initHash(UErrorCode& status);
    00488
    00489
    00490
    00499     void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
    00500
    00501
    00502     // data members
    00503     // fallback interval pattern
    00504     UnicodeString fFallbackIntervalPattern;
    00505     // default order
    00506     UBool fFirstDateInPtnIsLaterDate;
    00507
    00508     // HashMap<UnicodeString, UnicodeString[kIPI_MAX_INDEX]>
    00509     // HashMap( skeleton, pattern[largest_different_field] )
    00510     Hashtable* fIntervalPatterns;
    00511
    00512 };// end class DateIntervalInfo
    00513
    00514
    00515 inline UBool
    00516 DateIntervalInfo::operator!=(const DateIntervalInfo& other) const {
    00517     return !operator==(other);
    00518 }
    00519
    00520
    00521 U_NAMESPACE_END
    00522
    00523 #endif
    00524
    00525 #endif
    00526

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines