Sophie

Sophie

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

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">
<!-- qdebug.cpp -->
<head>
  <title>Qt 4.6: QDebug Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QDebug"></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">QDebug Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span>
</h1>
<p>The QDebug class provides an output stream for debugging information. <a href="#details">More...</a></p>
<pre> #include &lt;QDebug&gt;</pre><ul>
<li><a href="qdebug-members.html">List of all members, including inherited members</a></li>
</ul>
<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="qdebug.html#QDebugx">QDebug</a></b> ( QIODevice * <i>device</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#QDebug-2">QDebug</a></b> ( QString * <i>string</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#QDebug-3">QDebug</a></b> ( QtMsgType <i>type</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#QDebug-4">QDebug</a></b> ( const QDebug &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#dtor.QDebug">~QDebug</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#maybeSpace">maybeSpace</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#nospace">nospace</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#space">space</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt">operator&lt;&lt;</a></b> ( QChar <i>t</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-3">operator&lt;&lt;</a></b> ( bool <i>t</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-4">operator&lt;&lt;</a></b> ( char <i>t</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-5">operator&lt;&lt;</a></b> ( signed short <i>i</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-6">operator&lt;&lt;</a></b> ( unsigned short <i>i</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-7">operator&lt;&lt;</a></b> ( signed int <i>i</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-8">operator&lt;&lt;</a></b> ( unsigned int <i>i</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-9">operator&lt;&lt;</a></b> ( signed long <i>l</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-10">operator&lt;&lt;</a></b> ( unsigned long <i>l</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-11">operator&lt;&lt;</a></b> ( qint64 <i>i</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-12">operator&lt;&lt;</a></b> ( quint64 <i>i</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-13">operator&lt;&lt;</a></b> ( float <i>f</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-14">operator&lt;&lt;</a></b> ( double <i>f</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-15">operator&lt;&lt;</a></b> ( const char * <i>s</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-16">operator&lt;&lt;</a></b> ( const QString &amp; <i>s</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-17">operator&lt;&lt;</a></b> ( const QStringRef &amp; <i>s</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-18">operator&lt;&lt;</a></b> ( const QLatin1String &amp; <i>s</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-19">operator&lt;&lt;</a></b> ( const QByteArray &amp; <i>b</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-lt-lt-20">operator&lt;&lt;</a></b> ( const void * <i>p</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDebug &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qdebug.html#operator-eq">operator=</a></b> ( const QDebug &amp; <i>other</i> )</td></tr>
</table>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QDebug class provides an output stream for debugging information.</p>
<p>QDebug is used whenever the developer needs to write out debugging or tracing information to a device, file, string or console.</p>
<a name="basic-use"></a>
<h3>Basic Use</h3>
<p>In the common case, it is useful to call the <a href="qtglobal.html#qDebug">qDebug</a>() function to obtain a default QDebug object to use for writing debugging information.</p>
<pre>     qDebug() &lt;&lt; &quot;Date:&quot; &lt;&lt; QDate::currentDate();
     qDebug() &lt;&lt; &quot;Types:&quot; &lt;&lt; QString(&quot;String&quot;) &lt;&lt; QChar('x') &lt;&lt; QRect(0, 10, 50, 40);
     qDebug() &lt;&lt; &quot;Custom coordinate type:&quot; &lt;&lt; coordinate;</pre>
<p>This constructs a QDebug object using the constructor that accepts a <a href="qtglobal.html#QtMsgType-enum">QtMsgType</a> value of <a href="qtglobal.html#QtMsgType-enum">QtDebugMsg</a>. Similarly, the <a href="qtglobal.html#qWarning">qWarning</a>(), <a href="qtglobal.html#qCritical">qCritical</a>() and <a href="qtglobal.html#qFatal">qFatal</a>() functions also return QDebug objects for the corresponding message types.</p>
<p>The class also provides several constructors for other situations, including a constructor that accepts a <a href="qfile.html">QFile</a> or any other <a href="qiodevice.html">QIODevice</a> subclass that is used to write debugging information to files and other devices. The constructor that accepts a <a href="qstring.html">QString</a> is used to write to a string for display or serialization.</p>
<a name="writing-custom-types-to-a-stream"></a>
<h3>Writing Custom Types to a Stream</h3>
<p>Many standard types can be written to QDebug objects, and Qt provides support for most Qt value types. To add support for custom types, you need to implement a streaming operator, as in the following example:</p>
<pre> QDebug operator&lt;&lt;(QDebug dbg, const Coordinate &amp;c)
 {
     dbg.nospace() &lt;&lt; &quot;(&quot; &lt;&lt; c.x() &lt;&lt; &quot;, &quot; &lt;&lt; c.y() &lt;&lt; &quot;)&quot;;

     return dbg.space();
 }</pre>
<p>This is described in the <a href="debug.html">Debugging Techniques</a> and <a href="custom-types.html#making-the-type-printable">Creating Custom Qt Types</a> documents.</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QDebug/QDebug"></a>
<h3 class="fn"><a name="QDebugx"></a>QDebug::QDebug ( <a href="qiodevice.html">QIODevice</a> * <i>device</i> )</h3>
<p>Constructs a debug stream that writes to the given <i>device</i>.</p>
<h3 class="fn"><a name="QDebug-2"></a>QDebug::QDebug ( <a href="qstring.html">QString</a> * <i>string</i> )</h3>
<p>Constructs a debug stream that writes to the given <i>string</i>.</p>
<h3 class="fn"><a name="QDebug-3"></a>QDebug::QDebug ( <a href="qtglobal.html#QtMsgType-enum">QtMsgType</a> <i>type</i> )</h3>
<p>Constructs a debug stream that writes to the handler for the message type specified by <i>type</i>.</p>
<h3 class="fn"><a name="QDebug-4"></a>QDebug::QDebug ( const QDebug &amp; <i>other</i> )</h3>
<p>Constructs a copy of the <i>other</i> debug stream.</p>
<a name="//apple_ref/cpp/instm/QDebug/~QDebug"></a>
<h3 class="fn"><a name="dtor.QDebug"></a>QDebug::~QDebug ()</h3>
<p>Flushes any pending data to be written and destroys the debug stream.</p>
<a name="//apple_ref/cpp/instm/QDebug/maybeSpace"></a>
<h3 class="fn"><a name="maybeSpace"></a>QDebug &amp; QDebug::maybeSpace ()</h3>
<p>Writes a space character to the debug stream, depending on the last character sent to the stream, and returns a reference to the stream.</p>
<p>If the last character was a space character, this function writes a space character to the stream; otherwise, no characters are written to the stream.</p>
<p>See also <a href="qdebug.html#space">space</a>() and <a href="qdebug.html#nospace">nospace</a>().</p>
<a name="//apple_ref/cpp/instm/QDebug/nospace"></a>
<h3 class="fn"><a name="nospace"></a>QDebug &amp; QDebug::nospace ()</h3>
<p>Clears the stream's internal flag that records whether the last character was a space and returns a reference to the stream.</p>
<p>See also <a href="qdebug.html#space">space</a>() and <a href="qdebug.html#maybeSpace">maybeSpace</a>().</p>
<a name="//apple_ref/cpp/instm/QDebug/space"></a>
<h3 class="fn"><a name="space"></a>QDebug &amp; QDebug::space ()</h3>
<p>Writes a space character to the debug stream and returns a reference to the stream.</p>
<p>The stream will record that the last character sent to the stream was a space.</p>
<p>See also <a href="qdebug.html#nospace">nospace</a>() and <a href="qdebug.html#maybeSpace">maybeSpace</a>().</p>
<a name="//apple_ref/cpp/instm/QDebug/operator&lt;&lt;"></a>
<h3 class="fn"><a name="operator-lt-lt"></a>QDebug &amp; QDebug::operator&lt;&lt; ( <a href="qchar.html">QChar</a> <i>t</i> )</h3>
<p>Writes the character, <i>t</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-3"></a>QDebug &amp; QDebug::operator&lt;&lt; ( bool <i>t</i> )</h3>
<p>Writes the boolean value, <i>t</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-4"></a>QDebug &amp; QDebug::operator&lt;&lt; ( char <i>t</i> )</h3>
<p>Writes the character, <i>t</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-5"></a>QDebug &amp; QDebug::operator&lt;&lt; ( signed short <i>i</i> )</h3>
<p>Writes the signed short integer, <i>i</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-6"></a>QDebug &amp; QDebug::operator&lt;&lt; ( unsigned short <i>i</i> )</h3>
<p>Writes then unsigned short integer, <i>i</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-7"></a>QDebug &amp; QDebug::operator&lt;&lt; ( signed int <i>i</i> )</h3>
<p>Writes the signed integer, <i>i</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-8"></a>QDebug &amp; QDebug::operator&lt;&lt; ( unsigned int <i>i</i> )</h3>
<p>Writes then unsigned integer, <i>i</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-9"></a>QDebug &amp; QDebug::operator&lt;&lt; ( signed long <i>l</i> )</h3>
<p>Writes the signed long integer, <i>l</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-10"></a>QDebug &amp; QDebug::operator&lt;&lt; ( unsigned long <i>l</i> )</h3>
<p>Writes then unsigned long integer, <i>l</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-11"></a>QDebug &amp; QDebug::operator&lt;&lt; ( <a href="qtglobal.html#qint64-typedef">qint64</a> <i>i</i> )</h3>
<p>Writes the signed 64-bit integer, <i>i</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-12"></a>QDebug &amp; QDebug::operator&lt;&lt; ( <a href="qtglobal.html#quint64-typedef">quint64</a> <i>i</i> )</h3>
<p>Writes then unsigned 64-bit integer, <i>i</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-13"></a>QDebug &amp; QDebug::operator&lt;&lt; ( float <i>f</i> )</h3>
<p>Writes the 32-bit floating point number, <i>f</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-14"></a>QDebug &amp; QDebug::operator&lt;&lt; ( double <i>f</i> )</h3>
<p>Writes the 64-bit floating point number, <i>f</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-15"></a>QDebug &amp; QDebug::operator&lt;&lt; ( const char * <i>s</i> )</h3>
<p>Writes the '\0'-terminated string, <i>s</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-16"></a>QDebug &amp; QDebug::operator&lt;&lt; ( const <a href="qstring.html">QString</a> &amp; <i>s</i> )</h3>
<p>Writes the string, <i>s</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-17"></a>QDebug &amp; QDebug::operator&lt;&lt; ( const <a href="qstringref.html">QStringRef</a> &amp; <i>s</i> )</h3>
<p>Writes the string reference, <i>s</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-18"></a>QDebug &amp; QDebug::operator&lt;&lt; ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>s</i> )</h3>
<p>Writes the Latin1-encoded string, <i>s</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-19"></a>QDebug &amp; QDebug::operator&lt;&lt; ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>b</i> )</h3>
<p>Writes the byte array, <i>b</i>, to the stream and returns a reference to the stream.</p>
<h3 class="fn"><a name="operator-lt-lt-20"></a>QDebug &amp; QDebug::operator&lt;&lt; ( const void * <i>p</i> )</h3>
<p>Writes a pointer, <i>p</i>, to the stream and returns a reference to the stream.</p>
<a name="//apple_ref/cpp/instm/QDebug/operator="></a>
<h3 class="fn"><a name="operator-eq"></a>QDebug &amp; QDebug::operator= ( const QDebug &amp; <i>other</i> )</h3>
<p>Assigns the <i>other</i> debug stream to this stream and returns a reference to this stream.</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>