/********************************************************************************
-* Copyright (C) 2008-2010, International Business Machines Corporation and
+* Copyright (C) 2008-2013, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
* "EEE, d MMM, yyyy - EEE, d MMM, yyyy" for year differs,
* "EEE, d MMM - EEE, d MMM, yyyy" for month differs,
* "EEE, d - EEE, d MMM, yyyy" for day differs,
- * @param skeleton the skeleton on which interval format based.
+ * @param skeleton the skeleton on which the interval format is based.
* @param locale the given locale
* @param status output param set to success/failure code on exit
* @return a date time interval formatter which the caller owns.
* @stable ICU 4.0
+ * <p>
+ * <h4>Sample code</h4>
+ * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtPreDefined1
+ * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtPreDefined
+ * <p>
*/
static DateIntervalFormat* U_EXPORT2 createInstance(
* @param status output param set to success/failure code on exit
* @return a date time interval formatter which the caller owns.
* @stable ICU 4.0
+ * <p>
+ * <h4>Sample code</h4>
+ * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtPreDefined1
+ * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtCustomized
+ * <p>
*/
static DateIntervalFormat* U_EXPORT2 createInstance(
const UnicodeString& skeleton,
const DateFormat* getDateFormat(void) const;
/**
+ * Returns a reference to the TimeZone used by this DateIntervalFormat's calendar.
+ * @return the time zone associated with the calendar of DateIntervalFormat.
+ * @stable ICU 4.8
+ */
+ virtual const TimeZone& getTimeZone(void) const;
+
+ /**
+ * Sets the time zone for the calendar used by this DateIntervalFormat object. The
+ * caller no longer owns the TimeZone object and should not delete it after this call.
+ * @param zoneToAdopt the TimeZone to be adopted.
+ * @stable ICU 4.8
+ */
+ virtual void adoptTimeZone(TimeZone* zoneToAdopt);
+
+ /**
+ * Sets the time zone for the calendar used by this DateIntervalFormat object.
+ * @param zone the new time zone.
+ * @stable ICU 4.8
+ */
+ virtual void setTimeZone(const TimeZone& zone);
+
+ /**
* Return the class ID for this class. This is useful only for comparing to
* a return value from getDynamicClassID(). For example:
* <pre>
* Also, the first date appears in an interval pattern could be
* the earlier date or the later date.
* And such information is saved in the interval pattern as well.
- * @internal ICU 4.0
*/
struct PatternInfo {
UnicodeString firstPart;
* Caller should not delete them.
*
* @param locale the locale of this date interval formatter.
- * @param dtitvinf the DateIntervalInfo object to be adopted.
+ * @param dtItvInfo the DateIntervalInfo object to be adopted.
* @param skeleton the skeleton of the date formatter
* @param status output param set to success/failure code on exit
- * @internal ICU 4.0
*/
DateIntervalFormat(const Locale& locale, DateIntervalInfo* dtItvInfo,
const UnicodeString* skeleton, UErrorCode& status);
* @param skeleton the skeleton of this formatter.
* @param status Output param set to success/failure code.
* @return a date time interval formatter which the caller owns.
- * @internal ICU 4.0
*/
static DateIntervalFormat* U_EXPORT2 create(const Locale& locale,
DateIntervalInfo* dtitvinf,
* If it is failure, the returned date formatter will
* be NULL.
* @return a simple date formatter which the caller owns.
- * @internal ICU 4.0
*/
static SimpleDateFormat* U_EXPORT2 createSDFPatternInstance(
const UnicodeString& skeleton,
* On output: the offsets of the alignment field.
* @param status output param set to success/failure code on exit
* @return Reference to 'appendTo' parameter.
- * @internal ICU 4.0
*/
UnicodeString& fallbackFormat(Calendar& fromCalendar,
Calendar& toCalendar,
*
*
* @param status output param set to success/failure code on exit
- * @internal ICU 4.0
*/
void initializePattern(UErrorCode& status);
* @param field the largest different calendar field
* @param skeleton a skeleton
* @param status output param set to success/failure code on exit
- * @internal ICU 4.0
*/
void setFallbackPattern(UCalendarDateFields field,
const UnicodeString& skeleton,
* @param normalizedTime Output parameter for normalized time only
* skeleton.
*
- * @internal ICU 4.0
*/
static void U_EXPORT2 getDateTimeSkeleton(const UnicodeString& skeleton,
UnicodeString& date,
* @return whether the resource is found for the skeleton.
* TRUE if interval pattern found for the skeleton,
* FALSE otherwise.
- * @internal ICU 4.0
*/
UBool setSeparateDateTimePtn(const UnicodeString& dateSkeleton,
const UnicodeString& timeSkeleton);
* through extending skeleton or not.
* TRUE if interval pattern is found by
* extending skeleton, FALSE otherwise.
- * @internal ICU 4.0
*/
UBool setIntervalPattern(UCalendarDateFields field,
const UnicodeString* skeleton,
*
* @param inputSkeleton the input skeleton
* @param bestMatchSkeleton the best match skeleton
- * @param bestMatchIntervalpattern the best match interval pattern
+ * @param bestMatchIntervalPattern the best match interval pattern
* @param differenceInfo the difference between 2 skeletons
* 1 means only field width differs
* 2 means v/z exchange
* @param adjustedIntervalPattern adjusted interval pattern
- * @internal ICU 4.0
*/
static void U_EXPORT2 adjustFieldWidth(
const UnicodeString& inputSkeleton,
* @param datePattern date pattern
* @param field time calendar field: AM_PM, HOUR, MINUTE
* @param status output param set to success/failure code on exit
- * @internal ICU 4.0
*/
void concatSingleDate2TimeInterval(const UChar* format,
int32_t formatLen,
* @param field calendar field need to check
* @param skeleton given skeleton on which to check the calendar field
* @return true if field present in a skeleton.
- * @internal ICU 4.0
*/
static UBool U_EXPORT2 fieldExistsInSkeleton(UCalendarDateFields field,
const UnicodeString& skeleton);
* Split interval patterns into 2 part.
* @param intervalPattern interval pattern
* @return the index in interval pattern which split the pattern into 2 part
- * @internal ICU 4.0
*/
static int32_t U_EXPORT2 splitPatternInto2Part(const UnicodeString& intervalPattern);
* Break interval patterns as 2 part and save them into pattern info.
* @param field calendar field
* @param intervalPattern interval pattern
- * @internal ICU 4.0
*/
void setIntervalPattern(UCalendarDateFields field,
const UnicodeString& intervalPattern);
* @param field calendar field
* @param intervalPattern interval pattern
* @param laterDateFirst whether later date appear first in interval pattern
- * @internal ICU 4.0
*/
void setIntervalPattern(UCalendarDateFields field,
const UnicodeString& intervalPattern,
* @param secondPart the second part in interval pattern
* @param laterDateFirst whether the first date in intervalPattern
* is earlier date or later date
- * @internal ICU 4.0
*/
void setPatternInfo(UCalendarDateFields field,
const UnicodeString* firstPart,
- const UnicodeString* secondpart,
+ const UnicodeString* secondPart,
UBool laterDateFirst);