<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>ICU 4.4.1: TimeUnitFormat Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.6.2-20100208 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="classes.html"><span>Data Structure Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Data Fields</span></a></li> </ul> </div> </div> <div class="contents"> <h1>TimeUnitFormat Class Reference</h1><!-- doxytag: class="TimeUnitFormat" --><!-- doxytag: inherits="MeasureFormat" --> <p><a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> or parse a <a class="el" href="classTimeUnitAmount.html" title="Express a duration as a time unit and number.">TimeUnitAmount</a>, using plural rules for the units where available. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="tmutfmt_8h_source.html">tmutfmt.h</a>></code></p> <div class="dynheader"> Inheritance diagram for TimeUnitFormat:</div> <div class="dynsection"> <div class="center"> <img src="classTimeUnitFormat.png" usemap="#TimeUnitFormat_map" alt=""/> <map id="TimeUnitFormat_map" name="TimeUnitFormat_map"> <area href="classMeasureFormat.html" alt="MeasureFormat" shape="rect" coords="0,168,101,192"/> <area href="classFormat.html" alt="Format" shape="rect" coords="0,112,101,136"/> <area href="classUObject.html" alt="UObject" shape="rect" coords="0,56,101,80"/> <area href="classUMemory.html" alt="UMemory" shape="rect" coords="0,0,101,24"/> </map> </div> </div> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Types</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#ad4adbfcea52ad3dcef00fc8f393a09df">EStyle</a> { <b>kFull</b> = 0, <b>kAbbreviate</b> = 1, <b>kTotal</b> = kAbbreviate + 1 }</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight"><p>Constants for various styles. </p> <a href="classTimeUnitFormat.html#ad4adbfcea52ad3dcef00fc8f393a09df">More...</a><br/></td></tr> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a72e623d6fb0226287fde0bfa71cddc17">TimeUnitFormat</a> (<a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a> with default locale, and full name style. <a href="#a72e623d6fb0226287fde0bfa71cddc17"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#ac641f50a05f512c46d7a29aee56ccbf1">TimeUnitFormat</a> (const <a class="el" href="classLocale.html">Locale</a> &locale, <a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a> given locale, and full name style. <a href="#ac641f50a05f512c46d7a29aee56ccbf1"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a6d0c6f8edbaa21c2cc83514fad9e04e3">TimeUnitFormat</a> (const <a class="el" href="classLocale.html">Locale</a> &locale, <a class="el" href="classTimeUnitFormat.html#ad4adbfcea52ad3dcef00fc8f393a09df">EStyle</a> style, <a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a> given locale and style. <a href="#a6d0c6f8edbaa21c2cc83514fad9e04e3"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a7c38c9533b75ffc5fbb8b29a7ae3513c">TimeUnitFormat</a> (const <a class="el" href="classTimeUnitFormat.html">TimeUnitFormat</a> &)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <a href="#a7c38c9533b75ffc5fbb8b29a7ae3513c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#aa5535aecfeffc12710a1ff44e689edb5">~TimeUnitFormat</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">deconstructor <a href="#aa5535aecfeffc12710a1ff44e689edb5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classFormat.html">Format</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a43917ab066f1582afeb05f6fdf7684da">clone</a> (void) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Clone this <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> object polymorphically. <a href="#a43917ab066f1582afeb05f6fdf7684da"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classTimeUnitFormat.html">TimeUnitFormat</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a4e527fbe06dc2641661427348c229811">operator=</a> (const <a class="el" href="classTimeUnitFormat.html">TimeUnitFormat</a> &other)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Assignment operator. <a href="#a4e527fbe06dc2641661427348c229811"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#afbb2c78b280ab5abb53a310f51039358">operator==</a> (const <a class="el" href="classFormat.html">Format</a> &other) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return true if the given <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> objects are semantically equal. <a href="#afbb2c78b280ab5abb53a310f51039358"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#ad669c6e3281f653cff3de8559e9d42d7">operator!=</a> (const <a class="el" href="classFormat.html">Format</a> &other) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return true if the given <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> objects are not semantically equal. <a href="#ad669c6e3281f653cff3de8559e9d42d7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#aeb1fc25598a4337caf0d8b6982fc074c">setLocale</a> (const <a class="el" href="classLocale.html">Locale</a> &locale, <a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the locale used for formatting or parsing. <a href="#aeb1fc25598a4337caf0d8b6982fc074c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a688a78002b3679e812cc05bc9ed31eb9">setNumberFormat</a> (const <a class="el" href="classNumberFormat.html">NumberFormat</a> &format, <a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the number format used for formatting or parsing. <a href="#a688a78002b3679e812cc05bc9ed31eb9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classUnicodeString.html">UnicodeString</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a55e29d1d260c1c775e8d1d36c03ab0ad">format</a> (const <a class="el" href="classFormattable.html">Formattable</a> &obj, <a class="el" href="classUnicodeString.html">UnicodeString</a> &toAppendTo, <a class="el" href="classFieldPosition.html">FieldPosition</a> &pos, <a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> a <a class="el" href="classTimeUnitAmount.html" title="Express a duration as a time unit and number.">TimeUnitAmount</a>. <a href="#a55e29d1d260c1c775e8d1d36c03ab0ad"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#af37d73dc96d335c4e03cd29b2316fca4">parseObject</a> (const <a class="el" href="classUnicodeString.html">UnicodeString</a> &source, <a class="el" href="classFormattable.html">Formattable</a> &result, <a class="el" href="classParsePosition.html">ParsePosition</a> &pos) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Parse a <a class="el" href="classTimeUnitAmount.html" title="Express a duration as a time unit and number.">TimeUnitAmount</a>. <a href="#af37d73dc96d335c4e03cd29b2316fca4"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="utypes_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a8f803c89e8485b013329529aa31d15f8">getDynamicClassID</a> (void) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a unique class ID POLYMORPHICALLY. <a href="#a8f803c89e8485b013329529aa31d15f8"></a><br/></td></tr> <tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="utypes_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classTimeUnitFormat.html#a60999f5e140c293674f778df32551447">getStaticClassID</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the class ID for this class. <a href="#a60999f5e140c293674f778df32551447"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p><a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> or parse a <a class="el" href="classTimeUnitAmount.html" title="Express a duration as a time unit and number.">TimeUnitAmount</a>, using plural rules for the units where available. </p> <p>Code Sample: </p> <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 <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a>(<a class="el" href="classLocale.html" title="A Locale object represents a specific geographical, political, or cultural region...">Locale</a>("en"), status); // format a time unit amount <a class="el" href="classUnicodeString.html" title="UnicodeString is a string class that stores Unicode characters directly and provides...">UnicodeString</a> formatted; <a class="el" href="classFormattable.html" title="Formattable objects can be passed to the Format class or its subclasses for formatting...">Formattable</a> formattable; if (<a class="el" href="utypes_8h.html#a527f2c69e6b2e3b2c53ad8a99fb36711" title="Does the error code indicate success?">U_SUCCESS(status)</a>) { formattable.adoptObject(source); formatted = ((Format*)format)->format(formattable, formatted, status); <a class="el" href="classFormattable.html" title="Formattable objects can be passed to the Format class or its subclasses for formatting...">Formattable</a> result; ((Format*)format)->parseObject(formatted, result, status); if (<a class="el" href="utypes_8h.html#a527f2c69e6b2e3b2c53ad8a99fb36711" title="Does the error code indicate success?">U_SUCCESS(status)</a>) { assert (result == formattable); } } </pre><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classTimeUnitAmount.html" title="Express a duration as a time unit and number.">TimeUnitAmount</a> </dd> <dd> <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a> </dd></dl> <dl class="draft"><dt><b><a class="el" href="draft.html#_draft000206">Draft:</a></b></dt><dd>This API may be changed in the future versions and was introduced in ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="tmutfmt_8h_source.html#l00069">69</a> of file <a class="el" href="tmutfmt_8h_source.html">tmutfmt.h</a>.</p> <hr/><h2>Member Enumeration Documentation</h2> <a class="anchor" id="ad4adbfcea52ad3dcef00fc8f393a09df"></a><!-- doxytag: member="TimeUnitFormat::EStyle" ref="ad4adbfcea52ad3dcef00fc8f393a09df" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">enum <a class="el" href="classTimeUnitFormat.html#ad4adbfcea52ad3dcef00fc8f393a09df">TimeUnitFormat::EStyle</a></td> </tr> </table> </div> <div class="memdoc"> <p>Constants for various styles. </p> <p>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". </p> <dl class="draft"><dt><b><a class="el" href="draft.html#_draft000207">Draft:</a></b></dt><dd>This API may be changed in the future versions and was introduced in ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="tmutfmt_8h_source.html#l00079">79</a> of file <a class="el" href="tmutfmt_8h_source.html">tmutfmt.h</a>.</p> </div> </div> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a72e623d6fb0226287fde0bfa71cddc17"></a><!-- doxytag: member="TimeUnitFormat::TimeUnitFormat" ref="a72e623d6fb0226287fde0bfa71cddc17" args="(UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">TimeUnitFormat::TimeUnitFormat </td> <td>(</td> <td class="paramtype"><a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Create <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a> with default locale, and full name style. </p> <p>Use setLocale and/or setFormat to modify. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003271">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="ac641f50a05f512c46d7a29aee56ccbf1"></a><!-- doxytag: member="TimeUnitFormat::TimeUnitFormat" ref="ac641f50a05f512c46d7a29aee56ccbf1" args="(const Locale &locale, UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">TimeUnitFormat::TimeUnitFormat </td> <td>(</td> <td class="paramtype">const <a class="el" href="classLocale.html">Locale</a> & </td> <td class="paramname"> <em>locale</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Create <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a> given locale, and full name style. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003272">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="a6d0c6f8edbaa21c2cc83514fad9e04e3"></a><!-- doxytag: member="TimeUnitFormat::TimeUnitFormat" ref="a6d0c6f8edbaa21c2cc83514fad9e04e3" args="(const Locale &locale, EStyle style, UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">TimeUnitFormat::TimeUnitFormat </td> <td>(</td> <td class="paramtype">const <a class="el" href="classLocale.html">Locale</a> & </td> <td class="paramname"> <em>locale</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classTimeUnitFormat.html#ad4adbfcea52ad3dcef00fc8f393a09df">EStyle</a> </td> <td class="paramname"> <em>style</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Create <a class="el" href="classTimeUnitFormat.html" title="Format or parse a TimeUnitAmount, using plural rules for the units where available...">TimeUnitFormat</a> given locale and style. </p> <dl class="draft"><dt><b><a class="el" href="draft.html#_draft000208">Draft:</a></b></dt><dd>This API may be changed in the future versions and was introduced in ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="a7c38c9533b75ffc5fbb8b29a7ae3513c"></a><!-- doxytag: member="TimeUnitFormat::TimeUnitFormat" ref="a7c38c9533b75ffc5fbb8b29a7ae3513c" args="(const TimeUnitFormat &)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">TimeUnitFormat::TimeUnitFormat </td> <td>(</td> <td class="paramtype">const <a class="el" href="classTimeUnitFormat.html">TimeUnitFormat</a> & </td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Copy constructor. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003273">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="aa5535aecfeffc12710a1ff44e689edb5"></a><!-- doxytag: member="TimeUnitFormat::~TimeUnitFormat" ref="aa5535aecfeffc12710a1ff44e689edb5" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual TimeUnitFormat::~TimeUnitFormat </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>deconstructor </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003274">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a43917ab066f1582afeb05f6fdf7684da"></a><!-- doxytag: member="TimeUnitFormat::clone" ref="a43917ab066f1582afeb05f6fdf7684da" args="(void) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="classFormat.html">Format</a>* TimeUnitFormat::clone </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Clone this <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> object polymorphically. </p> <p>The caller owns the result and should delete it when done. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>A copy of the object. </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003275">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Implements <a class="el" href="classFormat.html#a4e7ebd5cfd390c35e2bda88257f8b51a">Format</a>.</p> </div> </div> <a class="anchor" id="a55e29d1d260c1c775e8d1d36c03ab0ad"></a><!-- doxytag: member="TimeUnitFormat::format" ref="a55e29d1d260c1c775e8d1d36c03ab0ad" args="(const Formattable &obj, UnicodeString &toAppendTo, FieldPosition &pos, UErrorCode &status) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="classUnicodeString.html">UnicodeString</a>& TimeUnitFormat::format </td> <td>(</td> <td class="paramtype">const <a class="el" href="classFormattable.html">Formattable</a> & </td> <td class="paramname"> <em>obj</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classUnicodeString.html">UnicodeString</a> & </td> <td class="paramname"> <em>toAppendTo</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classFieldPosition.html">FieldPosition</a> & </td> <td class="paramname"> <em>pos</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p><a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> a <a class="el" href="classTimeUnitAmount.html" title="Express a duration as a time unit and number.">TimeUnitAmount</a>. </p> <p>If the formattable object is not a time unit amount object, or the number in time unit amount is not a double type or long type numeric, it returns a failing status: U_ILLEGAL_ARGUMENT_ERROR. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classFormat.html#a12ffb857c5c9a553270dfe9a71fbd8e9" title="Format an object to produce a string.">Format::format(const Formattable&, UnicodeString&, FieldPosition&, UErrorCode&) const</a> </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003281">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Implements <a class="el" href="classFormat.html#a12ffb857c5c9a553270dfe9a71fbd8e9">Format</a>.</p> </div> </div> <a class="anchor" id="a8f803c89e8485b013329529aa31d15f8"></a><!-- doxytag: member="TimeUnitFormat::getDynamicClassID" ref="a8f803c89e8485b013329529aa31d15f8" args="(void) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="utypes_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> TimeUnitFormat::getDynamicClassID </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a unique class ID POLYMORPHICALLY. </p> <p>Pure virtual override. This method is to implement a simple version of RTTI, since not all C++ compilers support genuine RTTI. Polymorphic <a class="el" href="classTimeUnitFormat.html#afbb2c78b280ab5abb53a310f51039358" title="Return true if the given Format objects are semantically equal.">operator==()</a> and <a class="el" href="classTimeUnitFormat.html#a43917ab066f1582afeb05f6fdf7684da" title="Clone this Format object polymorphically.">clone()</a> methods call this method.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>The class ID for this object. All objects of a given class have the same class ID. Objects of other classes have different class IDs. </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003284">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Implements <a class="el" href="classFormat.html#ac961d410d174518e5a3ebb8bbef45cd7">Format</a>.</p> </div> </div> <a class="anchor" id="a60999f5e140c293674f778df32551447"></a><!-- doxytag: member="TimeUnitFormat::getStaticClassID" ref="a60999f5e140c293674f778df32551447" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="utypes_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> TimeUnitFormat::getStaticClassID </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Return the class ID for this class. </p> <p>This is useful only for comparing to a return value from <a class="el" href="classTimeUnitFormat.html#a8f803c89e8485b013329529aa31d15f8" title="Returns a unique class ID POLYMORPHICALLY.">getDynamicClassID()</a>. For example: </p> <pre> . Base* polymorphic_pointer = createPolymorphicObject(); . if (polymorphic_pointer-><a class="el" href="classTimeUnitFormat.html#a8f803c89e8485b013329529aa31d15f8" title="Returns a unique class ID POLYMORPHICALLY.">getDynamicClassID()</a> == . erived::getStaticClassID()) ... </pre> <dl class="return"><dt><b>Returns:</b></dt><dd>The class ID for all objects of this class. </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003283">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="ad669c6e3281f653cff3de8559e9d42d7"></a><!-- doxytag: member="TimeUnitFormat::operator!=" ref="ad669c6e3281f653cff3de8559e9d42d7" args="(const Format &other) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> TimeUnitFormat::operator!= </td> <td>(</td> <td class="paramtype">const <a class="el" href="classFormat.html">Format</a> & </td> <td class="paramname"> <em>other</em></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Return true if the given <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> objects are not semantically equal. </p> <p>Objects of different subclasses are considered unequal. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>other</em> </td><td>the object to be compared with. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if the given <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> objects are not semantically equal. </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003278">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Reimplemented from <a class="el" href="classFormat.html#a4f65d87226814931dde8b035f47b69f3">Format</a>.</p> <p>Definition at line <a class="el" href="tmutfmt_8h_source.html#l00261">261</a> of file <a class="el" href="tmutfmt_8h_source.html">tmutfmt.h</a>.</p> <p>References <a class="el" href="classTimeUnitFormat.html#afbb2c78b280ab5abb53a310f51039358">operator==()</a>.</p> </div> </div> <a class="anchor" id="a4e527fbe06dc2641661427348c229811"></a><!-- doxytag: member="TimeUnitFormat::operator=" ref="a4e527fbe06dc2641661427348c229811" args="(const TimeUnitFormat &other)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classTimeUnitFormat.html">TimeUnitFormat</a>& TimeUnitFormat::operator= </td> <td>(</td> <td class="paramtype">const <a class="el" href="classTimeUnitFormat.html">TimeUnitFormat</a> & </td> <td class="paramname"> <em>other</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Assignment operator. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003276">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="afbb2c78b280ab5abb53a310f51039358"></a><!-- doxytag: member="TimeUnitFormat::operator==" ref="afbb2c78b280ab5abb53a310f51039358" args="(const Format &other) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> TimeUnitFormat::operator== </td> <td>(</td> <td class="paramtype">const <a class="el" href="classFormat.html">Format</a> & </td> <td class="paramname"> <em>other</em></td> <td> ) </td> <td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Return true if the given <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> objects are semantically equal. </p> <p>Objects of different subclasses are considered unequal. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>other</em> </td><td>the object to be compared with. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if the given <a class="el" href="classFormat.html" title="Base class for all formats.">Format</a> objects are semantically equal. </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003277">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Implements <a class="el" href="classFormat.html#ad9be7e8b7bef97013ff74ef1be3903a5">Format</a>.</p> <p>Referenced by <a class="el" href="tmutfmt_8h_source.html#l00261">operator!=()</a>.</p> </div> </div> <a class="anchor" id="af37d73dc96d335c4e03cd29b2316fca4"></a><!-- doxytag: member="TimeUnitFormat::parseObject" ref="af37d73dc96d335c4e03cd29b2316fca4" args="(const UnicodeString &source, Formattable &result, ParsePosition &pos) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void TimeUnitFormat::parseObject </td> <td>(</td> <td class="paramtype">const <a class="el" href="classUnicodeString.html">UnicodeString</a> & </td> <td class="paramname"> <em>source</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classFormattable.html">Formattable</a> & </td> <td class="paramname"> <em>result</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classParsePosition.html">ParsePosition</a> & </td> <td class="paramname"> <em>pos</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Parse a <a class="el" href="classTimeUnitAmount.html" title="Express a duration as a time unit and number.">TimeUnitAmount</a>. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classFormat.html#aa53bea97b986c2f21e5638aa30aa08b7" title="Parse a string to produce an object.">Format::parseObject(const UnicodeString&, Formattable&, ParsePosition&) const</a>; </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003282">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Implements <a class="el" href="classFormat.html#aa53bea97b986c2f21e5638aa30aa08b7">Format</a>.</p> </div> </div> <a class="anchor" id="aeb1fc25598a4337caf0d8b6982fc074c"></a><!-- doxytag: member="TimeUnitFormat::setLocale" ref="aeb1fc25598a4337caf0d8b6982fc074c" args="(const Locale &locale, UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void TimeUnitFormat::setLocale </td> <td>(</td> <td class="paramtype">const <a class="el" href="classLocale.html">Locale</a> & </td> <td class="paramname"> <em>locale</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Set the locale used for formatting or parsing. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>locale</em> </td><td>the locale to be set </td></tr> <tr><td valign="top"></td><td valign="top"><em>status</em> </td><td>output param set to success/failure code on exit </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003279">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="a688a78002b3679e812cc05bc9ed31eb9"></a><!-- doxytag: member="TimeUnitFormat::setNumberFormat" ref="a688a78002b3679e812cc05bc9ed31eb9" args="(const NumberFormat &format, UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void TimeUnitFormat::setNumberFormat </td> <td>(</td> <td class="paramtype">const <a class="el" href="classNumberFormat.html">NumberFormat</a> & </td> <td class="paramname"> <em>format</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Set the number format used for formatting or parsing. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>format</em> </td><td>the number formatter to be set </td></tr> <tr><td valign="top"></td><td valign="top"><em>status</em> </td><td>output param set to success/failure code on exit </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable003280">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="tmutfmt_8h_source.html">tmutfmt.h</a></li> </ul> </div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Defines</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>