ICU 57.1 57.1
dtitvinf.h
Go to the documentation of this file.
1/*
2 *******************************************************************************
3 * Copyright (C) 2008-2016, 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
30
152public:
153#ifndef U_HIDE_INTERNAL_API
168#endif /* U_HIDE_INTERNAL_API */
169
170
179
180
186
192
199 virtual DateIntervalInfo* clone(void) const;
200
207
208
216 virtual UBool operator==(const DateIntervalInfo& other) const;
217
226
227
228
265
279 UErrorCode& status) const;
280
288
289
305
306
314
315
322
329
330
331private:
340 friend class DateIntervalFormat;
341
342 friend struct DateIntervalSink;
343
349 enum IntervalPatternIndex
350 {
351 kIPI_ERA,
352 kIPI_YEAR,
353 kIPI_MONTH,
354 kIPI_DATE,
355 kIPI_AM_PM,
356 kIPI_HOUR,
357 kIPI_MINUTE,
358 kIPI_SECOND,
359 kIPI_MAX_INDEX
360 };
361public:
362#ifndef U_HIDE_INTERNAL_API
367 enum {
368 kMaxIntervalPatternIndex = kIPI_MAX_INDEX
369 };
370#endif /* U_HIDE_INTERNAL_API */
371private:
372
373
379 void initializeData(const Locale& locale, UErrorCode& status);
380
381
382 /* Set Interval pattern.
383 *
384 * It sets interval pattern into the hash map.
385 *
386 * @param skeleton skeleton on which the interval pattern based
387 * @param lrgDiffCalUnit the largest different calendar unit.
388 * @param intervalPattern the interval pattern on the largest different
389 * calendar unit.
390 * @param status output param set to success/failure code on exit
391 */
392 void setIntervalPatternInternally(const UnicodeString& skeleton,
396
397
416 const UnicodeString* getBestSkeleton(const UnicodeString& skeleton,
417 int8_t& bestMatchDistanceInfo) const;
418
419
427 static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton,
428 int32_t* skeletonFieldWidth);
429
430
442 static UBool U_EXPORT2 stringNumeric(int32_t fieldWidth,
443 int32_t anotherFieldWidth,
444 char patternLetter);
445
446
460 static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex(
463
464
470 void deleteHash(Hashtable* hTable);
471
472
479 Hashtable* initHash(UErrorCode& status);
480
481
482
490 void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
491
492
493 // data members
494 // fallback interval pattern
495 UnicodeString fFallbackIntervalPattern;
496 // default order
497 UBool fFirstDateInPtnIsLaterDate;
498
499 // HashMap<UnicodeString, UnicodeString[kIPI_MAX_INDEX]>
500 // HashMap( skeleton, pattern[largest_different_field] )
501 Hashtable* fIntervalPatterns;
502
503};// end class DateIntervalInfo
504
505
506inline UBool
510
511
513
514#endif
515
516#endif
517
DateIntervalFormat is a class for formatting and parsing date intervals in a language-independent man...
Definition dtitvfmt.h:220
DateIntervalInfo is a public class for encapsulating localizable date time interval patterns.
Definition dtitvinf.h:151
DateIntervalInfo(const Locale &locale, UErrorCode &status)
Construct DateIntervalInfo for the given locale,.
UBool getDefaultOrder() const
Get default order – whether the first date in pattern is later date or not.
virtual UBool operator==(const DateIntervalInfo &other) const
Return true if another object is semantically equal to this one.
UnicodeString & getIntervalPattern(const UnicodeString &skeleton, UCalendarDateFields field, UnicodeString &result, UErrorCode &status) const
Get the interval pattern given skeleton and the largest different calendar field.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
virtual DateIntervalInfo * clone(void) const
Clone this object polymorphically.
void setIntervalPattern(const UnicodeString &skeleton, UCalendarDateFields lrgDiffCalUnit, const UnicodeString &intervalPattern, UErrorCode &status)
Provides a way for client to build interval patterns.
UnicodeString & getFallbackIntervalPattern(UnicodeString &result) const
Get the fallback interval pattern.
UBool operator!=(const DateIntervalInfo &other) const
Return true if another object is semantically unequal to this one.
Definition dtitvinf.h:507
virtual ~DateIntervalInfo()
Destructor.
void setFallbackIntervalPattern(const UnicodeString &fallbackPattern, UErrorCode &status)
Re-set the fallback interval pattern.
DateIntervalInfo(const DateIntervalInfo &)
Copy constructor.
DateIntervalInfo & operator=(const DateIntervalInfo &)
Assignment operator.
DateIntervalInfo(UErrorCode &status)
Default constructor.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
"Smart pointer" base class; do not use directly: use LocalPointer etc.
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:185
UObject is the common ICU "boilerplate" class.
Definition uobject.h:221
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:294
C++ API: Date/Time Pattern Generator.
C++ API: Locale ID object.
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
C API: Calendar.
UCalendarDateFields
Possible fields in a UCalendar.
Definition ucal.h:183
C API: DateFormat.
int8_t UBool
The ICU boolean type.
Definition umachine.h:234
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:476
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:358
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129