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 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- q3ptrvector.qdoc -->
<title>Qt 4.8: Q3PtrVector Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li>Qt3SupportLight</li>
<li>Q3PtrVector</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3PtrVector Class Reference</h1>
<!-- $$$Q3PtrVector-brief -->
<p>The Q3PtrVector class is a template collection class that provides a vector (array). <a href="#details">More...</a></p>
<!-- @@@Q3PtrVector -->
<pre class="cpp"> <span class="preprocessor">#include <Q3PtrVector></span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html">Porting to Qt 4</a> for more information.</p>
<p><b>Inherits: </b><a href="q3ptrcollection.html">Q3PtrCollection</a>.</p>
<ul>
<li><a href="q3ptrvector-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#Q3PtrVector">Q3PtrVector</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#Q3PtrVector-2">Q3PtrVector</a></b> ( uint <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#Q3PtrVector-3">Q3PtrVector</a></b> ( const Q3PtrVector<type> & <i>v</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#dtor.Q3PtrVector">~Q3PtrVector</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#at">at</a></b> ( uint <i>i</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#bsearch">bsearch</a></b> ( const type * <i>d</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#contains">contains</a></b> ( const type * <i>d</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#containsRef">containsRef</a></b> ( const type * <i>d</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type ** </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#data">data</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#fill">fill</a></b> ( const type * <i>d</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#find">find</a></b> ( const type * <i>d</i>, uint <i>i</i> = 0 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#findRef">findRef</a></b> ( const type * <i>d</i>, uint <i>i</i> = 0 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#insert">insert</a></b> ( uint <i>i</i>, const type * <i>d</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#remove">remove</a></b> ( uint <i>i</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#resize">resize</a></b> ( uint <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#size">size</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#sort">sort</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#take">take</a></b> ( uint <i>i</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3PtrVector<type> & </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#operator-eq">operator=</a></b> ( const Q3PtrVector<type> & <i>v</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#operator-eq-eq">operator==</a></b> ( const Q3PtrVector<type> & <i>v</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#operator-5b-5d">operator[]</a></b> ( int <i>i</i> ) const</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual uint </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#count">count</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">4 public functions inherited from <a href="q3ptrcollection.html#public-functions">Q3PtrCollection</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#compareItems">compareItems</a></b> ( Q3PtrCollection::Item <i>d1</i>, Q3PtrCollection::Item <i>d2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QDataStream & </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#read">read</a></b> ( QDataStream & <i>s</i>, Q3PtrCollection::Item & <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QDataStream & </td><td class="memItemRight bottomAlign"><b><a href="q3ptrvector.html#write">write</a></b> ( QDataStream & <i>s</i>, Q3PtrCollection::Item <i>item</i> ) const</td></tr>
</table>
<ul>
<li class="fn">2 protected functions inherited from <a href="q3ptrcollection.html#protected-functions">Q3PtrCollection</a></li>
</ul>
<a name="details"></a>
<!-- $$$Q3PtrVector-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3PtrVector class is a template collection class that provides a vector (array).</p>
<p><a href="q3valuevector.html">Q3ValueVector</a> is an STL-compatible alternative to this class.</p>
<p>Q3PtrVector is implemented as a template class. Defines a template instance Q3PtrVector<X> to create a vector that contains pointers to X (X*).</p>
<p>A vector is the same as an array. The main difference between Q3PtrVector and <a href="q3memarray.html">Q3MemArray</a> is that Q3PtrVector stores pointers to the elements, whereas <a href="q3memarray.html">Q3MemArray</a> stores the elements themselves (i.e. <a href="q3memarray.html">Q3MemArray</a> is value-based and Q3PtrVector is pointer-based).</p>
<p>Items are added to the vector using <a href="q3ptrvector.html#insert">insert</a>() or <a href="q3ptrvector.html#fill">fill</a>(). Items are removed with <a href="q3ptrvector.html#remove">remove</a>(). You can get a pointer to an item at a particular index position using <a href="q3ptrvector.html#at">at</a>().</p>
<p>Unless otherwise stated, all functions that remove items from the vector will also delete the element pointed to if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled. By default, auto-deletion is disabled; see <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>(). This behavior can be changed in a subclass by reimplementing the virtual function <a href="q3ptrcollection.html#deleteItem">deleteItem</a>().</p>
<p>Functions that compare items (<a href="q3ptrvector.html#find">find</a>() and <a href="q3ptrvector.html#sort">sort</a>() for example) will do so using the virtual function <a href="q3ptrvector.html#compareItems">compareItems</a>(). The default implementation of this function only compares the pointer values. Reimplement <a href="q3ptrvector.html#compareItems">compareItems</a>() in a subclass to get searching and sorting based on the item contents. You can perform a linear search for a pointer in the vector using <a href="q3ptrvector.html#findRef">findRef</a>(), or a binary search (of a sorted vector) using <a href="q3ptrvector.html#bsearch">bsearch</a>(). You can count the number of times an item appears in the vector with <a href="q3ptrvector.html#contains">contains</a>() or <a href="q3ptrvector.html#containsRef">containsRef</a>().</p>
</div>
<p><b>See also </b><a href="q3memarray.html">Q3MemArray</a>.</p>
<!-- @@@Q3PtrVector -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3PtrVector[overload1]$$$Q3PtrVector -->
<h3 class="fn"><a name="Q3PtrVector"></a>Q3PtrVector::<span class="name">Q3PtrVector</span> ()</h3>
<p>Constructs a null vector.</p>
<p><b>See also </b><a href="q3ptrvector.html#isNull">isNull</a>().</p>
<!-- @@@Q3PtrVector -->
<!-- $$$Q3PtrVector$$$Q3PtrVectoruint -->
<h3 class="fn"><a name="Q3PtrVector-2"></a>Q3PtrVector::<span class="name">Q3PtrVector</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>size</i> )</h3>
<p>Constructs an vector with room for <i>size</i> items. Makes a null vector if <i>size</i> == 0.</p>
<p>All <i>size</i> positions in the vector are initialized to 0.</p>
<p><b>See also </b><a href="q3ptrvector.html#size">size</a>(), <a href="q3ptrvector.html#resize">resize</a>(), and <a href="q3ptrvector.html#isNull">isNull</a>().</p>
<!-- @@@Q3PtrVector -->
<!-- $$$Q3PtrVector$$$Q3PtrVectorconstQ3PtrVector<type>& -->
<h3 class="fn"><a name="Q3PtrVector-3"></a>Q3PtrVector::<span class="name">Q3PtrVector</span> ( const <span class="type">Q3PtrVector</span><<span class="type">type</span>> & <i>v</i> )</h3>
<p>Constructs a copy of <i>v</i>. Only the pointers are copied (i.e. shallow copy).</p>
<!-- @@@Q3PtrVector -->
<!-- $$$~Q3PtrVector[overload1]$$$~Q3PtrVector -->
<h3 class="fn"><a name="dtor.Q3PtrVector"></a>Q3PtrVector::<span class="name">~Q3PtrVector</span> ()</h3>
<p>Removes all items from the vector, and destroys the vector itself.</p>
<p><b>See also </b><a href="q3ptrvector.html#clear">clear</a>().</p>
<!-- @@@~Q3PtrVector -->
<!-- $$$at[overload1]$$$atuint -->
<h3 class="fn"><a name="at"></a><span class="type">type</span> * Q3PtrVector::<span class="name">at</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>i</i> ) const</h3>
<p>Returns the item at position <i>i</i>, or 0 if there is no item at that position. <i>i</i> must be less than <a href="q3ptrvector.html#size">size</a>().</p>
<!-- @@@at -->
<!-- $$$bsearch[overload1]$$$bsearchconsttype* -->
<h3 class="fn"><a name="bsearch"></a><span class="type">int</span> Q3PtrVector::<span class="name">bsearch</span> ( const <span class="type">type</span> * <i>d</i> ) const</h3>
<p>In a sorted array, finds the first occurrence of <i>d</i> using a binary search. For a sorted array, this is generally much faster than <a href="q3ptrvector.html#find">find</a>(), which performs a linear search.</p>
<p>Returns the position of <i>d</i>, or -1 if <i>d</i> could not be found. <i>d</i> must not be 0.</p>
<p>Compares items using the virtual function <a href="q3ptrvector.html#compareItems">compareItems</a>().</p>
<p><b>See also </b><a href="q3ptrvector.html#sort">sort</a>() and <a href="q3ptrvector.html#find">find</a>().</p>
<!-- @@@bsearch -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> Q3PtrVector::<span class="name">clear</span> ()<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="q3ptrcollection.html#clear">Q3PtrCollection::clear</a>().</p>
<p>Removes all items from the vector, and destroys the vector itself.</p>
<p>The vector becomes a null vector.</p>
<p><b>See also </b><a href="q3ptrvector.html#isNull">isNull</a>().</p>
<!-- @@@clear -->
<!-- $$$compareItems[overload1]$$$compareItemsQ3PtrCollection::ItemQ3PtrCollection::Item -->
<h3 class="fn"><a name="compareItems"></a><span class="type">int</span> Q3PtrVector::<span class="name">compareItems</span> ( <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> <i>d1</i>, <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> <i>d2</i> )<tt> [virtual protected]</tt></h3>
<p>This virtual function compares two list items.</p>
<p>Returns:</p>
<ul>
<li>zero if <i>d1</i> == <i>d2</i></li>
<li>nonzero if <i>d1</i> != <i>d2</i></li>
</ul>
<p>This function returns <i>int</i> rather than <i>bool</i> so that reimplementations can return one of three values and use it to sort by:</p>
<ul>
<li>0 if <i>d1</i> == <i>d2</i></li>
<li>> 0 (positive integer) if <i>d1</i> > <i>d2</i></li>
<li>< 0 (negative integer) if <i>d1</i> < <i>d2</i></li>
</ul>
<p>The <a href="q3ptrvector.html#sort">sort</a>() and <a href="q3ptrvector.html#bsearch">bsearch</a>() functions require compareItems() to be implemented as described here.</p>
<p>This function should not modify the vector because some const functions call compareItems().</p>
<!-- @@@compareItems -->
<!-- $$$contains[overload1]$$$containsconsttype* -->
<h3 class="fn"><a name="contains"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3PtrVector::<span class="name">contains</span> ( const <span class="type">type</span> * <i>d</i> ) const</h3>
<p>Returns the number of occurrences of item <i>d</i> in the vector.</p>
<p>Compares items using the virtual function <a href="q3ptrvector.html#compareItems">compareItems</a>().</p>
<p><b>See also </b><a href="q3ptrvector.html#containsRef">containsRef</a>().</p>
<!-- @@@contains -->
<!-- $$$containsRef[overload1]$$$containsRefconsttype* -->
<h3 class="fn"><a name="containsRef"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3PtrVector::<span class="name">containsRef</span> ( const <span class="type">type</span> * <i>d</i> ) const</h3>
<p>Returns the number of occurrences of the item pointer <i>d</i> in the vector.</p>
<p>This function does <i>not</i> use <a href="q3ptrvector.html#compareItems">compareItems</a>() to compare items.</p>
<p><b>See also </b><a href="q3ptrvector.html#findRef">findRef</a>().</p>
<!-- @@@containsRef -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn"><a name="count"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3PtrVector::<span class="name">count</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="q3ptrcollection.html#count">Q3PtrCollection::count</a>().</p>
<p>Returns the number of items in the vector. The vector is empty if count() == 0.</p>
<p><b>See also </b><a href="q3ptrvector.html#isEmpty">isEmpty</a>(), <a href="q3ptrvector.html#size">size</a>(), and <a href="q3ptrvector.html#isNull">isNull</a>().</p>
<!-- @@@count -->
<!-- $$$data[overload1]$$$data -->
<h3 class="fn"><a name="data"></a><span class="type">type</span> ** Q3PtrVector::<span class="name">data</span> () const</h3>
<p>Returns a pointer to the actual vector data, which is an array of type*.</p>
<p>The vector is a null vector if data() == 0 (null pointer).</p>
<p><b>See also </b><a href="q3ptrvector.html#isNull">isNull</a>().</p>
<!-- @@@data -->
<!-- $$$fill[overload1]$$$fillconsttype*int -->
<h3 class="fn"><a name="fill"></a><span class="type">bool</span> Q3PtrVector::<span class="name">fill</span> ( const <span class="type">type</span> * <i>d</i>, <span class="type">int</span> <i>size</i> = -1 )</h3>
<p>Inserts item <i>d</i> in all positions in the vector. Any existing items are removed. If <i>d</i> is 0, the vector becomes empty.</p>
<p>If <i>size</i> >= 0, the vector is first resized to <i>size</i>. By default, <i>size</i> is -1.</p>
<p>Returns true if successful, i.e. <i>size</i> is the same as the current size, or <i>size</i> is larger and the memory has successfully been allocated; otherwise returns false.</p>
<p><b>See also </b><a href="q3ptrvector.html#resize">resize</a>(), <a href="q3ptrvector.html#insert">insert</a>(), and <a href="q3ptrvector.html#isEmpty">isEmpty</a>().</p>
<!-- @@@fill -->
<!-- $$$find[overload1]$$$findconsttype*uint -->
<h3 class="fn"><a name="find"></a><span class="type">int</span> Q3PtrVector::<span class="name">find</span> ( const <span class="type">type</span> * <i>d</i>, <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>i</i> = 0 ) const</h3>
<p>Finds the first occurrence of item <i>d</i> in the vector using a linear search. The search starts at position <i>i</i>, which must be less than <a href="q3ptrvector.html#size">size</a>(). <i>i</i> is by default 0; i.e. the search starts at the start of the vector.</p>
<p>Returns the position of <i>d</i>, or -1 if <i>d</i> could not be found.</p>
<p>Compares items using the virtual function <a href="q3ptrvector.html#compareItems">compareItems</a>().</p>
<p>Use the much faster <a href="q3ptrvector.html#bsearch">bsearch</a>() to search a sorted vector.</p>
<p><b>See also </b><a href="q3ptrvector.html#findRef">findRef</a>() and <a href="q3ptrvector.html#bsearch">bsearch</a>().</p>
<!-- @@@find -->
<!-- $$$findRef[overload1]$$$findRefconsttype*uint -->
<h3 class="fn"><a name="findRef"></a><span class="type">int</span> Q3PtrVector::<span class="name">findRef</span> ( const <span class="type">type</span> * <i>d</i>, <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>i</i> = 0 ) const</h3>
<p>Finds the first occurrence of the item pointer <i>d</i> in the vector using a linear search. The search starts at position <i>i</i>, which must be less than <a href="q3ptrvector.html#size">size</a>(). <i>i</i> is by default 0; i.e. the search starts at the start of the vector.</p>
<p>Returns the position of <i>d</i>, or -1 if <i>d</i> could not be found.</p>
<p>This function does <i>not</i> use <a href="q3ptrvector.html#compareItems">compareItems</a>() to compare items.</p>
<p>Use the much faster <a href="q3ptrvector.html#bsearch">bsearch</a>() to search a sorted vector.</p>
<p><b>See also </b><a href="q3ptrvector.html#find">find</a>() and <a href="q3ptrvector.html#bsearch">bsearch</a>().</p>
<!-- @@@findRef -->
<!-- $$$insert[overload1]$$$insertuintconsttype* -->
<h3 class="fn"><a name="insert"></a><span class="type">bool</span> Q3PtrVector::<span class="name">insert</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>i</i>, const <span class="type">type</span> * <i>d</i> )</h3>
<p>Sets position <i>i</i> in the vector to contain the item <i>d</i>. <i>i</i> must be less than <a href="q3ptrvector.html#size">size</a>(). Any previous element in position <i>i</i> is removed.</p>
<p>Returns true if <i>i</i> is within range; otherwise returns false.</p>
<p><b>See also </b><a href="q3ptrvector.html#at">at</a>().</p>
<!-- @@@insert -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn"><a name="isEmpty"></a><span class="type">bool</span> Q3PtrVector::<span class="name">isEmpty</span> () const</h3>
<p>Returns true if the vector is empty; otherwise returns false.</p>
<p><b>See also </b><a href="q3ptrvector.html#count">count</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> Q3PtrVector::<span class="name">isNull</span> () const</h3>
<p>Returns true if the vector is null; otherwise returns false.</p>
<p>A null vector has <a href="q3ptrvector.html#size">size</a>() == 0 and <a href="q3ptrvector.html#data">data</a>() == 0.</p>
<p><b>See also </b><a href="q3ptrvector.html#size">size</a>().</p>
<!-- @@@isNull -->
<!-- $$$read[overload1]$$$readQDataStream&Q3PtrCollection::Item& -->
<h3 class="fn"><a name="read"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> & Q3PtrVector::<span class="name">read</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> & <i>s</i>, <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> & <i>item</i> )<tt> [virtual protected]</tt></h3>
<p>Reads a vector item, <i>item</i>, from the stream <i>s</i> and returns a reference to the stream.</p>
<p>The default implementation sets <i>item</i> to 0.</p>
<p><b>See also </b><a href="q3ptrvector.html#write">write</a>().</p>
<!-- @@@read -->
<!-- $$$remove[overload1]$$$removeuint -->
<h3 class="fn"><a name="remove"></a><span class="type">bool</span> Q3PtrVector::<span class="name">remove</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>i</i> )</h3>
<p>Removes the item at position <i>i</i> in the vector, if there is one. <i>i</i> must be less than <a href="q3ptrvector.html#size">size</a>().</p>
<p>Returns true if <i>i</i> is within range; otherwise returns false.</p>
<p><b>See also </b><a href="q3ptrvector.html#take">take</a>() and <a href="q3ptrvector.html#at">at</a>().</p>
<!-- @@@remove -->
<!-- $$$resize[overload1]$$$resizeuint -->
<h3 class="fn"><a name="resize"></a><span class="type">bool</span> Q3PtrVector::<span class="name">resize</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>size</i> )</h3>
<p>Resizes (expands or shrinks) the vector to <i>size</i> elements. The vector becomes a null vector if <i>size</i> == 0.</p>
<p>Any items at position <i>size</i> or beyond in the vector are removed. New positions are initialized to 0.</p>
<p>Returns true if successful, i.e. if the memory was successfully allocated; otherwise returns false.</p>
<p><b>See also </b><a href="q3ptrvector.html#size">size</a>() and <a href="q3ptrvector.html#isNull">isNull</a>().</p>
<!-- @@@resize -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3PtrVector::<span class="name">size</span> () const</h3>
<p>Returns the size of the vector, i.e. the number of vector positions. This is also the maximum number of items the vector can hold.</p>
<p>The vector is a null vector if size() == 0.</p>
<p><b>See also </b><a href="q3ptrvector.html#isNull">isNull</a>(), <a href="q3ptrvector.html#resize">resize</a>(), and <a href="q3ptrvector.html#count">count</a>().</p>
<!-- @@@size -->
<!-- $$$sort[overload1]$$$sort -->
<h3 class="fn"><a name="sort"></a><span class="type">void</span> Q3PtrVector::<span class="name">sort</span> ()</h3>
<p>Sorts the items in ascending order. Any empty positions will be put last.</p>
<p>Compares items using the virtual function <a href="q3ptrvector.html#compareItems">compareItems</a>().</p>
<p><b>See also </b><a href="q3ptrvector.html#bsearch">bsearch</a>().</p>
<!-- @@@sort -->
<!-- $$$take[overload1]$$$takeuint -->
<h3 class="fn"><a name="take"></a><span class="type">type</span> * Q3PtrVector::<span class="name">take</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>i</i> )</h3>
<p>Returns the item at position <i>i</i> in the vector, and removes that item from the vector. <i>i</i> must be less than <a href="q3ptrvector.html#size">size</a>(). If there is no item at position <i>i</i>, 0 is returned.</p>
<p>Unlike <a href="q3ptrvector.html#remove">remove</a>(), this function does <i>not</i> call <a href="q3ptrcollection.html#deleteItem">deleteItem</a>() for the removed item.</p>
<p><b>See also </b><a href="q3ptrvector.html#remove">remove</a>() and <a href="q3ptrvector.html#at">at</a>().</p>
<!-- @@@take -->
<!-- $$$write[overload1]$$$writeQDataStream&Q3PtrCollection::Item -->
<h3 class="fn"><a name="write"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> & Q3PtrVector::<span class="name">write</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> & <i>s</i>, <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> <i>item</i> ) const<tt> [virtual protected]</tt></h3>
<p>Writes a vector item, <i>item</i>, to the stream <i>s</i> and returns a reference to the stream.</p>
<p>The default implementation does nothing.</p>
<p><b>See also </b><a href="q3ptrvector.html#read">read</a>().</p>
<!-- @@@write -->
<!-- $$$operator=[overload1]$$$operator=constQ3PtrVector<type>& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">Q3PtrVector</span><<span class="type">type</span>> & Q3PtrVector::<span class="name">operator=</span> ( const <span class="type">Q3PtrVector</span><<span class="type">type</span>> & <i>v</i> )</h3>
<p>Assigns <i>v</i> to this vector and returns a reference to this vector.</p>
<p>This vector is first cleared and then all the items from <i>v</i> are copied into the vector. Only the pointers are copied (i.e. shallow copy).</p>
<p><b>See also </b><a href="q3ptrvector.html#clear">clear</a>().</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQ3PtrVector<type>& -->
<h3 class="fn"><a name="operator-eq-eq"></a><span class="type">bool</span> Q3PtrVector::<span class="name">operator==</span> ( const <span class="type">Q3PtrVector</span><<span class="type">type</span>> & <i>v</i> ) const</h3>
<p>Returns true if this vector and <i>v</i> are equal; otherwise returns false.</p>
<!-- @@@operator== -->
<!-- $$$operator[][overload1]$$$operator[]int -->
<h3 class="fn"><a name="operator-5b-5d"></a><span class="type">type</span> * Q3PtrVector::<span class="name">operator[]</span> ( <span class="type">int</span> <i>i</i> ) const</h3>
<p>Returns the item at position <i>i</i>, or 0 if there is no item at that position. <i>i</i> must be less than <a href="q3ptrvector.html#size">size</a>().</p>
<p>Equivalent to at(<i>i</i>).</p>
<p><b>See also </b><a href="q3ptrvector.html#at">at</a>().</p>
<!-- @@@operator[] -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|