<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ICU 3.8: CanonicalIterator Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.1 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li id="current"><a href="classes.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label> <u>S</u>earch for </label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul></div> <div class="tabs"> <ul> <li><a href="classes.html"><span>Alphabetical List</span></a></li> <li><a href="annotated.html"><span>Data Structures</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> <h1>CanonicalIterator Class Reference</h1><!-- doxytag: class="CanonicalIterator" --><!-- doxytag: inherits="UObject" -->This class allows one to iterate through all the strings that are canonically equivalent to a given string. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="caniter_8h-source.html">caniter.h</a>></code> <p> <p>Inheritance diagram for CanonicalIterator: <p><center><img src="classCanonicalIterator.png" usemap="#CanonicalIterator_map" border="0" alt=""></center> <map name="CanonicalIterator_map"> <area href="classUObject.html" alt="UObject" shape="rect" coords="0,56,109,80"> <area href="classUMemory.html" alt="UMemory" shape="rect" coords="0,0,109,24"> </map> <table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#581c81477525fb72415b732ee787245c">CanonicalIterator</a> (const <a class="el" href="classUnicodeString.html">UnicodeString</a> &source, <a class="el" href="utypes_8h.html#3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a <a class="el" href="classCanonicalIterator.html">CanonicalIterator</a> object. <a href="#581c81477525fb72415b732ee787245c"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#be0bf9f1eff2eb424a2882da89925fbb">~CanonicalIterator</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor Cleans pieces. <a href="#be0bf9f1eff2eb424a2882da89925fbb"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classUnicodeString.html">UnicodeString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#a9fa2c21b52c2e2cac9e8f76aefde683">getSource</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the NFD form of the current source we are iterating over. <a href="#a9fa2c21b52c2e2cac9e8f76aefde683"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#561310848158d309f57f9068cecfcaef">reset</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Resets the iterator so that one can start again from the beginning. <a href="#561310848158d309f57f9068cecfcaef"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classUnicodeString.html">UnicodeString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#085fdd3e06f8a9895f3295ddf202ee92">next</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the next canonically equivalent string. <a href="#085fdd3e06f8a9895f3295ddf202ee92"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#68c9a2ca974735c9399b7c0b831097b9">setSource</a> (const <a class="el" href="classUnicodeString.html">UnicodeString</a> &newSource, <a class="el" href="utypes_8h.html#3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set a new source for this iterator. <a href="#68c9a2ca974735c9399b7c0b831097b9"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="utypes_8h.html#22af10545208a455a6e884008df48e9f">UClassID</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#25c3454df92c11b48492b4c9c540ea73">getDynamicClassID</a> () const</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">ICU "poor man's RTTI", returns a UClassID for the actual class. <a href="#25c3454df92c11b48492b4c9c540ea73"></a><br></td></tr> <tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#bdcec3eed4a26de48c0e9c27f6d2223c">permute</a> (<a class="el" href="classUnicodeString.html">UnicodeString</a> &source, <a class="el" href="umachine_8h.html#349ef00011f20ccd1d3b424445681aa5">UBool</a> skipZeros, Hashtable *result, <a class="el" href="utypes_8h.html#3343c1c8a8377277046774691c98d78c">UErrorCode</a> &status)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Dumb recursive implementation of permutation. <a href="#bdcec3eed4a26de48c0e9c27f6d2223c"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="utypes_8h.html#22af10545208a455a6e884008df48e9f">UClassID</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCanonicalIterator.html#b9ff3b473ca8fc28b9c104633efec51f">getStaticClassID</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">ICU "poor man's RTTI", returns a UClassID for this class. <a href="#b9ff3b473ca8fc28b9c104633efec51f"></a><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> This class allows one to iterate through all the strings that are canonically equivalent to a given string. <p> For example, here are some sample results: Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 1: \u0041\u030A\u0064\u0307\u0327 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 2: \u0041\u030A\u0064\u0327\u0307 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} 3: \u0041\u030A\u1E0B\u0327 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} 4: \u0041\u030A\u1E11\u0307 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} 5: \u00C5\u0064\u0307\u0327 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 6: \u00C5\u0064\u0327\u0307 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} 7: \u00C5\u1E0B\u0327 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} 8: \u00C5\u1E11\u0307 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} 9: \u212B\u0064\u0307\u0327 = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 10: \u212B\u0064\u0327\u0307 = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} 11: \u212B\u1E0B\u0327 = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} 12: \u212B\u1E11\u0307 = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} <br> Note: the code is intended for use with small strings, and is not suitable for larger ones, since it has not been optimized for that situation. Note, <a class="el" href="classCanonicalIterator.html">CanonicalIterator</a> is not intended to be subclassed. <dl class="author" compact><dt><b>Author:</b></dt><dd>M. Davis <p> C++ port by V. Weinstein </dd></dl> <dl compact><dt><b><a class="el" href="stable.html#_stable000036">Stable:</a></b></dt><dd>ICU 2.4 </dd></dl> <p> <p> Definition at line <a class="el" href="caniter_8h-source.html#l00070">70</a> of file <a class="el" href="caniter_8h-source.html">caniter.h</a>.<hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="581c81477525fb72415b732ee787245c"></a><!-- doxytag: member="CanonicalIterator::CanonicalIterator" ref="581c81477525fb72415b732ee787245c" args="(const UnicodeString &source, UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">CanonicalIterator::CanonicalIterator </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="utypes_8h.html#3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Construct a <a class="el" href="classCanonicalIterator.html">CanonicalIterator</a> object. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>source</em> </td><td>string to get results for </td></tr> <tr><td valign="top"></td><td valign="top"><em>status</em> </td><td>Fill-in parameter which receives the status of this operation. </td></tr> </table> </dl> <dl compact><dt><b><a class="el" href="stable.html#_stable000037">Stable:</a></b></dt><dd>ICU 2.4 </dd></dl> </div> </div><p> <a class="anchor" name="be0bf9f1eff2eb424a2882da89925fbb"></a><!-- doxytag: member="CanonicalIterator::~CanonicalIterator" ref="be0bf9f1eff2eb424a2882da89925fbb" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual CanonicalIterator::~CanonicalIterator </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Destructor Cleans pieces. <p> <dl compact><dt><b><a class="el" href="stable.html#_stable000038">Stable:</a></b></dt><dd>ICU 2.4 </dd></dl> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="a9fa2c21b52c2e2cac9e8f76aefde683"></a><!-- doxytag: member="CanonicalIterator::getSource" ref="a9fa2c21b52c2e2cac9e8f76aefde683" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classUnicodeString.html">UnicodeString</a> CanonicalIterator::getSource </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Gets the NFD form of the current source we are iterating over. <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>gets the source: NOTE: it is the NFD form of source </dd></dl> <dl compact><dt><b><a class="el" href="stable.html#_stable000039">Stable:</a></b></dt><dd>ICU 2.4 </dd></dl> </div> </div><p> <a class="anchor" name="561310848158d309f57f9068cecfcaef"></a><!-- doxytag: member="CanonicalIterator::reset" ref="561310848158d309f57f9068cecfcaef" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CanonicalIterator::reset </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Resets the iterator so that one can start again from the beginning. <p> <dl compact><dt><b><a class="el" href="stable.html#_stable000040">Stable:</a></b></dt><dd>ICU 2.4 </dd></dl> </div> </div><p> <a class="anchor" name="085fdd3e06f8a9895f3295ddf202ee92"></a><!-- doxytag: member="CanonicalIterator::next" ref="085fdd3e06f8a9895f3295ddf202ee92" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classUnicodeString.html">UnicodeString</a> CanonicalIterator::next </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Get the next canonically equivalent string. <p> <br> <b>Warning: The strings are not guaranteed to be in any particular order.</b> <dl class="return" compact><dt><b>Returns:</b></dt><dd>the next string that is canonically equivalent. A bogus string is returned when the iteration is done. </dd></dl> <dl compact><dt><b><a class="el" href="stable.html#_stable000041">Stable:</a></b></dt><dd>ICU 2.4 </dd></dl> </div> </div><p> <a class="anchor" name="68c9a2ca974735c9399b7c0b831097b9"></a><!-- doxytag: member="CanonicalIterator::setSource" ref="68c9a2ca974735c9399b7c0b831097b9" args="(const UnicodeString &newSource, UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CanonicalIterator::setSource </td> <td>(</td> <td class="paramtype">const <a class="el" href="classUnicodeString.html">UnicodeString</a> & </td> <td class="paramname"> <em>newSource</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="utypes_8h.html#3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Set a new source for this iterator. <p> Allows object reuse. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>newSource</em> </td><td>the source string to iterate against. This allows the same iterator to be used while changing the source string, saving object creation. </td></tr> <tr><td valign="top"></td><td valign="top"><em>status</em> </td><td>Fill-in parameter which receives the status of this operation. </td></tr> </table> </dl> <dl compact><dt><b><a class="el" href="stable.html#_stable000042">Stable:</a></b></dt><dd>ICU 2.4 </dd></dl> </div> </div><p> <a class="anchor" name="bdcec3eed4a26de48c0e9c27f6d2223c"></a><!-- doxytag: member="CanonicalIterator::permute" ref="bdcec3eed4a26de48c0e9c27f6d2223c" args="(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void CanonicalIterator::permute </td> <td>(</td> <td class="paramtype"><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="umachine_8h.html#349ef00011f20ccd1d3b424445681aa5">UBool</a> </td> <td class="paramname"> <em>skipZeros</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Hashtable * </td> <td class="paramname"> <em>result</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="utypes_8h.html#3343c1c8a8377277046774691c98d78c">UErrorCode</a> & </td> <td class="paramname"> <em>status</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Dumb recursive implementation of permutation. <p> TODO: optimize <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>source</em> </td><td>the string to find permutations for </td></tr> <tr><td valign="top"></td><td valign="top"><em>skipZeros</em> </td><td>determine if skip zeros </td></tr> <tr><td valign="top"></td><td valign="top"><em>result</em> </td><td>the results in a set. </td></tr> <tr><td valign="top"></td><td valign="top"><em>status</em> </td><td>Fill-in parameter which receives the status of this operation. </td></tr> </table> </dl> <dl compact><dt><b><a class="el" href="internal.html#_internal000007">Internal:</a></b></dt><dd>Do not use. This API is for interal use only. </dd></dl> </div> </div><p> <a class="anchor" name="b9ff3b473ca8fc28b9c104633efec51f"></a><!-- doxytag: member="CanonicalIterator::getStaticClassID" ref="b9ff3b473ca8fc28b9c104633efec51f" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="utypes_8h.html#22af10545208a455a6e884008df48e9f">UClassID</a> CanonicalIterator::getStaticClassID </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> ICU "poor man's RTTI", returns a UClassID for this class. <p> <dl compact><dt><b><a class="el" href="stable.html#_stable000043">Stable:</a></b></dt><dd>ICU 2.2 </dd></dl> </div> </div><p> <a class="anchor" name="25c3454df92c11b48492b4c9c540ea73"></a><!-- doxytag: member="CanonicalIterator::getDynamicClassID" ref="25c3454df92c11b48492b4c9c540ea73" args="() const" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="utypes_8h.html#22af10545208a455a6e884008df48e9f">UClassID</a> CanonicalIterator::getDynamicClassID </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> ICU "poor man's RTTI", returns a UClassID for the actual class. <p> <dl compact><dt><b><a class="el" href="stable.html#_stable000044">Stable:</a></b></dt><dd>ICU 2.2 </dd></dl> <p> Implements <a class="el" href="classUObject.html#ce1dd31fb2c6f2c07dfebe8fd240ec37">UObject</a>. </div> </div><p> <hr>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="caniter_8h-source.html">caniter.h</a></ul> <hr size="1"><address style="align: right;"><small>Generated on Fri Sep 14 12:59:38 2007 for ICU 3.8 by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address> </body> </html>