Sophie

Sophie

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

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">
<!-- qpair.qdoc -->
<head>
  <title>Qt 4.6: QPair Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QPair"></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">QPair Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span>
</h1>
<p>The QPair class is a template class that stores a pair of items. <a href="#details">More...</a></p>
<pre> #include &lt;QPair&gt;</pre><ul>
<li><a href="qpair-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="qpair.html#first_type-typedef">first_type</a></b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#second_type-typedef">second_type</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"></td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#QPair">QPair</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#QPair-2">QPair</a></b> ( const T1 &amp; <i>value1</i>, const T2 &amp; <i>value2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QPair&lt;T1, T2&gt; &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-eq">operator=</a></b> ( const QPair&lt;T1, T2&gt; &amp; <i>other</i> )</td></tr>
</table>
<hr />
<a name="public-variables"></a>
<h2>Public Variables</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">T1 </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#first-var">first</a></b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">T2 </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#second-var">second</a></b></td></tr>
</table>
<hr />
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QPair&lt;T1, T2&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#qMakePair">qMakePair</a></b> ( const T1 &amp; <i>value1</i>, const T2 &amp; <i>value2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-not-eq-24">operator!=</a></b> ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-lt-7">operator&lt;</a></b> ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDataStream &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-lt-lt-82">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>out</i>, const QPair&lt;T1, T2&gt; &amp; <i>pair</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-lt-eq-3">operator&lt;=</a></b> ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-eq-eq-43">operator==</a></b> ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-gt-3">operator&gt;</a></b> ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-gt-eq-3">operator&gt;=</a></b> ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDataStream &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qpair.html#operator-gt-gt-48">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>in</i>, QPair&lt;T1, T2&gt; &amp; <i>pair</i> )</td></tr>
</table>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QPair class is a template class that stores a pair of items.</p>
<p>QPair&lt;T1, T2&gt; can be used in your application if the STL <tt>pair</tt> type is not available. It stores one value of type T1 and one value of type T2. It can be used as a return value for a function that needs to return two values, or as the value type of a <a href="containers.html">generic container</a>.</p>
<p>Here's an example of a QPair that stores one <a href="qstring.html">QString</a> and one <tt>double</tt> value:</p>
<pre> QPair&lt;QString, double&gt; pair;</pre>
<p>The components are accessible as public data members called <a href="qpair.html#first-var">first</a> and <a href="qpair.html#second-var">second</a>. For example:</p>
<pre> pair.first = &quot;pi&quot;;
 pair.second = 3.14159265358979323846;</pre>
<p>QPair's template data types (T1 and T2) must be <a href="containers.html#assignable-data-types">assignable data types</a>. You cannot, for example, store a <a href="qwidget.html">QWidget</a> as a value; instead, store a <a href="qwidget.html">QWidget</a> *. A few functions have additional requirements; these requirements are documented on a per-function basis.</p>
<p>See also <a href="containers.html">Generic Containers</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<a name="//apple_ref/cpp/tdef/QPair/first_type"></a>
<h3 class="fn"><a name="first_type-typedef"></a>typedef QPair::first_type</h3>
<p>The type of the first element in the pair (T1).</p>
<p>See also <a href="qpair.html#first-var">first</a>.</p>
<a name="//apple_ref/cpp/tdef/QPair/second_type"></a>
<h3 class="fn"><a name="second_type-typedef"></a>typedef QPair::second_type</h3>
<p>The type of the second element in the pair (T2).</p>
<p>See also <a href="qpair.html#second-var">second</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QPair/QPair"></a>
<h3 class="fn"><a name="QPair"></a>QPair::QPair ()</h3>
<p>Constructs an empty pair. The <tt>first</tt> and <tt>second</tt> elements are initialized with <a href="containers.html#default-constructed-values">default-constructed values</a>.</p>
<h3 class="fn"><a name="QPair-2"></a>QPair::QPair ( const T1 &amp; <i>value1</i>, const T2 &amp; <i>value2</i> )</h3>
<p>Constructs a pair and initializes the <tt>first</tt> element with <i>value1</i> and the <tt>second</tt> element with <i>value2</i>.</p>
<p>See also <a href="qpair.html#qMakePair">qMakePair</a>().</p>
<a name="//apple_ref/cpp/instm/QPair/operator="></a>
<h3 class="fn"><a name="operator-eq"></a>QPair&lt;T1, T2&gt; &amp; QPair::operator= ( const QPair&lt;T1, T2&gt; &amp; <i>other</i> )</h3>
<p>Assigns <i>other</i> to this pair.</p>
<hr />
<h2>Member Variable Documentation</h2>
<a name="//apple_ref/cpp/data/QPair/first"></a>
<h3 class="fn"><a name="first-var"></a>T1 QPair::first</h3>
<p>The first element in the pair.</p>
<a name="//apple_ref/cpp/data/QPair/second"></a>
<h3 class="fn"><a name="second-var"></a>T2 QPair::second</h3>
<p>The second element in the pair.</p>
<hr />
<h2>Related Non-Members</h2>
<a name="//apple_ref/cpp/func//qMakePair"></a>
<h3 class="fn"><a name="qMakePair"></a>QPair&lt;T1, T2&gt; qMakePair ( const T1 &amp; <i>value1</i>, const T2 &amp; <i>value2</i> )</h3>
<p>Returns a <a href="qpair.html">QPair</a>&lt;T1, T2&gt; that contains <i>value1</i> and <i>value2</i>. Example:</p>
<pre> QList&lt;QPair&lt;int, double&gt; &gt; list;
 list.append(qMakePair(66, 3.14159));</pre>
<p>This is equivalent to <a href="qpair.html">QPair</a>&lt;T1, T2&gt;(<i>value1</i>, <i>value2</i>), but usually requires less typing.</p>
<h3 class="fn"><a name="operator-not-eq-24"></a>bool operator!= ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> is not equal to <i>p2</i>; otherwise returns false. Two pairs compare as not equal if their <tt>first</tt> data members are not equal or if their <tt>second</tt> data members are not equal.</p>
<p>This function requires the T1 and T2 types to have an implementation of <tt>operator==()</tt>.</p>
<h3 class="fn"><a name="operator-lt-7"></a>bool operator&lt; ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> is less than <i>p2</i>; otherwise returns false. The comparison is done on the <tt>first</tt> members of <i>p1</i> and <i>p2</i>; if they compare equal, the <tt>second</tt> members are compared to break the tie.</p>
<p>This function requires the T1 and T2 types to have an implementation of <tt>operator&lt;()</tt>.</p>
<h3 class="fn"><a name="operator-lt-lt-82"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>out</i>, const QPair&lt;T1, T2&gt; &amp; <i>pair</i> )</h3>
<p>Writes the pair <i>pair</i> to stream <i>out</i>.</p>
<p>This function requires the T1 and T2 types to implement <tt>operator&lt;&lt;()</tt>.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
<h3 class="fn"><a name="operator-lt-eq-3"></a>bool operator&lt;= ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> is less than or equal to <i>p2</i>; otherwise returns false. The comparison is done on the <tt>first</tt> members of <i>p1</i> and <i>p2</i>; if they compare equal, the <tt>second</tt> members are compared to break the tie.</p>
<p>This function requires the T1 and T2 types to have an implementation of <tt>operator&lt;()</tt>.</p>
<h3 class="fn"><a name="operator-eq-eq-43"></a>bool operator== ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> is equal to <i>p2</i>; otherwise returns false. Two pairs compare equal if their <tt>first</tt> data members compare equal and if their <tt>second</tt> data members compare equal.</p>
<p>This function requires the T1 and T2 types to have an implementation of <tt>operator==()</tt>.</p>
<h3 class="fn"><a name="operator-gt-3"></a>bool operator&gt; ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> is greater than <i>p2</i>; otherwise returns false. The comparison is done on the <tt>first</tt> members of <i>p1</i> and <i>p2</i>; if they compare equal, the <tt>second</tt> members are compared to break the tie.</p>
<p>This function requires the T1 and T2 types to have an implementation of <tt>operator&lt;()</tt>.</p>
<h3 class="fn"><a name="operator-gt-eq-3"></a>bool operator&gt;= ( const QPair&lt;T1, T2&gt; &amp; <i>p1</i>, const QPair&lt;T1, T2&gt; &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> is greater than or equal to <i>p2</i>; otherwise returns false. The comparison is done on the <tt>first</tt> members of <i>p1</i> and <i>p2</i>; if they compare equal, the <tt>second</tt> members are compared to break the tie.</p>
<p>This function requires the T1 and T2 types to have an implementation of <tt>operator&lt;()</tt>.</p>
<h3 class="fn"><a name="operator-gt-gt-48"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>in</i>, QPair&lt;T1, T2&gt; &amp; <i>pair</i> )</h3>
<p>Reads a pair from stream <i>in</i> into <i>pair</i>.</p>
<p>This function requires the T1 and T2 types to implement <tt>operator&gt;&gt;()</tt>.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</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>