<!-- 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: sortkey.h Source File</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><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><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="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <h1>sortkey.h</h1><a href="sortkey_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> *****************************************************************************</span> <a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 1996-2006, International Business Machines Corporation and others.</span> <a name="l00004"></a>00004 <span class="comment"> * All Rights Reserved.</span> <a name="l00005"></a>00005 <span class="comment"> *****************************************************************************</span> <a name="l00006"></a>00006 <span class="comment"> *</span> <a name="l00007"></a>00007 <span class="comment"> * File sortkey.h</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * Created by: Helena Shih</span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * Modification History:</span> <a name="l00012"></a>00012 <span class="comment"> *</span> <a name="l00013"></a>00013 <span class="comment"> * Date Name Description</span> <a name="l00014"></a>00014 <span class="comment"> *</span> <a name="l00015"></a>00015 <span class="comment"> * 6/20/97 helena Java class name change.</span> <a name="l00016"></a>00016 <span class="comment"> * 8/18/97 helena Added internal API documentation.</span> <a name="l00017"></a>00017 <span class="comment"> * 6/26/98 erm Changed to use byte arrays and memcmp.</span> <a name="l00018"></a>00018 <span class="comment"> *****************************************************************************</span> <a name="l00019"></a>00019 <span class="comment"> */</span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#ifndef SORTKEY_H</span> <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define SORTKEY_H</span> <a name="l00023"></a>00023 <span class="preprocessor"></span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="utypes_8h.html" title="Basic definitions for ICU, for both C and C++ APIs.">unicode/utypes.h</a>"</span> <a name="l00025"></a>00025 <a name="l00031"></a>00031 <span class="preprocessor">#if !UCONFIG_NO_COLLATION</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="uobject_8h.html" title="C++ API: Common ICU base class UObject.">unicode/uobject.h</a>"</span> <a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="unistr_8h.html" title="C++ API: Unicode String.">unicode/unistr.h</a>"</span> <a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="coll_8h.html" title="C++ API: Collation Service.">unicode/coll.h</a>"</span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <a class="code" href="uversion_8h.html#a7d9374e037299886d4192b763b4c5e8b" title="This is used to begin a declaration of a public ICU C++ API.">U_NAMESPACE_BEGIN</a> <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="comment">/* forward declaration */</span> <a name="l00040"></a>00040 <span class="keyword">class </span><a class="code" href="classRuleBasedCollator.html" title="The RuleBasedCollator class provides the simple implementation of Collator, using...">RuleBasedCollator</a>; <a name="l00041"></a>00041 <a name="l00096"></a><a class="code" href="classCollationKey.html">00096</a> <span class="keyword">class </span><a class="code" href="utypes_8h.html#ab9d90a30137b6ec046fe59e79b09745a" title="Set to export library symbols from inside the i18n library, and to import them from...">U_I18N_API</a> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a> : <span class="keyword">public</span> <a class="code" href="classUObject.html" title="UObject is the common ICU &quot;boilerplate&quot; class.">UObject</a> { <a name="l00097"></a>00097 <span class="keyword">public</span>: <a name="l00105"></a>00105 <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>(); <a name="l00106"></a>00106 <a name="l00107"></a>00107 <a name="l00114"></a>00114 <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>(<span class="keyword">const</span> uint8_t* values, <a name="l00115"></a>00115 int32_t count); <a name="l00116"></a>00116 <a name="l00122"></a>00122 <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>(<span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& other); <a name="l00123"></a>00123 <a name="l00128"></a>00128 <span class="keyword">virtual</span> ~<a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>(); <a name="l00129"></a>00129 <a name="l00135"></a>00135 <span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& operator=(<span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& other); <a name="l00136"></a>00136 <a name="l00143"></a>00143 <a class="code" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5" title="The ICU boolean type.">UBool</a> <a class="code" href="stringpiece_8h.html#a7652049cbac0bfeae2cd2aa4514a3352" title="Global operator == for StringPiece.">operator==</a>(<span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& source) <span class="keyword">const</span>; <a name="l00144"></a>00144 <a name="l00151"></a>00151 <a class="code" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5" title="The ICU boolean type.">UBool</a> <a class="code" href="stringpiece_8h.html#abf0ccab9536bab551afc07de65eb5d95" title="Global operator != for StringPiece.">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& source) <span class="keyword">const</span>; <a name="l00152"></a>00152 <a name="l00153"></a>00153 <a name="l00160"></a>00160 <a class="code" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5" title="The ICU boolean type.">UBool</a> isBogus(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00161"></a>00161 <a name="l00171"></a>00171 <span class="keyword">const</span> uint8_t* getByteArray(int32_t& count) <span class="keyword">const</span>; <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="preprocessor">#ifdef U_USE_COLLATION_KEY_DEPRECATES</span> <a name="l00174"></a>00174 <span class="preprocessor"></span> <a name="l00181"></a>00181 uint8_t* toByteArray(int32_t& count) <span class="keyword">const</span>; <a name="l00182"></a>00182 <span class="preprocessor">#endif</span> <a name="l00183"></a>00183 <span class="preprocessor"></span> <a name="l00193"></a>00193 <a class="code" href="classCollator.html#a05f22f81363f2613bea18a632b67686f" title="LESS is returned if source string is compared to be less than target string in the...">Collator::EComparisonResult</a> compareTo(<span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& target) <span class="keyword">const</span>; <a name="l00194"></a>00194 <a name="l00205"></a>00205 <a class="code" href="ucol_8h.html#a8b4e71db8109af87f84ac1576e2b245d" title="UCOL_LESS is returned if source string is compared to be less than target string...">UCollationResult</a> compareTo(<span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& target, <a class="code" href="utypes_8h.html#a3343c1c8a8377277046774691c98d78c" title="Error code to replace exception handling, so that the code is compatible with all...">UErrorCode</a> &status) <span class="keyword">const</span>; <a name="l00206"></a>00206 <a name="l00227"></a>00227 int32_t hashCode(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00228"></a>00228 <a name="l00233"></a>00233 <span class="keyword">virtual</span> <a class="code" href="utypes_8h.html#a22af10545208a455a6e884008df48e9f" title="UClassID is used to identify classes without using RTTI, since RTTI is not yet supported...">UClassID</a> <a class="code" href="classUObject.html#a9b1acc95efd89cb86ec31f2dc947a262" title="ICU4C &quot;poor man&#39;s RTTI&quot;, returns a UClassID for the actual ICU class...">getDynamicClassID</a>() <span class="keyword">const</span>; <a name="l00234"></a>00234 <a name="l00239"></a>00239 <span class="keyword">static</span> <a class="code" href="utypes_8h.html#a22af10545208a455a6e884008df48e9f" title="UClassID is used to identify classes without using RTTI, since RTTI is not yet supported...">UClassID</a> <a class="code" href="platform_8h.html#a72bf6d8ec0640a37b1915e5d853b2016">U_EXPORT2</a> getStaticClassID(); <a name="l00240"></a>00240 <a name="l00241"></a>00241 <span class="keyword">private</span>: <a name="l00249"></a>00249 <span class="keywordtype">void</span> adopt(uint8_t *values, int32_t count); <a name="l00250"></a>00250 <a name="l00251"></a>00251 <span class="comment">/*</span> <a name="l00252"></a>00252 <span class="comment"> * Creates a collation key with a string.</span> <a name="l00253"></a>00253 <span class="comment"> */</span> <a name="l00254"></a>00254 <a name="l00261"></a>00261 <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& ensureCapacity(int32_t newSize); <a name="l00266"></a>00266 <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& setToBogus(<span class="keywordtype">void</span>); <a name="l00271"></a>00271 <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& reset(<span class="keywordtype">void</span>); <a name="l00272"></a>00272 <a name="l00276"></a><a class="code" href="classCollationKey.html#a1918e53ed4bb8208fdd6df3ed4ec2548">00276</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classRuleBasedCollator.html" title="The RuleBasedCollator class provides the simple implementation of Collator, using...">RuleBasedCollator</a>; <a name="l00280"></a>00280 <a class="code" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5" title="The ICU boolean type.">UBool</a> fBogus; <a name="l00285"></a>00285 int32_t fCount; <a name="l00289"></a>00289 int32_t fCapacity; <a name="l00293"></a>00293 int32_t fHashCode; <a name="l00297"></a>00297 uint8_t* fBytes; <a name="l00298"></a>00298 <a name="l00299"></a>00299 }; <a name="l00300"></a>00300 <a name="l00301"></a>00301 <span class="keyword">inline</span> <a class="code" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5" title="The ICU boolean type.">UBool</a> <a name="l00302"></a><a class="code" href="classCollationKey.html#a85bb52c50f3baf2aad76282f719d6193">00302</a> <a class="code" href="classCollationKey.html#a85bb52c50f3baf2aad76282f719d6193" title="Compare if two collation keys are not the same.">CollationKey::operator!=</a>(<span class="keyword">const</span> <a class="code" href="classCollationKey.html" title="Collation keys are generated by the Collator class.">CollationKey</a>& other)<span class="keyword"> const</span> <a name="l00303"></a>00303 <span class="keyword"></span>{ <a name="l00304"></a>00304 <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == other); <a name="l00305"></a>00305 } <a name="l00306"></a>00306 <a name="l00307"></a>00307 <span class="keyword">inline</span> <a class="code" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5" title="The ICU boolean type.">UBool</a> <a name="l00308"></a><a class="code" href="classCollationKey.html#a2b5cbecf80d0c583ec608eb88628f4bd">00308</a> <a class="code" href="classCollationKey.html#a2b5cbecf80d0c583ec608eb88628f4bd" title="Test to see if the key is in an invalid state.">CollationKey::isBogus</a>()<span class="keyword"> const</span> <a name="l00309"></a>00309 <span class="keyword"></span>{ <a name="l00310"></a>00310 <span class="keywordflow">return</span> fBogus; <a name="l00311"></a>00311 } <a name="l00312"></a>00312 <a name="l00313"></a>00313 <span class="keyword">inline</span> <span class="keyword">const</span> uint8_t* <a name="l00314"></a><a class="code" href="classCollationKey.html#aba4102f9d534cdf6c0ed52e1b5a7578e">00314</a> <a class="code" href="classCollationKey.html#aba4102f9d534cdf6c0ed52e1b5a7578e" title="Returns a pointer to the collation key values.">CollationKey::getByteArray</a>(int32_t &count)<span class="keyword"> const</span> <a name="l00315"></a>00315 <span class="keyword"></span>{ <a name="l00316"></a>00316 count = fCount; <a name="l00317"></a>00317 <span class="keywordflow">return</span> fBytes; <a name="l00318"></a>00318 } <a name="l00319"></a>00319 <a name="l00320"></a>00320 <a class="code" href="uversion_8h.html#a3da1f00f3b02976ac53c014a3e4c0933" title="This is used to end a declaration of a public ICU C++ API.">U_NAMESPACE_END</a> <a name="l00321"></a>00321 <a name="l00322"></a>00322 <span class="preprocessor">#endif </span><span class="comment">/* #if !UCONFIG_NO_COLLATION */</span> <a name="l00323"></a>00323 <a name="l00324"></a>00324 <span class="preprocessor">#endif</span> </pre></div></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>