1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QTextStream Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QTextStream Class Reference</h1><br clear="all">
<p>
The QTextStream class provides basic functions for reading and writing text using a <a href="qiodevice.html">QIODevice</a>.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qtextstream-h.html">qtextstream.h</a>></code>
<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><div class="fn">enum<b>Encoding</b>{Locale, Latin1, Unicode, UnicodeNetworkOrder, UnicodeReverse, RawUnicode, UnicodeUTF8}</div>
<li><div class="fn">void<a href="#2c5ab2"><b>setEncoding</b></a>(Encoding)</div>
<li><div class="fn">void<a href="#db3d00"><b>setCodec</b></a>(QTextCodec*)</div>
<li><div class="fn"><a href="#681486"><b>QTextStream</b></a>()</div>
<li><div class="fn"><a href="#a42395"><b>QTextStream</b></a>(QIODevice*)</div>
<li><div class="fn"><a href="#a7f7b1"><b>QTextStream</b></a>(QString*, intmode)</div>
<li><div class="fn">QTextStream(QString&, intmode)<em>(obsolete)</em></div>
<li><div class="fn"><a href="#fe7aab"><b>QTextStream</b></a>(QByteArray, intmode)</div>
<li><div class="fn"><a href="#34a15b"><b>QTextStream</b></a>(FILE*, intmode)</div>
<li><div class="fn">virtual<a href="#28871d"><b>~QTextStream</b></a>()</div>
<li><div class="fn">QIODevice*<a href="#af52a3"><b>device</b></a>()const</div>
<li><div class="fn">void<a href="#879d54"><b>setDevice</b></a>(QIODevice*)</div>
<li><div class="fn">void<a href="#d4aebe"><b>unsetDevice</b></a>()</div>
<li><div class="fn">bool<a href="#e4d5a7"><b>atEnd</b></a>()const</div>
<li><div class="fn">booleof()const<em>(obsolete)</em></div>
<li><div class="fn">QTextStream&<a href="#ee78ff"><b>operator>></b></a>(QChar&)</div>
<li><div class="fn">QTextStream&<a href="#5684da"><b>operator>></b></a>(char&)</div>
<li><div class="fn">QTextStream&<a href="#648333"><b>operator>></b></a>(signedshort&)</div>
<li><div class="fn">QTextStream&<a href="#24dc0c"><b>operator>></b></a>(unsignedshort&)</div>
<li><div class="fn">QTextStream&<a href="#c392bb"><b>operator>></b></a>(signedint&)</div>
<li><div class="fn">QTextStream&<a href="#ab229c"><b>operator>></b></a>(unsignedint&)</div>
<li><div class="fn">QTextStream&<a href="#254947"><b>operator>></b></a>(signedlong&)</div>
<li><div class="fn">QTextStream&<a href="#98cfca"><b>operator>></b></a>(unsignedlong&)</div>
<li><div class="fn">QTextStream&<a href="#b8ed40"><b>operator>></b></a>(float&)</div>
<li><div class="fn">QTextStream&<a href="#9adf72"><b>operator>></b></a>(double&)</div>
<li><div class="fn">QTextStream&<a href="#1f4400"><b>operator>></b></a>(char*)</div>
<li><div class="fn">QTextStream&<a href="#ae2184"><b>operator>></b></a>(QString&)</div>
<li><div class="fn">QTextStream&<a href="#29b138"><b>operator>></b></a>(QCString&)</div>
<li><div class="fn">QTextStream&<a href="#fccfef"><b>operator<<</b></a>(QChar)</div>
<li><div class="fn">QTextStream&<a href="#189cef"><b>operator<<</b></a>(char)</div>
<li><div class="fn">QTextStream&<a href="#934a85"><b>operator<<</b></a>(signedshort)</div>
<li><div class="fn">QTextStream&<a href="#99d53b"><b>operator<<</b></a>(unsignedshort)</div>
<li><div class="fn">QTextStream&<a href="#426c0f"><b>operator<<</b></a>(signedint)</div>
<li><div class="fn">QTextStream&<a href="#fc83de"><b>operator<<</b></a>(unsignedint)</div>
<li><div class="fn">QTextStream&<a href="#0fab16"><b>operator<<</b></a>(signedlong)</div>
<li><div class="fn">QTextStream&<a href="#b01b83"><b>operator<<</b></a>(unsignedlong)</div>
<li><div class="fn">QTextStream&<a href="#84ccd9"><b>operator<<</b></a>(float)</div>
<li><div class="fn">QTextStream&<a href="#85bcbc"><b>operator<<</b></a>(double)</div>
<li><div class="fn">QTextStream&<a href="#da78df"><b>operator<<</b></a>(constchar*)</div>
<li><div class="fn">QTextStream&<a href="#129496"><b>operator<<</b></a>(constQString&)</div>
<li><div class="fn">QTextStream&<a href="#447aa9"><b>operator<<</b></a>(constQCString&)</div>
<li><div class="fn">QTextStream&<a href="#310459"><b>operator<<</b></a>(void*)</div>
<li><div class="fn">QTextStream&<a href="#5ae00e"><b>readRawBytes</b></a>(char*, uintlen)</div>
<li><div class="fn">QTextStream&<a href="#d777c3"><b>writeRawBytes</b></a>(constchar*, uintlen)</div>
<li><div class="fn">QString<a href="#ae4af4"><b>readLine</b></a>()</div>
<li><div class="fn">QString<a href="#4696a5"><b>read</b></a>()</div>
<li><div class="fn">void<a href="#2d500d"><b>skipWhiteSpace</b></a>()</div>
<li><div class="fn">enum{skipws=0x0001, left=0x0002, right=0x0004, internal=0x0008, bin=0x0010, oct=0x0020, dec=0x0040, hex=0x0080, showbase=0x0100, showpoint=0x0200, uppercase=0x0400, showpos=0x0800, scientific=0x1000, fixed=0x2000}</div>
<li><div class="fn">int<a href="#b8522e"><b>flags</b></a>()const</div>
<li><div class="fn">int<a href="#3a785c"><b>flags</b></a>(intf)</div>
<li><div class="fn">int<a href="#651443"><b>setf</b></a>(intbits)</div>
<li><div class="fn">int<a href="#febc0b"><b>setf</b></a>(intbits, intmask)</div>
<li><div class="fn">int<a href="#ed27a4"><b>unsetf</b></a>(intbits)</div>
<li><div class="fn">void<a href="#85b1c7"><b>reset</b></a>()</div>
<li><div class="fn">int<a href="#c45e81"><b>width</b></a>()const</div>
<li><div class="fn">int<a href="#a1bbbd"><b>width</b></a>(int)</div>
<li><div class="fn">int<a href="#c55685"><b>fill</b></a>()const</div>
<li><div class="fn">int<a href="#7e5360"><b>fill</b></a>(int)</div>
<li><div class="fn">int<a href="#b68e78"><b>precision</b></a>()const</div>
<li><div class="fn">int<a href="#72d2bc"><b>precision</b></a>(int)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QTextStream class provides basic functions for reading and writing text using a <a href="qiodevice.html">QIODevice</a>.
<p>
The text stream class has a functional interface that is very
similar to that of the standard C++ iostream class. The difference
between iostream and QTextStream is that our stream operates on a
QIODevice, which is easily subclassed, while iostream operates on
FILE * pointers, which can not be subclassed.
<p>Qt provides several global functions similar to the ones in iostream:
<ul>
<li> <code>bin</code> sets the QTextStream to read/write binary numbers
<li> <code>oct</code> sets the QTextStream to read/write octal numbers
<li> <code>dec</code> sets the QTextStream to read/write decimal numbers
<li> <code>hex</code> sets the QTextStream to read/write hexadecimal numbers
<li> <code>endl</code> forces a line break
<li> <code>flush</code> forces the QIODevice to flush any buffered data
<li> <code>ws</code> eats any available white space (on input)
<li> <code>reset</code> resets the QTextStream to its default mode (see <a href="#85b1c7">reset</a>()).
</ul><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, ie. the sequence "0100" will be interpreted as
64.
<p>The QTextStream class reads and writes text and it is not
appropriate for dealing with binary data (but <a href="qdatastream.html">QDataStream</a> is).
<p>By default output of Unicode text (ie. <a href="qstring.html">QString</a>) is done using the
local 8-bit encoding. This can be changed using the <a href="#2c5ab2">setEncoding</a>()
method. For input, the QTextStream will auto-detect standard
Unicode "byte order marked" text files, but otherwise the local
8-bit encoding is used.
<p>See also <a href="qdatastream.html">QDataStream</a>.
<p>Examples:
<a href="grapher-grapher-cpp.html#QTextStream">grapher/grapher.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="681486"></a>QTextStream::QTextStream()</h3>
<p>Constructs a data stream that has no IO device.
<h3 class="fn"><a name="fe7aab"></a>QTextStream::QTextStream(<a href="qbytearray.html">QByteArray</a>a, intmode)</h3>
<p>Constructs a text stream that operates on a byte array through an
internal <a href="qbuffer.html">QBuffer</a> device.
<p>Example:
<pre> <a href="qbytearray.html">QByteArray</a> array;
<a href="qtextstream.html">QTextStream</a> ts( array, IO_WriteOnly );
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="qbuffer.html#53d514">open</a>( IO_WriteOnly );
<a href="qtextstream.html">QTextStream</a> ts( &buf );
ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14"
buf.<a href="qbuffer.html#bcf8f3">close</a>();
</pre>
<h3 class="fn"><a name="a42395"></a>QTextStream::QTextStream(<a href="qiodevice.html">QIODevice</a>*iod)</h3>
<p>Constructs a text stream that uses the IO device <em>iod.</em>
<h3 class="fn"><a name="2da4c5"></a>QTextStream::QTextStream(<a href="qstring.html">QString</a>&str, intfilemode)</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
<p>This constructor is equivalent to the constructor taking a <a href="qstring.html">QString</a>*
parameter.
<h3 class="fn"><a name="a7f7b1"></a>QTextStream::QTextStream(<a href="qstring.html">QString</a>*str, intfilemode)</h3>
<p>Constructs a text stream that operates on a Unicode <a href="qstring.html">QString</a> through an
internal device.
<p>If you set an encoding or codec with <a href="#2c5ab2">setEncoding</a>() or <a href="#db3d00">setCodec</a>(), this
setting is ignored for text streams that operate on QString.
<p>Example:
<pre> <a href="qstring.html">QString</a> str;
<a href="qtextstream.html">QTextStream</a> ts( &str, IO_WriteOnly );
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";
<a href="qtextstream.html">QTextStream</a> ts( &str, IO_WriteOnly );
ts << "2+2 = " << 2+2; // str == "2+2 = 414"
</pre>
<p>Note that since QString is Unicode, you should not use <a href="#5ae00e">readRawBytes</a>()
or <a href="#d777c3">writeRawBytes</a>() on such a stream.
<h3 class="fn"><a name="34a15b"></a>QTextStream::QTextStream(FILE*fh, intmode)</h3>
<p>Constructs a text stream that operates on an existing file handle <em>fh</em>
through an internal <a href="qfile.html">QFile</a> device.
<p>Example:
<pre> <a href="qtextstream.html">QTextStream</a> cout( stdout, IO_WriteOnly );
<a href="qtextstream.html">QTextStream</a> cin ( stdin, IO_ReadOnly );
<a href="qtextstream.html">QTextStream</a> cerr( stderr, IO_WriteOnly );
</pre>
<h3 class="fn"><a name="28871d"></a>QTextStream::~QTextStream() <code>[virtual]</code></h3>
<p>Destructs the text stream.
<p>The destructor does not affect the current IO device.
<h3 class="fn">bool<a name="e4d5a7"></a>QTextStream::atEnd()const</h3>
<p>Returns TRUE if the IO device has reached the end position (end of
stream or file) or if there is no IO device set.
<p>Returns FALSE if the current position of the read/write head of the IO
device is somewhere before the end position.
<p>See also <a href="qiodevice.html#d51a01">QIODevice::atEnd</a>().
<h3 class="fn"><a href="qiodevice.html">QIODevice</a>*<a name="af52a3"></a>QTextStream::device()const</h3>
<p>Returns the IO device currently set.
<p>See also <a href="#879d54">setDevice</a>() and <a href="#d4aebe">unsetDevice</a>().
<h3 class="fn">bool<a name="bb145b"></a>QTextStream::eof()const</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
<p>This function has been renamed to <a href="#e4d5a7">atEnd</a>().
<p>See also <a href="qiodevice.html#d51a01">QIODevice::atEnd</a>().
<p>Examples:
<a href="grapher-grapher-cpp.html#eof">grapher/grapher.cpp</a>
<h3 class="fn">int<a name="c55685"></a>QTextStream::fill()const</h3>
<p>Returns the fill character. The default value is ' ' (space).
<h3 class="fn">int<a name="7e5360"></a>QTextStream::fill(intf)</h3>
<p>Sets the fill character to <em>f.</em> Returns the previous fill character.
<h3 class="fn">int<a name="b8522e"></a>QTextStream::flags()const</h3>
<p>Returns the current stream flags. The default value is 0.
<p>The meaning of the flags are:
<ul>
<li> <em>skipws</em> - Not currently used - whitespace always skipped
<li> <em>left</em> - Numeric fields are left-aligned
<li> <em>right</em> - Not currently used (by default numerics are right aligned)
<li> <em>internal</em> - Put any padding spaces between +/- and value
<li> <em>bin</em> - Output <em>and</em> input only in binary
<li> <em>oct</em> - Output <em>and</em> input only in octal
<li> <em>dec</em> - Output <em>and</em> input only in decimal
<li> <em>hex</em> - Output <em>and</em> input only in hexadecimal
<li> <em>showbase</em> - Annotate numeric outputs with 0b, 0, or 0x if in
<em>bin, oct,</em> or <em>hex</em> format
<li> <em>showpoint</em> - Not currently used
<li> <em>uppercase</em> - Use 0B and 0X rather than 0b and 0x
<li> <em>showpos</em> - Show + for positive numeric values
<li> <em>scientific</em> - Use scientific notation for floating point values
<li> <em>fixed</em> - Use fixed-point notation for floating point values
</ul>
<p>Note that unless <em>bin, oct, dec,</em> or <em>hex</em> is set, the input base is
octal if the value starts with 0, hexadecimal if it starts with 0x, binary
if the value starts with 0b, and decimal otherwise.
<p>See also <a href="#651443">setf</a>() and <a href="#ed27a4">unsetf</a>().
<h3 class="fn">int<a name="3a785c"></a>QTextStream::flags(intf)</h3>
<p>Sets the stream flags to <em>f.</em>
Returns the previous stream flags.
<p>See also <a href="#651443">setf</a>(), <a href="#ed27a4">unsetf</a>() and flags().
<h3 class="fn">QTextStream&<a name="fccfef"></a>QTextStream::operator<<(<a href="qchar.html">QChar</a>c)</h3>
<p>Writes a <code>char</code> 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">QTextStream&<a name="189cef"></a>QTextStream::operator<<(charc)</h3>
<p>Writes a <code>char</code> to the stream and returns a reference to the stream.
<h3 class="fn">QTextStream&<a name="447aa9"></a>QTextStream::operator<<(const<a href="qcstring.html">QCString</a>&s)</h3>
<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">QTextStream&<a name="129496"></a>QTextStream::operator<<(const<a href="qstring.html">QString</a>&s)</h3>
<p>Writes <em>s</em> to the stream and returns a reference to the stream.
<h3 class="fn">QTextStream&<a name="da78df"></a>QTextStream::operator<<(constchar*s)</h3>
<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">QTextStream&<a name="85bcbc"></a>QTextStream::operator<<(doublef)</h3>
<p>Writes a <code>double</code> to the stream and returns a reference to the stream.
<h3 class="fn">QTextStream&<a name="84ccd9"></a>QTextStream::operator<<(floatf)</h3>
<p>Writes a <code>float</code> to the stream and returns a reference to the stream.
<h3 class="fn">QTextStream&<a name="426c0f"></a>QTextStream::operator<<(signedinti)</h3>
<p>Writes an <code>int</code> to the stream and returns a reference to
the stream.
<h3 class="fn">QTextStream&<a name="0fab16"></a>QTextStream::operator<<(signedlongi)</h3>
<p>Writes a <code>long int</code> to the stream and returns a reference to
the stream.
<h3 class="fn">QTextStream&<a name="934a85"></a>QTextStream::operator<<(signedshorti)</h3>
<p>Writes a <code>short</code> integer to the stream and returns a reference to
the stream.
<h3 class="fn">QTextStream&<a name="fc83de"></a>QTextStream::operator<<(unsignedinti)</h3>
<p>Writes an <code>unsigned int</code> to the stream and returns a reference to
the stream.
<h3 class="fn">QTextStream&<a name="b01b83"></a>QTextStream::operator<<(unsignedlongi)</h3>
<p>Writes an <code>unsigned long int</code> to the stream and returns a reference to
the stream.
<h3 class="fn">QTextStream&<a name="99d53b"></a>QTextStream::operator<<(unsignedshorti)</h3>
<p>Writes an <code>unsigned short</code> integer to the stream and returns a reference
to the stream.
<h3 class="fn">QTextStream&<a name="310459"></a>QTextStream::operator<<(void*ptr)</h3>
<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">QTextStream&<a name="ee78ff"></a>QTextStream::operator>>(<a href="qchar.html">QChar</a>&c)</h3>
<p>Reads a <code>char</code> from the stream and returns a reference to the stream.
Note that whitespace is <em>not</em> skipped.
<h3 class="fn">QTextStream&<a name="29b138"></a>QTextStream::operator>>(<a href="qcstring.html">QCString</a>&str)</h3>
<p>Reads a word from the stream and returns a reference to the stream.
<h3 class="fn">QTextStream&<a name="ae2184"></a>QTextStream::operator>>(<a href="qstring.html">QString</a>&str)</h3>
<p>Reads a word from the stream and returns a reference to the stream.
<h3 class="fn">QTextStream&<a name="5684da"></a>QTextStream::operator>>(char&c)</h3>
<p>Reads a <code>char</code> from the stream and returns a reference to the stream.
Note that whitespace is skipped.
<h3 class="fn">QTextStream&<a name="1f4400"></a>QTextStream::operator>>(char*s)</h3>
<p>Reads a word from the stream and returns a reference to the stream.
<h3 class="fn">QTextStream&<a name="9adf72"></a>QTextStream::operator>>(double&f)</h3>
<p>Reads a <code>double</code> from the stream and returns a reference to the stream.
See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">QTextStream&<a name="b8ed40"></a>QTextStream::operator>>(float&f)</h3>
<p>Reads a <code>float</code> from the stream and returns a reference to the stream.
See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">QTextStream&<a name="c392bb"></a>QTextStream::operator>>(signedint&i)</h3>
<p>Reads a signed <code>int</code> from the stream and returns a reference to the
stream. See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">QTextStream&<a name="254947"></a>QTextStream::operator>>(signedlong&i)</h3>
<p>Reads a signed <code>long</code> int from the stream and returns a reference to the
stream. See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">QTextStream&<a name="648333"></a>QTextStream::operator>>(signedshort&i)</h3>
<p>Reads a signed <code>short</code> integer from the stream and returns a reference to
the stream. See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">QTextStream&<a name="ab229c"></a>QTextStream::operator>>(unsignedint&i)</h3>
<p>Reads an unsigned <code>int</code> from the stream and returns a reference to the
stream. See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">QTextStream&<a name="98cfca"></a>QTextStream::operator>>(unsignedlong&i)</h3>
<p>Reads an unsigned <code>long</code> int from the stream and returns a reference to the
stream. See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">QTextStream&<a name="24dc0c"></a>QTextStream::operator>>(unsignedshort&i)</h3>
<p>Reads an unsigned <code>short</code> integer from the stream and returns a reference to
the stream. See <a href="#3a785c">flags</a>() for an explanation of expected input format.
<h3 class="fn">int<a name="b68e78"></a>QTextStream::precision()const</h3>
<p>Returns the precision. The default value is 6.
<h3 class="fn">int<a name="72d2bc"></a>QTextStream::precision(intp)</h3>
<p>Sets the precision to <em>p.</em> Returns the previous precision setting.
<h3 class="fn"><a href="qstring.html">QString</a><a name="4696a5"></a>QTextStream::read()</h3>
<p>Reads the entire stream and returns a string containing the text.
<p>See also <a href="qiodevice.html#0b6051">QIODevice::readLine</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="ae4af4"></a>QTextStream::readLine()</h3>
<p>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#0b6051">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>See also <a href="qiodevice.html#0b6051">QIODevice::readLine</a>().
<h3 class="fn">QTextStream&<a name="5ae00e"></a>QTextStream::readRawBytes(char*s, uintlen)</h3>
<p>Reads <em>len</em> bytes from the stream into <em>e</em> s 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 behaviour of this function is undefined unless the
stream's encoding is set to Unicode or Latin1.
<p>See also <a href="qiodevice.html#c12e6e">QIODevice::readBlock</a>().
<h3 class="fn">void<a name="85b1c7"></a>QTextStream::reset()</h3>
<p>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>See also <a href="#651443">setf</a>(), <a href="#a1bbbd">width</a>(), <a href="#7e5360">fill</a>() and <a href="#72d2bc">precision</a>().
<h3 class="fn">void<a name="db3d00"></a>QTextStream::setCodec(<a href="qtextcodec.html">QTextCodec</a>*codec)</h3>
<p>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>See also <a href="#2c5ab2">setEncoding</a>().
<h3 class="fn">void<a name="879d54"></a>QTextStream::setDevice(<a href="qiodevice.html">QIODevice</a>*iod)</h3>
<p>Sets the IO device to <em>iod.</em>
<p>See also <a href="#af52a3">device</a>() and <a href="#d4aebe">unsetDevice</a>().
<h3 class="fn">void<a name="2c5ab2"></a>QTextStream::setEncoding(Encodinge)</h3>
<p>Sets the encoding of this stream to <em>e,</em> where <em>e</em> is one of:
<ul>
<li> <code>Locale</code> Using local file format (Latin1 if locale is not
set), but autodetecting Unicode(utf16) on input.
<li> <code>Unicode</code> Using 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>).
<li> <code>UnicodeUTF8</code> Using Unicode(utf8) for input and output. If you use it
for input it will autodetect utf16 and use it instead of utf8.
<li> <code>Latin1</code> ISO-8859-1. Will not autodetect utf16.
<li> <code>UnicodeNetworkOrder</code> Using network order Unicode(utf16) for
input and output. Useful when reading Unicode data that does not
start with the byte order marker.
<li> <code>UnicodeReverse</code> Using reverse network order Unicode(utf16)
for input and output. Useful when reading Unicode data that does not
start with the byte order marker, or writing data that should be
read by buggy Windows applications.
<li> <code>RawUnicode</code> Like Unicode, but does not write the byte order
marker, nor does it autodetect the byte order. Only useful when
writing to non-persistent storage used by a single process.
</ul>
<p><code>Locale</code> and all Unicode encodings, except <code>RawUnicode,</code> will look at
the first two bytes in a 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/written from the stream.
<p>See also <a href="#db3d00">setCodec</a>().
<h3 class="fn">int<a name="651443"></a>QTextStream::setf(intbits)</h3>
<p>Sets the stream flag bits <em>bits.</em>
Returns the previous stream flags.
<p>Equivalent to <code><a href="#3a785c">flags</a>( flags() | bits )</code>.
<p>See also setf() and <a href="#ed27a4">unsetf</a>().
<h3 class="fn">int<a name="febc0b"></a>QTextStream::setf(intbits, intmask)</h3>
<p>Sets the stream flag bits <em>bits</em> with a bit mask <em>mask.</em>
Returns the previous stream flags.
<p>Equivalent to <code><a href="#3a785c">flags</a>( (flags() & ~mask) | (bits & mask) )</code>.
<p>See also <a href="#651443">setf</a>() and <a href="#ed27a4">unsetf</a>().
<h3 class="fn">void<a name="2d500d"></a>QTextStream::skipWhiteSpace()</h3>
<p>Positions the read pointer at the first non-whitespace character.
<h3 class="fn">void<a name="d4aebe"></a>QTextStream::unsetDevice()</h3>
<p>Unsets the IO device. Equivalent to <a href="#879d54">setDevice</a>( 0 ).
<p>See also <a href="#af52a3">device</a>() and <a href="#879d54">setDevice</a>().
<h3 class="fn">int<a name="ed27a4"></a>QTextStream::unsetf(intbits)</h3>
<p>Clears the stream flag bits <em>bits.</em>
Returns the previous stream flags.
<p>Equivalent to <code><a href="#3a785c">flags</a>( flags() & ~mask )</code>.
<p>See also <a href="#651443">setf</a>().
<h3 class="fn">int<a name="c45e81"></a>QTextStream::width()const</h3>
<p>Returns the field width. The default value is 0.
<h3 class="fn">int<a name="a1bbbd"></a>QTextStream::width(intw)</h3>
<p>Sets the field width to <em>w.</em> Returns the previous field width.
<h3 class="fn">QTextStream&<a name="d777c3"></a>QTextStream::writeRawBytes(constchar*s, uintlen)</h3>
<p>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>See also <a href="qiodevice.html#924d2f">QIODevice::writeBlock</a>().
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|