Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 4514

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?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" />
<!-- q3dict.qdoc -->
  <title>Qt 4.8: Q3Dict Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <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>Q3Dict</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></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">Q3Dict Class Reference</h1>
<!-- $$$Q3Dict-brief -->
<p>The Q3Dict class is a template class that provides a dictionary based on <a href="qstring.html">QString</a> keys. <a href="#details">More...</a></p>
<!-- @@@Q3Dict -->
<pre class="cpp"> <span class="preprocessor">#include &lt;Q3Dict&gt;</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="q3dict-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="q3dict.html#Q3Dict">Q3Dict</a></b> ( int <i>size</i> = 17, bool <i>caseSensitive</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#Q3Dict-2">Q3Dict</a></b> ( const Q3Dict&lt;type&gt; &amp; <i>dict</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#dtor.Q3Dict">~Q3Dict</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#find">find</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#insert">insert</a></b> ( const QString &amp; <i>key</i>, const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#remove">remove</a></b> ( const QString &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#replace">replace</a></b> ( const QString &amp; <i>key</i>, const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#resize">resize</a></b> ( uint <i>newsize</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#size">size</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#statistics">statistics</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#take">take</a></b> ( const QString &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3Dict&lt;type&gt; &amp; </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#operator-eq">operator=</a></b> ( const Q3Dict&lt;type&gt; &amp; <i>dict</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#operator-5b-5d">operator[]</a></b> ( const QString &amp; <i>key</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="q3dict.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual uint </td><td class="memItemRight bottomAlign"><b><a href="q3dict.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 QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#read">read</a></b> ( QDataStream &amp; <i>s</i>, Q3PtrCollection::Item &amp; <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="q3dict.html#write">write</a></b> ( QDataStream &amp; <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>
<!-- $$$Q3Dict-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3Dict class is a template class that provides a dictionary based on <a href="qstring.html">QString</a> keys.</p>
<p>Q3Dict is implemented as a template class. Define a template instance Q3Dict&lt;X&gt; to create a dictionary that operates on pointers to X (X *).</p>
<p>A dictionary is a collection of key-value pairs. The key is a <a href="qstring.html">QString</a> used for insertion, removal and lookup. The value is a pointer. Dictionaries provide very fast insertion and lookup.</p>
<p>If you want to use non-Unicode, plain 8-bit <tt>char*</tt> keys, use the <a href="q3asciidict.html">Q3AsciiDict</a> template. A Q3Dict has the same performance as a <a href="q3asciidict.html">Q3AsciiDict</a>. If you want to have a dictionary that maps QStrings to QStrings use <a href="qmap.html">QMap</a>.</p>
<p>The <a href="q3dict.html#size">size</a>() of the dictionary is very important. In order to get good performance, you should use a suitably large prime number. Suitable means equal to or larger than the maximum expected number of dictionary items. Size is set in the constructor but may be changed with <a href="q3dict.html#resize">resize</a>().</p>
<p>Items are inserted with <a href="q3dict.html#insert">insert</a>(); 0 pointers cannot be inserted. Items are removed with <a href="q3dict.html#remove">remove</a>(). All the items in a dictionary can be removed with <a href="q3dict.html#clear">clear</a>(). The number of items in the dictionary is returned by <a href="q3dict.html#count">count</a>(). If the dictionary contains no items <a href="q3dict.html#isEmpty">isEmpty</a>() returns TRUE. You can change an item's value with <a href="q3dict.html#replace">replace</a>(). Items are looked up with operator[](), or with <a href="q3dict.html#find">find</a>() which return a pointer to the value or 0 if the given key does not exist. You can take an item out of the dictionary with <a href="q3dict.html#take">take</a>().</p>
<p>Calling setAutoDelete(TRUE) for a dictionary tells it to delete items that are removed. The default behavior is not to delete items when they are removed.</p>
<p>When an item is inserted, the key is converted (hashed) to an integer index into an internal hash array. This makes lookup very fast.</p>
<p>Items with equal keys are allowed. When inserting two items with the same key, only the last inserted item will be accessible (last in, first out) until it is removed.</p>
<p>The <a href="q3dictiterator.html">Q3DictIterator</a> class can traverse the dictionary, but only in an arbitrary order. Multiple iterators may independently traverse the same dictionary.</p>
<p>When inserting an item into a dictionary, only the pointer is copied, not the item itself, i.e&#x2e; a shallow copy is made. It is possible to make the dictionary copy all of the item's data (a deep copy) when an item is inserted. <a href="q3dict.html#insert">insert</a>() calls the virtual function <a href="q3ptrcollection.html#newItem">Q3PtrCollection::newItem</a>() for the item to be inserted. Inherit a dictionary and reimplement <a href="q3ptrcollection.html#newItem">newItem</a>() if you want deep copies.</p>
<p>When removing a dictionary item, the virtual function <a href="q3ptrcollection.html#deleteItem">Q3PtrCollection::deleteItem</a>() is called. Q3Dict's default implementation is to delete the item if auto-deletion is enabled.</p>
</div>
<p><b>See also </b><a href="q3dictiterator.html">Q3DictIterator</a>, <a href="q3asciidict.html">Q3AsciiDict</a>, <a href="q3intdict.html">Q3IntDict</a>, and <a href="q3ptrdict.html">Q3PtrDict</a>.</p>
<!-- @@@Q3Dict -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3Dict[overload1]$$$Q3Dictintbool -->
<h3 class="fn"><a name="Q3Dict"></a>Q3Dict::<span class="name">Q3Dict</span> ( <span class="type">int</span> <i>size</i> = 17, <span class="type">bool</span> <i>caseSensitive</i> = true )</h3>
<p>Constructs a dictionary optimized for less than <i>size</i> entries.</p>
<p>We recommend setting <i>size</i> to a suitably large prime number (e.g&#x2e; a prime that's slightly larger than the expected number of entries). This makes the hash distribution better which will lead to faster lookup.</p>
<p>If <i>caseSensitive</i> is TRUE (the default), keys which differ only by case are considered different.</p>
<!-- @@@Q3Dict -->
<!-- $$$Q3Dict$$$Q3DictconstQ3Dict<type>& -->
<h3 class="fn"><a name="Q3Dict-2"></a>Q3Dict::<span class="name">Q3Dict</span> ( const <span class="type">Q3Dict</span>&lt;<span class="type">type</span>&gt; &amp; <i>dict</i> )</h3>
<p>Constructs a copy of <i>dict</i>.</p>
<p>Each item in <i>dict</i> is inserted into this dictionary. Only the pointers are copied (shallow copy).</p>
<!-- @@@Q3Dict -->
<!-- $$$~Q3Dict[overload1]$$$~Q3Dict -->
<h3 class="fn"><a name="dtor.Q3Dict"></a>Q3Dict::<span class="name">~Q3Dict</span> ()</h3>
<p>Removes all items from the dictionary and destroys it. If <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>() is TRUE, each value is deleted. All iterators that access this dictionary will be reset.</p>
<p><b>See also </b><a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<!-- @@@~Q3Dict -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> Q3Dict::<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 dictionary.</p>
<p>The removed items are deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>All dictionary iterators that operate on the dictionary are reset.</p>
<p><b>See also </b><a href="q3dict.html#remove">remove</a>(), <a href="q3dict.html#take">take</a>(), and <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<!-- @@@clear -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn"><a name="count"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3Dict::<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 dictionary.</p>
<p><b>See also </b><a href="q3dict.html#isEmpty">isEmpty</a>().</p>
<!-- @@@count -->
<!-- $$$find[overload1]$$$findconstQString& -->
<h3 class="fn"><a name="find"></a><span class="type">type</span> * Q3Dict::<span class="name">find</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> ) const</h3>
<p>Returns the item with key <i>key</i>, or 0 if the key does not exist in the dictionary.</p>
<p>If there are two or more items with equal keys, then the most recently inserted item will be found.</p>
<p>Equivalent to the [] operator.</p>
<p><b>See also </b><a href="q3dict.html#operator-5b-5d">operator[]</a>().</p>
<!-- @@@find -->
<!-- $$$insert[overload1]$$$insertconstQString&consttype* -->
<h3 class="fn"><a name="insert"></a><span class="type">void</span> Q3Dict::<span class="name">insert</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i>, const <span class="type">type</span> * <i>item</i> )</h3>
<p>Inserts the key <i>key</i> with value <i>item</i> into the dictionary.</p>
<p>Multiple items can have the same key, in which case only the last item will be accessible using <a href="q3dict.html#operator-5b-5d">operator[]</a>().</p>
<p><i>item</i> may not be 0.</p>
<p><b>See also </b><a href="q3dict.html#replace">replace</a>().</p>
<!-- @@@insert -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn"><a name="isEmpty"></a><span class="type">bool</span> Q3Dict::<span class="name">isEmpty</span> () const</h3>
<p>Returns TRUE if the dictionary is empty, i.e&#x2e; <a href="q3dict.html#count">count</a>() == 0; otherwise returns FALSE.</p>
<p><b>See also </b><a href="q3dict.html#count">count</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$read[overload1]$$$readQDataStream&Q3PtrCollection::Item& -->
<h3 class="fn"><a name="read"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; Q3Dict::<span class="name">read</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>s</i>, <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> &amp; <i>item</i> )<tt> [virtual protected]</tt></h3>
<p>Reads a dictionary item 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="q3dict.html#write">write</a>().</p>
<!-- @@@read -->
<!-- $$$remove[overload1]$$$removeconstQString& -->
<h3 class="fn"><a name="remove"></a><span class="type">bool</span> Q3Dict::<span class="name">remove</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> )</h3>
<p>Removes the item with <i>key</i> from the dictionary. Returns TRUE if successful, i.e&#x2e; if the item is in the dictionary; otherwise returns FALSE.</p>
<p>If there are two or more items with equal keys, then the last item that was inserted will be removed.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>All dictionary iterators that refer to the removed item will be set to point to the next item in the dictionary's traversal order.</p>
<p><b>See also </b><a href="q3dict.html#take">take</a>(), <a href="q3dict.html#clear">clear</a>(), and <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<!-- @@@remove -->
<!-- $$$replace[overload1]$$$replaceconstQString&consttype* -->
<h3 class="fn"><a name="replace"></a><span class="type">void</span> Q3Dict::<span class="name">replace</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i>, const <span class="type">type</span> * <i>item</i> )</h3>
<p>Replaces the value of the key, <i>key</i> with <i>item</i>.</p>
<p>If the item does not already exist, it will be inserted.</p>
<p><i>item</i> may not be 0.</p>
<p>Equivalent to:</p>
<pre class="cpp"> <span class="type"><a href="q3dict.html">Q3Dict</a></span><span class="operator">&lt;</span><span class="type">char</span><span class="operator">&gt;</span> dict;
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="keyword">if</span> ( dict<span class="operator">.</span>find( key ) )
     dict<span class="operator">.</span><a href="q3dict.html#remove">remove</a>( key );
 dict<span class="operator">.</span><a href="q3dict.html#insert">insert</a>( key<span class="operator">,</span> item );</pre>
<p>If there are two or more items with equal keys, then the last item that was inserted will be replaced.</p>
<p><b>See also </b><a href="q3dict.html#insert">insert</a>().</p>
<!-- @@@replace -->
<!-- $$$resize[overload1]$$$resizeuint -->
<h3 class="fn"><a name="resize"></a><span class="type">void</span> Q3Dict::<span class="name">resize</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>newsize</i> )</h3>
<p>Changes the size of the hash table to <i>newsize</i>. The contents of the dictionary are preserved, but all iterators on the dictionary become invalid.</p>
<!-- @@@resize -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3Dict::<span class="name">size</span> () const</h3>
<p>Returns the size of the internal hash array (as specified in the constructor).</p>
<p><b>See also </b><a href="q3dict.html#count">count</a>().</p>
<!-- @@@size -->
<!-- $$$statistics[overload1]$$$statistics -->
<h3 class="fn"><a name="statistics"></a><span class="type">void</span> Q3Dict::<span class="name">statistics</span> () const</h3>
<p>Debugging-only function that prints out the dictionary distribution using <a href="qtglobal.html#qDebug">qDebug</a>().</p>
<!-- @@@statistics -->
<!-- $$$take[overload1]$$$takeconstQString& -->
<h3 class="fn"><a name="take"></a><span class="type">type</span> * Q3Dict::<span class="name">take</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> )</h3>
<p>Takes the item with <i>key</i> out of the dictionary without deleting it (even if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled).</p>
<p>If there are two or more items with equal keys, then the last item that was inserted will be taken.</p>
<p>Returns a pointer to the item taken out, or 0 if the key does not exist in the dictionary.</p>
<p>All dictionary iterators that refer to the taken item will be set to point to the next item in the dictionary traversal order.</p>
<p><b>See also </b><a href="q3dict.html#remove">remove</a>(), <a href="q3dict.html#clear">clear</a>(), and <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</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> &amp; Q3Dict::<span class="name">write</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <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 dictionary <i>item</i> to the stream <i>s</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="q3dict.html#read">read</a>().</p>
<!-- @@@write -->
<!-- $$$operator=[overload1]$$$operator=constQ3Dict<type>& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">Q3Dict</span>&lt;<span class="type">type</span>&gt; &amp; Q3Dict::<span class="name">operator=</span> ( const <span class="type">Q3Dict</span>&lt;<span class="type">type</span>&gt; &amp; <i>dict</i> )</h3>
<p>Assigns <i>dict</i> to this dictionary and returns a reference to this dictionary.</p>
<p>This dictionary is first cleared, then each item in <i>dict</i> is inserted into this dictionary. Only the pointers are copied (shallow copy), unless <a href="q3ptrcollection.html#newItem">newItem</a>() has been reimplemented.</p>
<!-- @@@operator= -->
<!-- $$$operator[][overload1]$$$operator[]constQString& -->
<h3 class="fn"><a name="operator-5b-5d"></a><span class="type">type</span> * Q3Dict::<span class="name">operator[]</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> ) const</h3>
<p>Returns the item with key <i>key</i>, or 0 if the key does not exist in the dictionary.</p>
<p>If there are two or more items with equal keys, then the most recently inserted item will be found.</p>
<p>Equivalent to the <a href="q3dict.html#find">find</a>() function.</p>
<p><b>See also </b><a href="q3dict.html#find">find</a>().</p>
<!-- @@@operator[] -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      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>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      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>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>