ICU 4.8.1.1  4.8.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dtitvinf.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 2008-2010, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  *******************************************************************************
6  *
7  * File DTITVINF.H
8  *
9  *******************************************************************************
10  */
11 
12 #ifndef __DTITVINF_H__
13 #define __DTITVINF_H__
14 
15 #include "unicode/utypes.h"
16 
22 #if !UCONFIG_NO_FORMATTING
23 
24 #include "unicode/udat.h"
25 #include "unicode/locid.h"
26 #include "unicode/ucal.h"
27 #include "unicode/dtptngen.h"
28 //#include "dtitv_impl.h"
29 
34 union UHashTok;
35 
36 
38 
160 public:
174  DateIntervalInfo(UErrorCode& status);
175 
176 
184  DateIntervalInfo(const Locale& locale, UErrorCode& status);
185 
186 
192 
197  DateIntervalInfo& operator=(const DateIntervalInfo&);
198 
205  virtual DateIntervalInfo* clone(void) const;
206 
212  virtual ~DateIntervalInfo();
213 
214 
222  virtual UBool operator==(const DateIntervalInfo& other) const;
223 
231  UBool operator!=(const DateIntervalInfo& other) const;
232 
233 
234 
267  void setIntervalPattern(const UnicodeString& skeleton,
268  UCalendarDateFields lrgDiffCalUnit,
269  const UnicodeString& intervalPattern,
270  UErrorCode& status);
271 
282  UnicodeString& getIntervalPattern(const UnicodeString& skeleton,
283  UCalendarDateFields field,
284  UnicodeString& result,
285  UErrorCode& status) const;
286 
293  UnicodeString& getFallbackIntervalPattern(UnicodeString& result) const;
294 
295 
309  void setFallbackIntervalPattern(const UnicodeString& fallbackPattern,
310  UErrorCode& status);
311 
312 
319  UBool getDefaultOrder() const;
320 
321 
327  virtual UClassID getDynamicClassID() const;
328 
334  static UClassID U_EXPORT2 getStaticClassID();
335 
336 
337 private:
346  friend class DateIntervalFormat;
347 
353  enum IntervalPatternIndex
354  {
355  kIPI_ERA,
356  kIPI_YEAR,
357  kIPI_MONTH,
358  kIPI_DATE,
359  kIPI_AM_PM,
360  kIPI_HOUR,
361  kIPI_MINUTE,
362  kIPI_MAX_INDEX
363  };
364 public:
369  enum {
370  kMaxIntervalPatternIndex = kIPI_MAX_INDEX
371  };
372 private:
373 
374 
381  void initializeData(const Locale& locale, UErrorCode& status);
382 
383 
384  /* Set Interval pattern.
385  *
386  * It sets interval pattern into the hash map.
387  *
388  * @param skeleton skeleton on which the interval pattern based
389  * @param lrgDiffCalUnit the largest different calendar unit.
390  * @param intervalPattern the interval pattern on the largest different
391  * calendar unit.
392  * @param status output param set to success/failure code on exit
393  * @internal ICU 4.0
394  */
395  void setIntervalPatternInternally(const UnicodeString& skeleton,
396  UCalendarDateFields lrgDiffCalUnit,
397  const UnicodeString& intervalPattern,
398  UErrorCode& status);
399 
400 
420  const UnicodeString* getBestSkeleton(const UnicodeString& skeleton,
421  int8_t& bestMatchDistanceInfo) const;
422 
423 
432  static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton,
433  int32_t* skeletonFieldWidth);
434 
435 
448  static UBool U_EXPORT2 stringNumeric(int32_t fieldWidth,
449  int32_t anotherFieldWidth,
450  char patternLetter);
451 
452 
467  static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex(
468  UCalendarDateFields field,
469  UErrorCode& status);
470 
471 
478  void deleteHash(Hashtable* hTable);
479 
480 
488  Hashtable* initHash(UErrorCode& status);
489 
490 
491 
500  void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
501 
502 
503  // data members
504  // fallback interval pattern
505  UnicodeString fFallbackIntervalPattern;
506  // default order
507  UBool fFirstDateInPtnIsLaterDate;
508 
509  // HashMap<UnicodeString, UnicodeString[kIPI_MAX_INDEX]>
510  // HashMap( skeleton, pattern[largest_different_field] )
511  Hashtable* fIntervalPatterns;
512 
513 };// end class DateIntervalInfo
514 
515 
516 inline UBool
518  return !operator==(other);
519 }
520 
521 
523 
524 #endif
525 
526 #endif
527