1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
|
<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: wxSortedArrayString Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td id="projectlogo">
<a href="http://www.wxwidgets.org/" target="_new">
<img alt="wxWidgets" src="logo.png"/>
</a>
</td>
<td style="padding-left: 0.5em; text-align: right;">
<span id="projectnumber">Version: 3.0.2</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<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>Categories</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classwx_sorted_array_string-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">wxSortedArrayString Class Reference<div class="ingroups"><a class="el" href="group__group__class__containers.html">Containers</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <wx/arrstr.h></code></p>
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
<img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for wxSortedArrayString:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><img src="classwx_sorted_array_string__inherit__graph.png" border="0" usemap="#wx_sorted_array_string_inherit__map" alt="Inheritance graph"/></div>
<map name="wx_sorted_array_string_inherit__map" id="wx_sorted_array_string_inherit__map">
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classwx_sorted_array_string.html" title="wxSortedArrayString is an efficient container for storing wxString objects which always keeps the str...">wxSortedArrayString</a> is an efficient container for storing <a class="el" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> objects which always keeps the string in alphabetical order. </p>
<p><a class="el" href="classwx_sorted_array_string.html" title="wxSortedArrayString is an efficient container for storing wxString objects which always keeps the str...">wxSortedArrayString</a> uses binary search in its <a class="el" href="classwx_sorted_array_string.html#a1a9c971831f25c01ababe0a1d5ce8d33" title="Search the element in the array, starting from the beginning if bFromEnd is false or from end otherwi...">wxSortedArrayString::Index()</a> method (instead of linear search for <a class="el" href="classwx_array_string.html#a87d29ec37fca50c5b289c242fbaad2f5" title="Search the element in the array, starting from the beginning if bFromEnd is false or from end otherwi...">wxArrayString::Index()</a>) which makes it much more efficient if you add strings to the array rarely (because, of course, you have to pay for <a class="el" href="classwx_sorted_array_string.html#a1a9c971831f25c01ababe0a1d5ce8d33" title="Search the element in the array, starting from the beginning if bFromEnd is false or from end otherwi...">Index()</a> efficiency by having <a class="el" href="classwx_sorted_array_string.html#ae23142317aff290ee6363f02d67ca2cc" title="Appends the given number of copies of the new item str to the array and returns the index of the firs...">Add()</a> be slower) but search for them often. Several methods should not be used with sorted array (basically, all those which break the order of items) which is mentioned in their description.</p>
<h2></h2>
<div><span class="lib">Library:</span>  <span class="lib_text"><a class="el" href="page_libs.html#page_libs_wxbase">wxBase</a></span></div><div><span class="category">Category:</span>  <span class="category_text"><a class="el" href="group__group__class__containers.html">Containers</a></span></div><dl class="section see"><dt>See Also</dt><dd>wxArray, <a class="el" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a>, <a class="el" href="overview_string.html">wxString Overview</a> </dd></dl>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a749e5ba32eca259199472427eb29199f"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_sorted_array_string.html#a749e5ba32eca259199472427eb29199f">wxSortedArrayString</a> (const <a class="el" href="classwx_array_string.html">wxArrayString</a> &array)</td></tr>
<tr class="memdesc:a749e5ba32eca259199472427eb29199f"><td class="mdescLeft"> </td><td class="mdescRight">Conversion constructor. <a href="#a749e5ba32eca259199472427eb29199f"></a><br/></td></tr>
<tr class="separator:a749e5ba32eca259199472427eb29199f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae23142317aff290ee6363f02d67ca2cc"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_sorted_array_string.html#ae23142317aff290ee6363f02d67ca2cc">Add</a> (const <a class="el" href="classwx_string.html">wxString</a> &str, size_t copies=1)</td></tr>
<tr class="memdesc:ae23142317aff290ee6363f02d67ca2cc"><td class="mdescLeft"> </td><td class="mdescRight">Appends the given number of <em>copies</em> of the new item <em>str</em> to the array and returns the index of the first new item in the array. <a href="#ae23142317aff290ee6363f02d67ca2cc"></a><br/></td></tr>
<tr class="separator:ae23142317aff290ee6363f02d67ca2cc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1a9c971831f25c01ababe0a1d5ce8d33"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_sorted_array_string.html#a1a9c971831f25c01ababe0a1d5ce8d33">Index</a> (const <a class="el" href="classwx_string.html">wxString</a> &sz, bool bCase=true, bool bFromEnd=false) const </td></tr>
<tr class="memdesc:a1a9c971831f25c01ababe0a1d5ce8d33"><td class="mdescLeft"> </td><td class="mdescRight">Search the element in the array, starting from the beginning if <em>bFromEnd</em> is <span class="literal">false</span> or from end otherwise. <a href="#a1a9c971831f25c01ababe0a1d5ce8d33"></a><br/></td></tr>
<tr class="separator:a1a9c971831f25c01ababe0a1d5ce8d33"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab9d85c1a7d21952209d6fc87dbb5be32"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_sorted_array_string.html#ab9d85c1a7d21952209d6fc87dbb5be32">Insert</a> (const <a class="el" href="classwx_string.html">wxString</a> &str, size_t nIndex, size_t copies=1)</td></tr>
<tr class="separator:ab9d85c1a7d21952209d6fc87dbb5be32"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:abecc9015c35ee342e594c5fa9f76a927"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_sorted_array_string.html#abecc9015c35ee342e594c5fa9f76a927">Sort</a> (bool reverseOrder=false)</td></tr>
<tr class="separator:abecc9015c35ee342e594c5fa9f76a927"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0661fc0625d585d1bca263da7a14f608"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_sorted_array_string.html#a0661fc0625d585d1bca263da7a14f608">Sort</a> (CompareFunction compareFunction)</td></tr>
<tr class="separator:a0661fc0625d585d1bca263da7a14f608"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="a749e5ba32eca259199472427eb29199f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxSortedArrayString::wxSortedArrayString </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_array_string.html">wxArrayString</a> & </td>
<td class="paramname"><em>array</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Conversion constructor. </p>
<p>Constructs a sorted array with the same contents as the (possibly unsorted) "array" argument. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ae23142317aff290ee6363f02d67ca2cc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t wxSortedArrayString::Add </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>str</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>copies</em> = <code>1</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Appends the given number of <em>copies</em> of the new item <em>str</em> to the array and returns the index of the first new item in the array. </p>
<p><dl class="section see"><dt>See Also</dt><dd><a class="el" href="classwx_array_string.html#a9913831038ad76b0c4386cbd095b8e0d" title="Insert the given number of copies of the new element in the array before the position nIndex...">Insert()</a> </dd></dl>
</p>
<dl class="section warning"><dt>Warning</dt><dd>For sorted arrays, the index of the inserted item will not be, in general, equal to GetCount() - 1 because the item is inserted at the correct position to keep the array sorted and not appended. </dd></dl>
</div>
</div>
<a class="anchor" id="a1a9c971831f25c01ababe0a1d5ce8d33"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int wxSortedArrayString::Index </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>sz</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>bCase</em> = <code>true</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>bFromEnd</em> = <code>false</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Search the element in the array, starting from the beginning if <em>bFromEnd</em> is <span class="literal">false</span> or from end otherwise. </p>
<p>If <em>bCase</em>, comparison is case sensitive (default), otherwise the case is ignored.This function uses linear search for <a class="el" href="classwx_array_string.html" title="wxArrayString is an efficient container for storing wxString objects.">wxArrayString</a>. Returns index of the first item matched or <code>wxNOT_FOUND</code> if there is no match. </p>
<p>This function uses binary search for <a class="el" href="classwx_sorted_array_string.html" title="wxSortedArrayString is an efficient container for storing wxString objects which always keeps the str...">wxSortedArrayString</a>, but it ignores the <em>bCase</em> and <em>bFromEnd</em> parameters. </p>
</div>
</div>
<a class="anchor" id="ab9d85c1a7d21952209d6fc87dbb5be32"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxSortedArrayString::Insert </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>str</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>nIndex</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>copies</em> = <code>1</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section warning"><dt>Warning</dt><dd>This function should not be used with sorted arrays because it could break the order of items and, for example, subsequent calls to <a class="el" href="classwx_sorted_array_string.html#a1a9c971831f25c01ababe0a1d5ce8d33" title="Search the element in the array, starting from the beginning if bFromEnd is false or from end otherwi...">Index()</a> would then not work!</dd>
<dd>
In STL mode, Insert is private and simply invokes wxFAIL_MSG. </dd></dl>
</div>
</div>
<a class="anchor" id="abecc9015c35ee342e594c5fa9f76a927"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxSortedArrayString::Sort </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"><em>reverseOrder</em> = <code>false</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section warning"><dt>Warning</dt><dd>This function should not be used with sorted array because it could break the order of items and, for example, subsequent calls to <a class="el" href="classwx_sorted_array_string.html#a1a9c971831f25c01ababe0a1d5ce8d33" title="Search the element in the array, starting from the beginning if bFromEnd is false or from end otherwi...">Index()</a> would then not work! Also, sorting a <a class="el" href="classwx_sorted_array_string.html" title="wxSortedArrayString is an efficient container for storing wxString objects which always keeps the str...">wxSortedArrayString</a> doesn't make sense because its elements are always already sorted.</dd>
<dd>
In STL mode, Sort is private and simply invokes wxFAIL_MSG. </dd></dl>
</div>
</div>
<a class="anchor" id="a0661fc0625d585d1bca263da7a14f608"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxSortedArrayString::Sort </td>
<td>(</td>
<td class="paramtype">CompareFunction </td>
<td class="paramname"><em>compareFunction</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section warning"><dt>Warning</dt><dd>This function should not be used with sorted array because it could break the order of items and, for example, subsequent calls to <a class="el" href="classwx_sorted_array_string.html#a1a9c971831f25c01ababe0a1d5ce8d33" title="Search the element in the array, starting from the beginning if bFromEnd is false or from end otherwi...">Index()</a> would then not work! Also, sorting a <a class="el" href="classwx_sorted_array_string.html" title="wxSortedArrayString is an efficient container for storing wxString objects which always keeps the str...">wxSortedArrayString</a> doesn't make sense because its elements are always already sorted.</dd>
<dd>
In STL mode, Sort is private and simply invokes wxFAIL_MSG. </dd></dl>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:58 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>
|