// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2008-2014, Google, International Business Machines Corporation * and others. All Rights Reserved. ******************************************************************************* */ #ifndef __TMUTFMT_H__ #define __TMUTFMT_H__ #include "unicode/utypes.h" /** * \file * \brief C++ API: Format and parse duration in single time unit */ #if U_SHOW_CPLUSPLUS_API #if !UCONFIG_NO_FORMATTING #include "unicode/unistr.h" #include "unicode/tmunit.h" #include "unicode/tmutamt.h" #include "unicode/measfmt.h" #include "unicode/numfmt.h" #include "unicode/plurrule.h" #ifndef U_HIDE_DEPRECATED_API /** * Constants for various styles. * There are 2 styles: full name and abbreviated name. * For example, for English, the full name for hour duration is "3 hours", * and the abbreviated name is "3 hrs". * @deprecated ICU 53 Use MeasureFormat and UMeasureFormatWidth instead. */ enum UTimeUnitFormatStyle { … }; UTimeUnitFormatStyle; /**< @deprecated ICU 53 */ U_NAMESPACE_BEGIN class Hashtable; class UVector; struct TimeUnitFormatReadSink; /** * Format or parse a TimeUnitAmount, using plural rules for the units where available. * * <P> * Code Sample: * <pre> * // create time unit amount instance - a combination of Number and time unit * UErrorCode status = U_ZERO_ERROR; * TimeUnitAmount* source = new TimeUnitAmount(2, TimeUnit::UTIMEUNIT_YEAR, status); * // create time unit format instance * TimeUnitFormat* format = new TimeUnitFormat(Locale("en"), status); * // format a time unit amount * UnicodeString formatted; * Formattable formattable; * if (U_SUCCESS(status)) { * formattable.adoptObject(source); * formatted = ((Format*)format)->format(formattable, formatted, status); * Formattable result; * ((Format*)format)->parseObject(formatted, result, status); * if (U_SUCCESS(status)) { * assert (result == formattable); * } * } * </pre> * * <P> * @see TimeUnitAmount * @see TimeUnitFormat * @deprecated ICU 53 Use the MeasureFormat class instead. */ class U_I18N_API TimeUnitFormat: public MeasureFormat { … }; U_NAMESPACE_END #endif /* U_HIDE_DEPRECATED_API */ #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ #endif // __TMUTFMT_H__ //eof