diff options
Diffstat (limited to 'doc/html/qtextstream.html')
-rw-r--r-- | doc/html/qtextstream.html | 667 |
1 files changed, 667 insertions, 0 deletions
diff --git a/doc/html/qtextstream.html b/doc/html/qtextstream.html new file mode 100644 index 0000000..51e27fd --- /dev/null +++ b/doc/html/qtextstream.html @@ -0,0 +1,667 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qtextstream.cpp:56 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>QTextStream Class</title> +<style type="text/css"><!-- +fn { margin-left: 1cm; text-indent: -1cm; } +a:link { color: #004faf; text-decoration: none } +a:visited { color: #672967; text-decoration: none } +body { background: #ffffff; color: black; } +--></style> +</head> +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> +<tr bgcolor="#E5E5E5"> +<td valign=center> + <a href="index.html"> +<font color="#004faf">Home</font></a> + | <a href="classes.html"> +<font color="#004faf">All Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped Classes</font></a> + | <a href="functions.html"> +<font color="#004faf">Functions</font></a> +</td> +<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QTextStream Class Reference</h1> + +<p>The QTextStream class provides basic functions for reading +and writing text using a QIODevice. +<a href="#details">More...</a> +<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p> +<p><tt>#include <<a href="qtextstream-h.html">qtextstream.h</a>></tt> +<p>Inherited by <a href="qtextistream.html">QTextIStream</a> and <a href="qtextostream.html">QTextOStream</a>. +<p><a href="qtextstream-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn>enum <a href="#Encoding-enum"><b>Encoding</b></a> { Locale, Latin1, Unicode, UnicodeNetworkOrder, UnicodeReverse, RawUnicode, UnicodeUTF8 }</li> +<li class=fn>void <a href="#setEncoding"><b>setEncoding</b></a> ( Encoding e )</li> +<li class=fn>void <a href="#setCodec"><b>setCodec</b></a> ( QTextCodec * codec )</li> +<li class=fn>QTextCodec * <a href="#codec"><b>codec</b></a> ()</li> +<li class=fn><a href="#QTextStream"><b>QTextStream</b></a> ()</li> +<li class=fn><a href="#QTextStream-2"><b>QTextStream</b></a> ( QIODevice * iod )</li> +<li class=fn><a href="#QTextStream-3"><b>QTextStream</b></a> ( QString * str, int filemode )</li> +<li class=fn>QTextStream ( QString & str, int filemode ) <em>(obsolete)</em></li> +<li class=fn><a href="#QTextStream-5"><b>QTextStream</b></a> ( QByteArray a, int mode )</li> +<li class=fn><a href="#QTextStream-6"><b>QTextStream</b></a> ( FILE * fh, int mode )</li> +<li class=fn>virtual <a href="#~QTextStream"><b>~QTextStream</b></a> ()</li> +<li class=fn>QIODevice * <a href="#device"><b>device</b></a> () const</li> +<li class=fn>void <a href="#setDevice"><b>setDevice</b></a> ( QIODevice * iod )</li> +<li class=fn>void <a href="#unsetDevice"><b>unsetDevice</b></a> ()</li> +<li class=fn>bool <a href="#atEnd"><b>atEnd</b></a> () const</li> +<li class=fn>bool eof () const <em>(obsolete)</em></li> +<li class=fn>QTextStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QChar & c )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-2"><b>operator>></b></a> ( char & c )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-3"><b>operator>></b></a> ( signed short & i )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-4"><b>operator>></b></a> ( unsigned short & i )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-5"><b>operator>></b></a> ( signed int & i )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-6"><b>operator>></b></a> ( unsigned int & i )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-7"><b>operator>></b></a> ( signed long & i )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-8"><b>operator>></b></a> ( unsigned long & i )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-9"><b>operator>></b></a> ( float & f )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-a"><b>operator>></b></a> ( double & f )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-b"><b>operator>></b></a> ( char * s )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-c"><b>operator>></b></a> ( QString & str )</li> +<li class=fn>QTextStream & <a href="#operator-gt-gt-d"><b>operator>></b></a> ( QCString & str )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QChar c )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-2"><b>operator<<</b></a> ( char c )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-3"><b>operator<<</b></a> ( signed short i )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-4"><b>operator<<</b></a> ( unsigned short i )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-5"><b>operator<<</b></a> ( signed int i )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-6"><b>operator<<</b></a> ( unsigned int i )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-7"><b>operator<<</b></a> ( signed long i )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-8"><b>operator<<</b></a> ( unsigned long i )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-9"><b>operator<<</b></a> ( float f )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-a"><b>operator<<</b></a> ( double f )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-b"><b>operator<<</b></a> ( const char * s )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-c"><b>operator<<</b></a> ( const QString & s )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-d"><b>operator<<</b></a> ( const QCString & s )</li> +<li class=fn>QTextStream & <a href="#operator-lt-lt-e"><b>operator<<</b></a> ( void * ptr )</li> +<li class=fn>QTextStream & <a href="#readRawBytes"><b>readRawBytes</b></a> ( char * s, uint len )</li> +<li class=fn>QTextStream & <a href="#writeRawBytes"><b>writeRawBytes</b></a> ( const char * s, uint len )</li> +<li class=fn>QString <a href="#readLine"><b>readLine</b></a> ()</li> +<li class=fn>QString <a href="#read"><b>read</b></a> ()</li> +<li class=fn>void <a href="#skipWhiteSpace"><b>skipWhiteSpace</b></a> ()</li> +<li class=fn>int <a href="#flags"><b>flags</b></a> () const</li> +<li class=fn>int <a href="#flags-2"><b>flags</b></a> ( int f )</li> +<li class=fn>int <a href="#setf"><b>setf</b></a> ( int bits )</li> +<li class=fn>int <a href="#setf-2"><b>setf</b></a> ( int bits, int mask )</li> +<li class=fn>int <a href="#unsetf"><b>unsetf</b></a> ( int bits )</li> +<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li> +<li class=fn>int <a href="#width"><b>width</b></a> () const</li> +<li class=fn>int <a href="#width-2"><b>width</b></a> ( int w )</li> +<li class=fn>int <a href="#fill"><b>fill</b></a> () const</li> +<li class=fn>int <a href="#fill-2"><b>fill</b></a> ( int f )</li> +<li class=fn>int <a href="#precision"><b>precision</b></a> () const</li> +<li class=fn>int <a href="#precision-2"><b>precision</b></a> ( int p )</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + + +The QTextStream class provides basic functions for reading +and writing text using a <a href="qiodevice.html">QIODevice</a>. +<p> + + +<p> The text stream class has a functional interface that is very +similar to that of the standard C++ iostream class. +<p> Qt provides several global functions similar to the ones in iostream: +<center><table cellpadding="4" cellspacing="2" border="0"> +<tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Meaning +<tr bgcolor="#f0f0f0"> <td valign="top">bin <td valign="top">sets the QTextStream to read/write binary numbers +<tr bgcolor="#d0d0d0"> <td valign="top">oct <td valign="top">sets the QTextStream to read/write octal numbers +<tr bgcolor="#f0f0f0"> <td valign="top">dec <td valign="top">sets the QTextStream to read/write decimal numbers +<tr bgcolor="#d0d0d0"> <td valign="top">hex <td valign="top">sets the QTextStream to read/write hexadecimal numbers +<tr bgcolor="#f0f0f0"> <td valign="top">endl <td valign="top">forces a line break +<tr bgcolor="#d0d0d0"> <td valign="top">flush <td valign="top">forces the QIODevice to flush any buffered data +<tr bgcolor="#f0f0f0"> <td valign="top">ws <td valign="top">eats any available whitespace (on input) +<tr bgcolor="#d0d0d0"> <td valign="top">reset <td valign="top">resets the QTextStream to its default mode (see <a href="#reset">reset</a>()) +<tr bgcolor="#f0f0f0"> <td valign="top">qSetW(int) <td valign="top">sets the <a href="#width">field width</a> +to the given argument +<tr bgcolor="#d0d0d0"> <td valign="top">qSetFill(int) <td valign="top">sets the <a href="#fill">fill character</a> to the given argument +<tr bgcolor="#f0f0f0"> <td valign="top">qSetPrecision(int) <td valign="top">sets the <a href="#precision">precision</a> to the given argument +</table></center> +<p> <b>Warning:</b> By default QTextStream will automatically detect whether +integers in the stream are in decimal, octal, hexadecimal or +binary format when reading from the stream. In particular, a +leading '0' signifies octal, i.e. the sequence "0100" will be +interpreted as 64. +<p> The QTextStream class reads and writes text; it is not appropriate +for dealing with binary data (but <a href="qdatastream.html">QDataStream</a> is). +<p> By default, output of Unicode text (i.e. <a href="qstring.html">QString</a>) is done using +the local 8-bit encoding. This can be changed using the +<a href="#setEncoding">setEncoding</a>() method. For input, the QTextStream will auto-detect +standard Unicode "byte order marked" text files; otherwise the +local 8-bit encoding is used. +<p> The <a href="qiodevice.html">QIODevice</a> is set in the constructor, or later using +<a href="#setDevice">setDevice</a>(). If the end of the input is reached <a href="#atEnd">atEnd</a>() returns +TRUE. Data can be read into variables of the appropriate type +using the <a href="#operator-gt-gt">operator>></a>() overloads, or read in its entirety into a +single string using <a href="#read">read</a>(), or read a line at a time using +<a href="#readLine">readLine</a>(). Whitespace can be skipped over using <a href="#skipWhiteSpace">skipWhiteSpace</a>(). +You can set flags for the stream using <a href="#flags">flags</a>() or <a href="#setf">setf</a>(). The +stream also supports <a href="#width">width</a>(), <a href="#precision">precision</a>() and <a href="#fill">fill</a>(); use <a href="#reset">reset</a>() +to reset the defaults. +<p> <p>See also <a href="qdatastream.html">QDataStream</a>, <a href="io.html">Input/Output and Networking</a>, and <a href="text.html">Text Related Classes</a>. + +<hr><h2>Member Type Documentation</h2> +<h3 class=fn><a name="Encoding-enum"></a>QTextStream::Encoding</h3> + +<ul> +<li><tt>QTextStream::Locale</tt> +<li><tt>QTextStream::Latin1</tt> +<li><tt>QTextStream::Unicode</tt> +<li><tt>QTextStream::UnicodeNetworkOrder</tt> +<li><tt>QTextStream::UnicodeReverse</tt> +<li><tt>QTextStream::RawUnicode</tt> +<li><tt>QTextStream::UnicodeUTF8</tt> +</ul><p> See <a href="#setEncoding">setEncoding</a>() for an explanation of the encodings. + +<hr><h2>Member Function Documentation</h2> +<h3 class=fn><a name="QTextStream"></a>QTextStream::QTextStream () +</h3> +Constructs a data stream that has no IO device. + +<h3 class=fn><a name="QTextStream-2"></a>QTextStream::QTextStream ( <a href="qiodevice.html">QIODevice</a> * iod ) +</h3> +Constructs a text stream that uses the IO device <em>iod</em>. + +<h3 class=fn><a name="QTextStream-3"></a>QTextStream::QTextStream ( <a href="qstring.html">QString</a> * str, int filemode ) +</h3> +Constructs a text stream that operates on the Unicode <a href="qstring.html">QString</a>, <em>str</em>, through an internal device. The <em>filemode</em> argument is +passed to the device's open() function; see <a href="qiodevice.html#mode">QIODevice::mode</a>(). +<p> If you set an encoding or codec with <a href="#setEncoding">setEncoding</a>() or <a href="#setCodec">setCodec</a>(), +this setting is ignored for text streams that operate on QString. +<p> Example: +<pre> + <a href="qstring.html">QString</a> str; + QTextStream ts( &str, <a href="qfile.html#open">IO_WriteOnly</a> ); + ts << "pi = " << 3.14; // str == "pi = 3.14" + </pre> + +<p> Writing data to the text stream will modify the contents of the +string. The string will be expanded when data is written beyond +the end of the string. Note that the string will not be truncated: +<pre> + <a href="qstring.html">QString</a> str = "pi = 3.14"; + QTextStream ts( &str, IO_WriteOnly ); + ts << "2+2 = " << 2+2; // str == "2+2 = 414" + </pre> + +<p> Note that because QString is Unicode, you should not use +<a href="#readRawBytes">readRawBytes</a>() or <a href="#writeRawBytes">writeRawBytes</a>() on such a stream. + +<h3 class=fn><a name="QTextStream-4"></a>QTextStream::QTextStream ( <a href="qstring.html">QString</a> & str, int filemode ) +</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +<p> This constructor is equivalent to the constructor taking a <a href="qstring.html">QString</a>* +parameter. + +<h3 class=fn><a name="QTextStream-5"></a>QTextStream::QTextStream ( <a href="qbytearray.html">QByteArray</a> a, int mode ) +</h3> +Constructs a text stream that operates on the byte array, <em>a</em>, +through an internal <a href="qbuffer.html">QBuffer</a> device. The <em>mode</em> argument is passed +to the device's open() function; see <a href="qiodevice.html#mode">QIODevice::mode</a>(). +<p> Example: +<pre> + <a href="qbytearray.html">QByteArray</a> array; + QTextStream ts( array, <a href="qfile.html#open">IO_WriteOnly</a> ); + ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14" + </pre> + +<p> Writing data to the text stream will modify the contents of the +array. The array will be expanded when data is written beyond the +end of the string. +<p> Same example, using a QBuffer: +<pre> + <a href="qbytearray.html">QByteArray</a> array; + <a href="qbuffer.html">QBuffer</a> buf( array ); + buf.<a href="qiodevice.html#open">open</a>( IO_WriteOnly ); + QTextStream ts( &buf ); + ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14" + buf.<a href="qiodevice.html#close">close</a>(); + </pre> + + +<h3 class=fn><a name="QTextStream-6"></a>QTextStream::QTextStream ( FILE * fh, int mode ) +</h3> +Constructs a text stream that operates on an existing file handle +<em>fh</em> through an internal <a href="qfile.html">QFile</a> device. The <em>mode</em> argument is +passed to the device's open() function; see <a href="qiodevice.html#mode">QIODevice::mode</a>(). +<p> Note that if you create a QTextStream <tt>cout</tt> or another name that +is also used for another variable of a different type, some +linkers may confuse the two variables, which will often cause +crashes. + +<h3 class=fn><a name="~QTextStream"></a>QTextStream::~QTextStream ()<tt> [virtual]</tt> +</h3> +Destroys the text stream. +<p> The destructor does not affect the current IO device. + +<h3 class=fn>bool <a name="atEnd"></a>QTextStream::atEnd () const +</h3> + +<p> Returns TRUE if the IO device has reached the end position (end of +the stream or file) or if there is no IO device set; otherwise +returns FALSE. +<p> <p>See also <a href="qiodevice.html#atEnd">QIODevice::atEnd</a>(). + +<p>Examples: <a href="addressbook-example.html#x601">addressbook/centralwidget.cpp</a> and <a href="grapher-nsplugin-example.html#x2774">grapher/grapher.cpp</a>. +<h3 class=fn><a href="qtextcodec.html">QTextCodec</a> * <a name="codec"></a>QTextStream::codec () +</h3> +Returns the codec actually used for this stream. +<p> If Unicode is automatically detected in input, a codec with <a href="qtextcodec.html#name">name()</a> "ISO-10646-UCS-2" is returned. +<p> <p>See also <a href="#setCodec">setCodec</a>(). + +<h3 class=fn><a href="qiodevice.html">QIODevice</a> * <a name="device"></a>QTextStream::device () const +</h3> + +<p> Returns the IO device currently set. +<p> <p>See also <a href="#setDevice">setDevice</a>() and <a href="#unsetDevice">unsetDevice</a>(). + +<h3 class=fn>bool <a name="eof"></a>QTextStream::eof () const +</h3> +<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +<p> This function has been renamed to <a href="#atEnd">atEnd</a>(). +<p> <p>See also <a href="qiodevice.html#atEnd">QIODevice::atEnd</a>(). + +<p>Example: <a href="tutorial2-07.html#x2592">chart/chartform_files.cpp</a>. +<h3 class=fn>int <a name="fill"></a>QTextStream::fill () const +</h3> + +<p> Returns the fill character. The default value is ' ' (space). + +<h3 class=fn>int <a name="fill-2"></a>QTextStream::fill ( int f ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Sets the fill character to <em>f</em>. Returns the previous fill character. + +<h3 class=fn>int <a name="flags"></a>QTextStream::flags () const +</h3> + +<p> Returns the current stream flags. The default value is 0. +<p> <center><table cellpadding="4" cellspacing="2" border="0"> +<tr bgcolor="#a2c511"> <th valign="top">Flag <th valign="top">Meaning +<tr bgcolor="#f0f0f0"> <td valign="top"><tt>skipws</tt> <td valign="top">Not currently used; whitespace always skipped +<tr bgcolor="#d0d0d0"> <td valign="top"><tt>left</tt> <td valign="top">Numeric fields are left-aligned +<tr bgcolor="#f0f0f0"> <td valign="top"><tt>right</tt> +<td valign="top">Not currently used (by default, numerics are right-aligned) +<tr bgcolor="#d0d0d0"> <td valign="top"><tt>internal</tt> <td valign="top">Puts any padding spaces between +/- and value +<tr bgcolor="#f0f0f0"> <td valign="top"><tt>bin</tt> <td valign="top">Output <em>and</em> input only in binary +<tr bgcolor="#d0d0d0"> <td valign="top"><tt>oct</tt> <td valign="top">Output <em>and</em> input only in octal +<tr bgcolor="#f0f0f0"> <td valign="top"><tt>dec</tt> <td valign="top">Output <em>and</em> input only in decimal +<tr bgcolor="#d0d0d0"> <td valign="top"><tt>hex</tt> <td valign="top">Output <em>and</em> input only in hexadecimal +<tr bgcolor="#f0f0f0"> <td valign="top"><tt>showbase</tt> +<td valign="top">Annotates numeric outputs with 0b, 0, or 0x if in <tt>bin</tt>, +<tt>oct</tt>, or <tt>hex</tt> format +<tr bgcolor="#d0d0d0"> <td valign="top"><tt>showpoint</tt> <td valign="top">Not currently used +<tr bgcolor="#f0f0f0"> <td valign="top"><tt>uppercase</tt> <td valign="top">Uses 0B and 0X rather than 0b and 0x +<tr bgcolor="#d0d0d0"> <td valign="top"><tt>showpos</tt> <td valign="top">Shows + for positive numeric values +<tr bgcolor="#f0f0f0"> <td valign="top"><tt>scientific</tt> <td valign="top">Uses scientific notation for floating point values +<tr bgcolor="#d0d0d0"> <td valign="top"><tt>fixed</tt> <td valign="top">Uses fixed-point notation for floating point values +</table></center> +<p> Note that unless <tt>bin</tt>, <tt>oct</tt>, <tt>dec</tt>, or <tt>hex</tt> is set, the +input base is octal if the value starts with 0, hexadecimal if it +starts with 0x, binary if it starts with 0b, and decimal +otherwise. +<p> <p>See also <a href="#setf">setf</a>() and <a href="#unsetf">unsetf</a>(). + +<h3 class=fn>int <a name="flags-2"></a>QTextStream::flags ( int f ) +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Sets the stream flags to <em>f</em>. Returns the previous stream flags. +<p> <p>See also <a href="#setf">setf</a>() and <a href="#unsetf">unsetf</a>(). + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt"></a>QTextStream::operator<< ( <a href="qchar.html">QChar</a> c ) +</h3> +Writes character <tt>char</tt> to the stream and returns a reference to +the stream. +<p> The character <em>c</em> is assumed to be Latin1 encoded independent of +the Encoding set for the QTextStream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-2"></a>QTextStream::operator<< ( char c ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes character <em>c</em> to the stream and returns a reference to the +stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-3"></a>QTextStream::operator<< ( signed short i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes a <tt>short</tt> integer <em>i</em> to the stream and returns a +reference to the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-4"></a>QTextStream::operator<< ( unsigned short i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes an <tt>unsigned</tt> <tt>short</tt> integer <em>i</em> to the stream and +returns a reference to the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-5"></a>QTextStream::operator<< ( signed int i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes an <tt>int</tt> <em>i</em> to the stream and returns a reference to the +stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-6"></a>QTextStream::operator<< ( unsigned int i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes an <tt>unsigned</tt> <tt>int</tt> <em>i</em> to the stream and returns a +reference to the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-7"></a>QTextStream::operator<< ( signed long i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes a <tt>long</tt> <tt>int</tt> <em>i</em> to the stream and returns a reference +to the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-8"></a>QTextStream::operator<< ( unsigned long i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes an <tt>unsigned</tt> <tt>long</tt> <tt>int</tt> <em>i</em> to the stream and +returns a reference to the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-9"></a>QTextStream::operator<< ( float f ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes a <tt>float</tt> <em>f</em> to the stream and returns a reference to +the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-a"></a>QTextStream::operator<< ( double f ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes a <tt>double</tt> <em>f</em> to the stream and returns a reference to +the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-b"></a>QTextStream::operator<< ( const char * s ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes a string to the stream and returns a reference to the +stream. +<p> The string <em>s</em> is assumed to be Latin1 encoded independent of the +Encoding set for the QTextStream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-c"></a>QTextStream::operator<< ( const <a href="qstring.html">QString</a> & s ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes <em>s</em> to the stream and returns a reference to the stream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-d"></a>QTextStream::operator<< ( const <a href="qcstring.html">QCString</a> & s ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes <em>s</em> to the stream and returns a reference to the stream. +<p> The string <em>s</em> is assumed to be Latin1 encoded independent of the +Encoding set for the QTextStream. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt-e"></a>QTextStream::operator<< ( void * ptr ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Writes a pointer to the stream and returns a reference to the +stream. +<p> The <em>ptr</em> is output as an unsigned long hexadecimal integer. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt"></a>QTextStream::operator>> ( <a href="qchar.html">QChar</a> & c ) +</h3> +Reads a char <em>c</em> from the stream and returns a reference to the +stream. Note that whitespace is <em>not</em> skipped. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-2"></a>QTextStream::operator>> ( char & c ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a char <em>c</em> from the stream and returns a reference to the +stream. Note that whitespace is skipped. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-3"></a>QTextStream::operator>> ( signed short & i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a signed <tt>short</tt> integer <em>i</em> from the stream and returns a +reference to the stream. See <a href="#flags">flags</a>() for an explanation of the +expected input format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-4"></a>QTextStream::operator>> ( unsigned short & i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads an unsigned <tt>short</tt> integer <em>i</em> from the stream and +returns a reference to the stream. See <a href="#flags">flags</a>() for an explanation +of the expected input format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-5"></a>QTextStream::operator>> ( signed int & i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a signed <tt>int</tt> <em>i</em> from the stream and returns a reference +to the stream. See <a href="#flags">flags</a>() for an explanation of the expected +input format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-6"></a>QTextStream::operator>> ( unsigned int & i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads an unsigned <tt>int</tt> <em>i</em> from the stream and returns a +reference to the stream. See <a href="#flags">flags</a>() for an explanation of the +expected input format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-7"></a>QTextStream::operator>> ( signed long & i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a signed <tt>long</tt> int <em>i</em> from the stream and returns a +reference to the stream. See <a href="#flags">flags</a>() for an explanation of the +expected input format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-8"></a>QTextStream::operator>> ( unsigned long & i ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads an unsigned <tt>long</tt> int <em>i</em> from the stream and returns a +reference to the stream. See <a href="#flags">flags</a>() for an explanation of the +expected input format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-9"></a>QTextStream::operator>> ( float & f ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a <tt>float</tt> <em>f</em> from the stream and returns a reference to +the stream. See <a href="#flags">flags</a>() for an explanation of the expected input +format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-a"></a>QTextStream::operator>> ( double & f ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a <tt>double</tt> <em>f</em> from the stream and returns a reference to +the stream. See <a href="#flags">flags</a>() for an explanation of the expected input +format. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-b"></a>QTextStream::operator>> ( char * s ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a "word" from the stream into <em>s</em> and returns a reference +to the stream. +<p> A word consists of characters for which isspace() returns FALSE. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-c"></a>QTextStream::operator>> ( <a href="qstring.html">QString</a> & str ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a "word" from the stream into <em>str</em> and returns a reference +to the stream. +<p> A word consists of characters for which isspace() returns FALSE. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-gt-gt-d"></a>QTextStream::operator>> ( <a href="qcstring.html">QCString</a> & str ) +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Reads a "word" from the stream into <em>str</em> and returns a reference +to the stream. +<p> A word consists of characters for which isspace() returns FALSE. + +<h3 class=fn>int <a name="precision"></a>QTextStream::precision () const +</h3> + +<p> Returns the precision. The default value is 6. + +<h3 class=fn>int <a name="precision-2"></a>QTextStream::precision ( int p ) +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Sets the precision to <em>p</em>. Returns the previous precision setting. + +<h3 class=fn><a href="qstring.html">QString</a> <a name="read"></a>QTextStream::read () +</h3> +Reads the entire stream from the current position, and returns a string +containing the text. +<p> <p>See also <a href="qiodevice.html#readLine">QIODevice::readLine</a>(). + +<p>Examples: <a href="qaction-application-example.html#x1171">action/application.cpp</a>, <a href="simple-application-example.html#x1589">application/application.cpp</a>, <a href="mdi-example.html#x2074">mdi/application.cpp</a>, <a href="qdir-example.html#x1847">qdir/qdir.cpp</a>, and <a href="qwerty-example.html#x401">qwerty/qwerty.cpp</a>. +<h3 class=fn><a href="qstring.html">QString</a> <a name="readLine"></a>QTextStream::readLine () +</h3> +Reads a line from the stream and returns a string containing the +text. +<p> The returned string does not contain any trailing newline or +carriage return. Note that this is different from +<a href="qiodevice.html#readLine">QIODevice::readLine</a>(), which does not strip the newline at the end +of the line. +<p> On EOF you will get a <a href="qstring.html">QString</a> that is null. On reading an empty +line the returned QString is empty but not null. +<p> <p>See also <a href="qiodevice.html#readLine">QIODevice::readLine</a>(). + +<p>Examples: <a href="addressbook-example.html#x602">addressbook/centralwidget.cpp</a>, <a href="tutorial2-03.html#x2553">chart/element.cpp</a>, and <a href="clientserver-example.html#x787">network/clientserver/server/server.cpp</a>. +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="readRawBytes"></a>QTextStream::readRawBytes ( char * s, uint len ) +</h3> +Reads <em>len</em> bytes from the stream into <em>s</em> and returns a +reference to the stream. +<p> The buffer <em>s</em> must be preallocated. +<p> Note that no encoding is done by this function. +<p> <b>Warning:</b> The behavior of this function is undefined unless the +stream's encoding is set to Unicode or Latin1. +<p> <p>See also <a href="qiodevice.html#readBlock">QIODevice::readBlock</a>(). + +<h3 class=fn>void <a name="reset"></a>QTextStream::reset () +</h3> +Resets the text stream. +<p> <ul> +<li> All flags are set to 0. +<li> The field width is set to 0. +<li> The fill character is set to ' ' (Space). +<li> The precision is set to 6. +</ul> +<p> <p>See also <a href="#setf">setf</a>(), <a href="#width">width</a>(), <a href="#fill">fill</a>(), and <a href="#precision">precision</a>(). + +<h3 class=fn>void <a name="setCodec"></a>QTextStream::setCodec ( <a href="qtextcodec.html">QTextCodec</a> * codec ) +</h3> +Sets the codec for this stream to <em>codec</em>. Will not try to +autodetect Unicode. +<p> Note that this function should be called before any data is read +to/written from the stream. +<p> <p>See also <a href="#setEncoding">setEncoding</a>() and <a href="#codec">codec</a>(). + +<p>Example: <a href="qwerty-example.html#x402">qwerty/qwerty.cpp</a>. +<h3 class=fn>void <a name="setDevice"></a>QTextStream::setDevice ( <a href="qiodevice.html">QIODevice</a> * iod ) +</h3> +Sets the IO device to <em>iod</em>. +<p> <p>See also <a href="#device">device</a>() and <a href="#unsetDevice">unsetDevice</a>(). + +<h3 class=fn>void <a name="setEncoding"></a>QTextStream::setEncoding ( <a href="qtextstream.html#Encoding-enum">Encoding</a> e ) +</h3> +Sets the encoding of this stream to <em>e</em>, where <em>e</em> is one of the +following values: +<center><table cellpadding="4" cellspacing="2" border="0"> +<tr bgcolor="#a2c511"> <th valign="top">Encoding <th valign="top">Meaning +<tr bgcolor="#f0f0f0"> <td valign="top">Locale +<td valign="top">Uses local file format (Latin1 if locale is not set), but +autodetecting Unicode(utf16) on input. +<tr bgcolor="#d0d0d0"> <td valign="top">Unicode +<td valign="top">Uses Unicode(utf16) for input and output. Output will be +written in the order most efficient for the current platform +(i.e. the order used internally in <a href="qstring.html">QString</a>). +<tr bgcolor="#f0f0f0"> <td valign="top">UnicodeUTF8 +<td valign="top">Using Unicode(utf8) for input and output. If you use it for +input it will autodetect utf16 and use it instead of utf8. +<tr bgcolor="#d0d0d0"> <td valign="top">Latin1 +<td valign="top">ISO-8859-1. Will not autodetect utf16. +<tr bgcolor="#f0f0f0"> <td valign="top">UnicodeNetworkOrder +<td valign="top">Uses network order Unicode(utf16) for input and output. +Useful when reading Unicode data that does not start with the +byte order marker. +<tr bgcolor="#d0d0d0"> <td valign="top">UnicodeReverse +<td valign="top">Uses reverse network order Unicode(utf16) for input and +output. Useful when reading Unicode data that does not start +with the byte order marker or when writing data that should be +read by buggy Windows applications. +<tr bgcolor="#f0f0f0"> <td valign="top">RawUnicode +<td valign="top">Like Unicode, but does not write the byte order marker nor +does it auto-detect the byte order. Useful only when writing to +non-persistent storage used by a single process. +</table></center> +<p> <a href="#Encoding-enum">Locale</a> and all Unicode encodings, except <a href="#Encoding-enum">RawUnicode</a>, will look +at the first two bytes in an input stream to determine the byte +order. The initial byte order marker will be stripped off before +data is read. +<p> Note that this function should be called before any data is read to +or written from the stream. +<p> <p>See also <a href="#setCodec">setCodec</a>(). + +<p>Examples: <a href="addressbook-example.html#x603">addressbook/centralwidget.cpp</a>, <a href="httpd-example.html#x735">network/httpd/httpd.cpp</a>, and <a href="qwerty-example.html#x403">qwerty/qwerty.cpp</a>. +<h3 class=fn>int <a name="setf"></a>QTextStream::setf ( int bits ) +</h3> + +<p> Sets the stream flag bits <em>bits</em>. Returns the previous stream +flags. +<p> Equivalent to <tt>flags( flags() | bits )</tt>. +<p> <p>See also <a href="#unsetf">unsetf</a>(). + +<h3 class=fn>int <a name="setf-2"></a>QTextStream::setf ( int bits, int mask ) +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Sets the stream flag bits <em>bits</em> with a bit mask <em>mask</em>. Returns +the previous stream flags. +<p> Equivalent to <tt>flags( (flags() & ~mask) | (bits & mask) )</tt>. +<p> <p>See also <a href="#unsetf">unsetf</a>(). + +<h3 class=fn>void <a name="skipWhiteSpace"></a>QTextStream::skipWhiteSpace () +</h3> +Positions the read pointer at the first non-whitespace character. + +<h3 class=fn>void <a name="unsetDevice"></a>QTextStream::unsetDevice () +</h3> +Unsets the IO device. Equivalent to <a href="#setDevice">setDevice</a>( 0 ). +<p> <p>See also <a href="#device">device</a>() and <a href="#setDevice">setDevice</a>(). + +<h3 class=fn>int <a name="unsetf"></a>QTextStream::unsetf ( int bits ) +</h3> + +<p> Clears the stream flag bits <em>bits</em>. Returns the previous stream +flags. +<p> Equivalent to <tt>flags( flags() & ~mask )</tt>. +<p> <p>See also <a href="#setf">setf</a>(). + +<h3 class=fn>int <a name="width"></a>QTextStream::width () const +</h3> + +<p> Returns the field width. The default value is 0. + +<h3 class=fn>int <a name="width-2"></a>QTextStream::width ( int w ) +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Sets the field width to <em>w</em>. Returns the previous field width. + +<h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="writeRawBytes"></a>QTextStream::writeRawBytes ( const char * s, uint len ) +</h3> +Writes the <em>len</em> bytes from <em>s</em> to the stream and returns a +reference to the stream. +<p> Note that no encoding is done by this function. +<p> <p>See also <a href="qiodevice.html#writeBlock">QIODevice::writeBlock</a>(). + +<!-- eof --> +<hr><p> +This file is part of the <a href="index.html">Qt toolkit</a>. +Copyright © 1995-2007 +<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> +<table width=100% cellspacing=0 border=0><tr> +<td>Copyright © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>Qt 3.3.8</div> +</table></div></address></body> +</html> |