Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 3461

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- q3ptrcollection.cpp -->
<head>
  <title>Qt 4.6: Q3PtrCollection Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//Q3PtrCollection"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">Q3PtrCollection Class Reference<br /><span class="small-subtitle">[<a href="qt3support.html">Qt3Support</a> module]</span>
</h1>
<p>The Q3PtrCollection class is the base class of most pointer-based Qt collections. <a href="#details">More...</a></p>
<pre> #include &lt;Q3PtrCollection&gt;</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>Inherited by <a href="q3asciicache.html">Q3AsciiCache</a>, <a href="q3asciidict.html">Q3AsciiDict</a>, <a href="q3cache.html">Q3Cache</a>, <a href="q3dict.html">Q3Dict</a>, <a href="q3intcache.html">Q3IntCache</a>, <a href="q3intdict.html">Q3IntDict</a>, <a href="q3ptrdict.html">Q3PtrDict</a>, <a href="q3ptrlist.html">Q3PtrList</a>, <a href="q3ptrqueue.html">Q3PtrQueue</a>, <a href="q3ptrstack.html">Q3PtrStack</a>, and <a href="q3ptrvector.html">Q3PtrVector</a>.</p>
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="q3ptrcollection-members.html">List of all members, including inherited members</a></li>
</ul>
<hr />
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#Item-typedef">Item</a></b></td></tr>
</table>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#autoDelete">autoDelete</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#clear">clear</a></b> () = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual uint </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#count">count</a></b> () const = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a></b> ( bool <i>enable</i> )</td></tr>
</table>
<hr />
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#Q3PtrCollection">Q3PtrCollection</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#Q3PtrCollection-2">Q3PtrCollection</a></b> ( const Q3PtrCollection &amp; <i>source</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#dtor.Q3PtrCollection">~Q3PtrCollection</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#deleteItem">deleteItem</a></b> ( Item <i>d</i> ) = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual Item </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrcollection.html#newItem">newItem</a></b> ( Item <i>d</i> )</td></tr>
</table>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The Q3PtrCollection class is the base class of most pointer-based Qt collections.</p>
<p>The Q3PtrCollection class is an abstract base class for the Qt collection classes QDict, <a href="q3ptrlist.html">Q3PtrList</a>, etc.</p>
<p>A Q3PtrCollection only knows about the number of objects in the collection and the deletion strategy (see <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>()).</p>
<p>A collection is implemented using the <tt>Item</tt> (generic collection item) type, which is a <tt>void*</tt>. The template classes that create the real collections cast the <tt>Item</tt> to the required type.</p>
<hr />
<h2>Member Type Documentation</h2>
<a name="//apple_ref/cpp/tdef/Q3PtrCollection/Item"></a>
<h3 class="fn"><a name="Item-typedef"></a>typedef Q3PtrCollection::Item</h3>
<p>This type is the generic &quot;item&quot; in a <a href="q3ptrcollection.html" class="compat">Q3PtrCollection</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/Q3PtrCollection"></a>
<h3 class="fn"><a name="Q3PtrCollection"></a>Q3PtrCollection::Q3PtrCollection ()&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Constructs a collection. The constructor is protected because <a href="q3ptrcollection.html" class="compat">Q3PtrCollection</a> is an abstract class.</p>
<h3 class="fn"><a name="Q3PtrCollection-2"></a>Q3PtrCollection::Q3PtrCollection ( const Q3PtrCollection &amp; <i>source</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Constructs a copy of <i>source</i> with <a href="q3ptrcollection.html#autoDelete">autoDelete</a>() set to false. The constructor is protected because <a href="q3ptrcollection.html" class="compat">Q3PtrCollection</a> is an abstract class.</p>
<p>Note that if <i>source</i> has autoDelete turned on, copying it will risk memory leaks, reading freed memory, or both.</p>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/~Q3PtrCollection"></a>
<h3 class="fn"><a name="dtor.Q3PtrCollection"></a>Q3PtrCollection::~Q3PtrCollection ()&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Destroys the collection. The destructor is protected because <a href="q3ptrcollection.html" class="compat">Q3PtrCollection</a> is an abstract class.</p>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/autoDelete"></a>
<h3 class="fn"><a name="autoDelete"></a>bool Q3PtrCollection::autoDelete () const</h3>
<p>Returns the setting of the auto-delete option. The default is false.</p>
<p>See also <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/clear"></a>
<h3 class="fn"><a name="clear"></a>void Q3PtrCollection::clear ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Removes all objects from the collection. The objects will be deleted if auto-delete has been enabled.</p>
<p>See also <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/count"></a>
<h3 class="fn"><a name="count"></a><a href="qtglobal.html#uint-typedef">uint</a> Q3PtrCollection::count () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the number of objects in the collection.</p>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/deleteItem"></a>
<h3 class="fn"><a name="deleteItem"></a>void Q3PtrCollection::deleteItem ( <a href="q3ptrcollection.html#Item-typedef">Item</a> <i>d</i> )&nbsp;&nbsp;<tt> [pure virtual protected]</tt></h3>
<p>Reimplement this function if you want to be able to delete items.</p>
<p>Deletes an item that is about to be removed from the collection.</p>
<p>This function has to reimplemented in the collection template classes, and should <i>only</i> delete item <i>d</i> if auto-delete has been enabled.</p>
<p><b>Warning:</b> If you reimplement this function you must also reimplement the destructor and call the virtual function <a href="q3ptrcollection.html#clear">clear</a>() from your destructor. This is due to the way virtual functions and destructors work in C++: Virtual functions in derived classes cannot be called from a destructor. If you do not do this, your deleteItem() function will not be called when the container is destroyed.</p>
<p>See also <a href="q3ptrcollection.html#newItem">newItem</a>() and <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/newItem"></a>
<h3 class="fn"><a name="newItem"></a><a href="q3ptrcollection.html#Item-typedef">Item</a> Q3PtrCollection::newItem ( <a href="q3ptrcollection.html#Item-typedef">Item</a> <i>d</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Virtual function that creates a copy of an object that is about to be inserted into the collection.</p>
<p>The default implementation returns the <i>d</i> pointer, i.e&#x2e; no copy is made.</p>
<p>This function is seldom reimplemented in the collection template classes. It is not common practice to make a copy of something that is being inserted.</p>
<p>See also <a href="q3ptrcollection.html#deleteItem">deleteItem</a>().</p>
<a name="//apple_ref/cpp/instm/Q3PtrCollection/setAutoDelete"></a>
<h3 class="fn"><a name="setAutoDelete"></a>void Q3PtrCollection::setAutoDelete ( bool <i>enable</i> )</h3>
<p>Sets the collection to auto-delete its contents if <i>enable</i> is true and to never delete them if <i>enable</i> is false.</p>
<p>If auto-deleting is turned on, all the items in a collection are deleted when the collection itself is deleted. This is convenient if the collection has the only pointer to the items.</p>
<p>The default setting is false, for safety. If you turn it on, be careful about copying the collection - you might find yourself with two collections deleting the same items.</p>
<p>Note that the auto-delete setting may also affect other functions in subclasses. For example, a subclass that has a remove() function will remove the item from its data structure, and if auto-delete is enabled, will also delete the item.</p>
<p>See also <a href="q3ptrcollection.html#autoDelete">autoDelete</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>