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
|
<!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 - QIODevice 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>QIODevice Class Reference</h1><br clear="all">
<p>
The QIODevice class is the base class of I/O devices.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qiodevice-h.html">qiodevice.h</a>></code>
<p>Inherited by <a href="qbuffer.html">QBuffer</a>, <a href="qfile.html">QFile</a>, <a href="qsocket.html">QSocket</a> and <a href="qsocketdevice.html">QSocketDevice</a>.
<p><a href="qiodevice-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#8fa6e5"><b>QIODevice</b></a>()</div>
<li><div class="fn">virtual<a href="#ac6bf9"><b>~QIODevice</b></a>()</div>
<li><div class="fn">int<a href="#6cd02d"><b>flags</b></a>()const</div>
<li><div class="fn">int<a href="#ac5d91"><b>mode</b></a>()const</div>
<li><div class="fn">int<a href="#27e36d"><b>state</b></a>()const</div>
<li><div class="fn">bool<a href="#39a85e"><b>isDirectAccess</b></a>()const</div>
<li><div class="fn">bool<a href="#d264a5"><b>isSequentialAccess</b></a>()const</div>
<li><div class="fn">bool<a href="#663267"><b>isCombinedAccess</b></a>()const</div>
<li><div class="fn">bool<a href="#38dfa5"><b>isBuffered</b></a>()const</div>
<li><div class="fn">bool<a href="#d4dd04"><b>isRaw</b></a>()const</div>
<li><div class="fn">bool<a href="#a5d52b"><b>isSynchronous</b></a>()const</div>
<li><div class="fn">bool<a href="#7d84ac"><b>isAsynchronous</b></a>()const</div>
<li><div class="fn">bool<a href="#8b6c51"><b>isTranslated</b></a>()const</div>
<li><div class="fn">bool<a href="#a109ae"><b>isReadable</b></a>()const</div>
<li><div class="fn">bool<a href="#67abcc"><b>isWritable</b></a>()const</div>
<li><div class="fn">bool<a href="#ed997c"><b>isReadWrite</b></a>()const</div>
<li><div class="fn">bool<a href="#706edf"><b>isInactive</b></a>()const</div>
<li><div class="fn">bool<a href="#1bc7b0"><b>isOpen</b></a>()const</div>
<li><div class="fn">int<a href="#494f6f"><b>status</b></a>()const</div>
<li><div class="fn">void<a href="#0fbc1d"><b>resetStatus</b></a>()</div>
<li><div class="fn">virtualbool<a href="#756b18"><b>open</b></a>(intmode)</div>
<li><div class="fn">virtualvoid<a href="#50fcfd"><b>close</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#dfd9f0"><b>flush</b></a>()</div>
<li><div class="fn">virtualuint<a href="#8ddedd"><b>size</b></a>()const</div>
<li><div class="fn">virtualint<a href="#a8b90e"><b>at</b></a>()const</div>
<li><div class="fn">virtualbool<a href="#90fb01"><b>at</b></a>(int)</div>
<li><div class="fn">virtualbool<a href="#d51a01"><b>atEnd</b></a>()const</div>
<li><div class="fn">bool<a href="#f119f6"><b>reset</b></a>()</div>
<li><div class="fn">virtualint<a href="#c12e6e"><b>readBlock</b></a>(char*data, uintmaxlen)</div>
<li><div class="fn">virtualint<a href="#924d2f"><b>writeBlock</b></a>(constchar*data, uintlen)</div>
<li><div class="fn">virtualint<a href="#0b6051"><b>readLine</b></a>(char*data, uintmaxlen)</div>
<li><div class="fn">int<a href="#ed9d37"><b>writeBlock</b></a>(constQByteArray&data)</div>
<li><div class="fn">QByteArray<a href="#c272a4"><b>readAll</b></a>()</div>
<li><div class="fn">virtualint<a href="#09409b"><b>getch</b></a>()</div>
<li><div class="fn">virtualint<a href="#71cd12"><b>putch</b></a>(int)</div>
<li><div class="fn">virtualint<a href="#05a43c"><b>ungetch</b></a>(int)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">void<b>setFlags</b>(intf)(internal)</div>
<li><div class="fn">void<b>setType</b>(int)(internal)</div>
<li><div class="fn">void<b>setMode</b>(int)(internal)</div>
<li><div class="fn">void<b>setState</b>(int)(internal)</div>
<li><div class="fn">void<b>setStatus</b>(int)(internal)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QIODevice class is the base class of I/O devices.
<p>
An I/O device represents a medium that one can read bytes from
and/or write bytes to. The QIODevice class is the abstract
superclass of all such devices; classes like <a href="qfile.html">QFile</a>, <a href="qbuffer.html">QBuffer</a> and
<a href="qsocket.html">QSocket</a> inherit QIODevice and implement virtual functions like
write() appropriately.
<p>While applications sometimes use QIODevice directly, mostly it is
better to go through <a href="qtextstream.html">QTextStream</a> and <a href="qdatastream.html">QDataStream</a>, which provide
stream operations on any QIODevice subclass. QTextStream provides
text-oriented stream functionality (for human-readable ASCII files,
for example), while QDataStream deals with binary data in a totally
platform-independent manner.
<p>The public member functions in QIODevice roughly fall into two
groups: The action functions and the state access functions. The
most important action functions are: <ul>
<li> <a href="#756b18">open</a>() opens a device for reading and/or writing, depending on
the argument to open().
<li> <a href="#50fcfd">close</a>() closes the device and tidies up.
<li> <a href="#c12e6e">readBlock</a>() reads a block of data from the device.
<li> <a href="#924d2f">writeBlock</a>() writes a block of data to the device.
<li> <a href="#0b6051">readLine</a>() reads a line (of text, usually) from the device.
<li> <a href="#dfd9f0">flush</a>() ensures that all buffered data are written to the real device.
<p></ul>There are also some other, less used, action functions: <ul>
<li> <a href="#09409b">getch</a>() reads a single character.
<li> <a href="#05a43c">ungetch</a>() forgets the last call to getch(), if possible.
<li> <a href="#71cd12">putch</a>() writes a single character.
<li> <a href="#8ddedd">size</a>() returns the size of the device, if there is one.
<li> <a href="#90fb01">at</a>() returns the current read/write pointer, if there is one
for this device, or it moves the pointer.
<li> <a href="#d51a01">atEnd</a>() says whether there is more to read, if that is a
meaningful question for this device.
<li> <a href="#f119f6">reset</a>() moves the read/write pointer to the start of the
device, if that is possible for this device.
<p></ul>The state access are all "get" functions. The QIODevice subclass
calls <a href="#5af6f9">setState</a>() to update the state, and simple access functions
tell the user of the device what the device's state is. Here are
the settings, and their associated access functions: <ul>
<li> Access type. Some devices are direct access (it is possible to
read/write anywhere) while others are sequential. QIODevice
provides the access functions <a href="#39a85e">isDirectAccess</a>(), <a href="#d264a5">isSequentialAccess</a>()
and <a href="#663267">isCombinedAccess</a>() to tell users what a given I/O device
supports.
<li> Buffering. Some devices are accessed in raw mode while others
are buffered. Buffering usually provides greater efficiency,
particularly for small read/write operations. <a href="#38dfa5">isBuffered</a>() tells
the user whether a given device is buffered. (This can often be set
by the application in the call to open().)
<li> Synchronicity. Synchronous devices work there and then, for
example files. When you read from a file, the file delivers its
data right away. Others, such as a socket connected to a HTTP
server, may not deliver the data until seconds after you ask to read
it. <a href="#a5d52b">isSynchronous</a>() and <a href="#7d84ac">isAsynchronous</a>() tells the user how this
device operates.
<li> CR/LF translation. For simplicity, applications often like to
see just a single CR/LF style, and QIODevice subclasses can provide
that. <a href="#8b6c51">isTranslated</a>() returns TRUE if this object translates CR/LF
to just LF. (This can often be set by the application in the call
to open().)
<li> Accessibility. Some files cannot be written, for example.
<a href="#a109ae">isReadable</a>(), isWritable and <a href="#ed997c">isReadWrite</a>() tells the application
whether it can read from and write to a given device. (This can
often be set by the application in the call to open().)
<li> Finally, <a href="#1bc7b0">isOpen</a>() returns TRUE if the device is open. This can
quite obviously be set using open() :)
<p></ul>
<p>QIODevice provides numerous pure virtual functions you need to
implement when subclassing it. Here is a skeleton subclass with all
the members you are certain to need, and some it's likely that you
will need:
<p><pre> class YourDevice : public QIODevice
{
public:
YourDevice();
~YourDevice();
bool open( int mode );
void close();
void flush();
uint size() const;
int at() const; // not a pure virtual function
bool at( int ); // not a pure virtual function
bool atEnd() const; // not a pure virtual function
int readBlock( char *data, uint maxlen );
int writeBlock( const char *data, uint len );
int readLine( char *data, uint maxlen );
int getch();
int putch( int );
int ungetch( int );
};
</pre>
<p>The three non-pure virtual functions can be ignored if your device
is sequential (e.g. an RS-232 port).
<p>See also <a href="qdatastream.html">QDataStream</a> and <a href="qtextstream.html">QTextStream</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="8fa6e5"></a>QIODevice::QIODevice()</h3>
<p>Constructs an I/O device.
<h3 class="fn"><a name="ac6bf9"></a>QIODevice::~QIODevice() <code>[virtual]</code></h3>
<p>Destructs the I/O device.
<h3 class="fn">bool<a name="90fb01"></a>QIODevice::at(intpos) <code>[virtual]</code></h3>
<p>Virtual function that sets the I/O device index to <em>pos.</em>
<p>See also <a href="#8ddedd">size</a>().
<p>Reimplemented in <a href="qsocketdevice.html#aaa87c">QSocketDevice</a>, <a href="qfile.html#858d0b">QFile</a>, <a href="qsocket.html#b852fb">QSocket</a> and <a href="qbuffer.html#491c1f">QBuffer</a>.
<h3 class="fn">int<a name="a8b90e"></a>QIODevice::at()const <code>[virtual]</code></h3>
<p>Virtual function that returns the current I/O device index.
<p>This index is the data read/write head of the I/O device.
<p>See also <a href="#8ddedd">size</a>().
<p>Reimplemented in <a href="qbuffer.html#3c9864">QBuffer</a>, <a href="qsocketdevice.html#00088b">QSocketDevice</a>, <a href="qfile.html#8218c0">QFile</a> and <a href="qsocket.html#d13990">QSocket</a>.
<h3 class="fn">bool<a name="d51a01"></a>QIODevice::atEnd()const <code>[virtual]</code></h3>
<p>Virtual function that returns TRUE if the I/O device index is at the
end of the input.
<p>Reimplemented in <a href="qsocket.html#78c453">QSocket</a>, <a href="qfile.html#b08f02">QFile</a> and <a href="qsocketdevice.html#394a25">QSocketDevice</a>.
<h3 class="fn">void<a name="50fcfd"></a>QIODevice::close() <code>[virtual]</code></h3>
<p>Closes the I/O device.
<p>This virtual function must be reimplemented by all subclasses.
<p>See also <a href="#756b18">open</a>().
<p>Reimplemented in <a href="qfile.html#64e640">QFile</a>, <a href="qbuffer.html#bcf8f3">QBuffer</a>, <a href="qsocketdevice.html#dfe8ce">QSocketDevice</a> and <a href="qsocket.html#9e4421">QSocket</a>.
<h3 class="fn">int<a name="6cd02d"></a>QIODevice::flags()const</h3>
<p>Returns the current I/O device flags setting.
<p>Flags consists of mode flags and state flags.
<p>See also <a href="#ac5d91">mode</a>() and <a href="#27e36d">state</a>().
<h3 class="fn">void<a name="dfd9f0"></a>QIODevice::flush() <code>[virtual]</code></h3>
<p>Flushes an open I/O device.
<p>This virtual function must be reimplemented by all subclasses.
<p>Reimplemented in <a href="qfile.html#cb0092">QFile</a>, <a href="qsocket.html#a0a8a9">QSocket</a>, <a href="qbuffer.html#c73504">QBuffer</a> and <a href="qsocketdevice.html#951a6c">QSocketDevice</a>.
<h3 class="fn">int<a name="09409b"></a>QIODevice::getch() <code>[virtual]</code></h3>
<p>Reads a single byte/character from the I/O device.
<p>Returns the byte/character read, or -1 if the end of the I/O device has been
reached.
<p>This virtual function must be reimplemented by all subclasses.
<p>See also <a href="#71cd12">putch</a>() and <a href="#05a43c">ungetch</a>().
<p>Reimplemented in <a href="qfile.html#596f05">QFile</a>, <a href="qsocket.html#42465c">QSocket</a>, <a href="qbuffer.html#9769c6">QBuffer</a> and <a href="qsocketdevice.html#6bb6e4">QSocketDevice</a>.
<h3 class="fn">bool<a name="7d84ac"></a>QIODevice::isAsynchronous()const</h3>
<p>Returns TRUE if the I/O device is a asynchronous device, otherwise
FALSE.
<p>This mode is currently not in use.
<p>See also <a href="#a5d52b">isSynchronous</a>().
<h3 class="fn">bool<a name="38dfa5"></a>QIODevice::isBuffered()const</h3>
<p>Returns TRUE if the I/O device is a buffered (not raw) device, otherwise
FALSE.
<p>See also <a href="#d4dd04">isRaw</a>().
<h3 class="fn">bool<a name="663267"></a>QIODevice::isCombinedAccess()const</h3>
<p>Returns TRUE if the I/O device is a combined access (both direct and
sequential) device, otherwise FALSE.
<p>This access method is currently not in use.
<h3 class="fn">bool<a name="39a85e"></a>QIODevice::isDirectAccess()const</h3>
<p>Returns TRUE if the I/O device is a direct access (not sequential) device,
otherwise FALSE.
<p>See also <a href="#d264a5">isSequentialAccess</a>().
<h3 class="fn">bool<a name="706edf"></a>QIODevice::isInactive()const</h3>
<p>Returns TRUE if the I/O device state is 0, i.e. the device is not open.
<p>See also <a href="#1bc7b0">isOpen</a>().
<h3 class="fn">bool<a name="1bc7b0"></a>QIODevice::isOpen()const</h3>
<p>Returns TRUE if the I/O device state has been opened, otherwise FALSE.
<p>See also <a href="#706edf">isInactive</a>().
<h3 class="fn">bool<a name="d4dd04"></a>QIODevice::isRaw()const</h3>
<p>Returns TRUE if the I/O device is a raw (not buffered) device, otherwise
FALSE.
<p>See also <a href="#38dfa5">isBuffered</a>().
<h3 class="fn">bool<a name="ed997c"></a>QIODevice::isReadWrite()const</h3>
<p>Returns TRUE if the I/O device was opened using <code>IO_ReadWrite</code> mode.
<p>See also <a href="#a109ae">isReadable</a>() and <a href="#67abcc">isWritable</a>().
<h3 class="fn">bool<a name="a109ae"></a>QIODevice::isReadable()const</h3>
<p>Returns TRUE if the I/O device was opened using <code>IO_ReadOnly</code> or
<code>IO_ReadWrite</code> mode.
<p>See also <a href="#67abcc">isWritable</a>() and <a href="#ed997c">isReadWrite</a>().
<h3 class="fn">bool<a name="d264a5"></a>QIODevice::isSequentialAccess()const</h3>
<p>Returns TRUE if the I/O device is a sequential access (not direct) device,
otherwise FALSE. Operations involving <a href="#8ddedd">size</a>() and <a href="#90fb01">at</a>(int) are not valid
on sequential devices.
<p>See also <a href="#39a85e">isDirectAccess</a>().
<h3 class="fn">bool<a name="a5d52b"></a>QIODevice::isSynchronous()const</h3>
<p>Returns TRUE if the I/O device is a synchronous device, otherwise
FALSE.
<p>See also <a href="#7d84ac">isAsynchronous</a>().
<h3 class="fn">bool<a name="8b6c51"></a>QIODevice::isTranslated()const</h3>
<p>Returns TRUE if the I/O device translates carriage-return and linefeed
characters.
<p>A <a href="qfile.html">QFile</a> is translated if it is opened with the <code>IO_Translate</code> mode
flag.
<h3 class="fn">bool<a name="67abcc"></a>QIODevice::isWritable()const</h3>
<p>Returns TRUE if the I/O device was opened using <code>IO_WriteOnly</code> or
<code>IO_ReadWrite</code> mode.
<p>See also <a href="#a109ae">isReadable</a>() and <a href="#ed997c">isReadWrite</a>().
<h3 class="fn">int<a name="ac5d91"></a>QIODevice::mode()const</h3>
<p>Returns bits OR'ed together that specify the current operation mode.
<p>These are the flags that were given to the <a href="#756b18">open</a>() function.
<p>The flags are: <code>IO_ReadOnly, IO_WriteOnly, IO_ReadWrite, IO_Append, IO_Truncate</code> and <code>IO_Translate.</code>
<h3 class="fn">bool<a name="756b18"></a>QIODevice::open(intmode) <code>[virtual]</code></h3>
<p>Opens the I/O device using the specified <em>mode.</em>
Returns TRUE if successful, or FALSE if the device could not be opened.
<p>The mode parameter <em>m</em> must be a combination of the following flags.
<ul>
<li><code>IO_Raw</code> specified raw (unbuffered) file access.
<li><code>IO_ReadOnly</code> opens a file in read-only mode.
<li><code>IO_WriteOnly</code> opens a file in write-only mode.
<li><code>IO_ReadWrite</code> opens a file in read/write mode.
<li><code>IO_Append</code> sets the file index to the end of the file.
<li><code>IO_Truncate</code> truncates the file.
<li><code>IO_Translate</code> enables carriage returns and linefeed translation
for text files under MS-DOS, Window, OS/2 and Macintosh. On Unix systems
this flag has no effect. Use with caution as it will also transform every linefeed
written to the file into a CRLF pair. This is likely to corrupt your file when
writing binary data to it. Cannot be combined with <code>IO_Raw.</code>
</ul>
<p>This virtual function must be reimplemented by all subclasses.
<p>See also <a href="#50fcfd">close</a>().
<p>Reimplemented in <a href="qsocket.html#45f735">QSocket</a>, <a href="qbuffer.html#53d514">QBuffer</a>, <a href="qfile.html#84dd8e">QFile</a> and <a href="qsocketdevice.html#32c3be">QSocketDevice</a>.
<h3 class="fn">int<a name="71cd12"></a>QIODevice::putch(intch) <code>[virtual]</code></h3>
<p>Writes the character <em>ch</em> to the I/O device.
<p>Returns <em>ch,</em> or -1 if some error occurred.
<p>This virtual function must be reimplemented by all subclasses.
<p>See also <a href="#09409b">getch</a>() and <a href="#05a43c">ungetch</a>().
<p>Reimplemented in <a href="qsocketdevice.html#89d3fd">QSocketDevice</a>, <a href="qfile.html#d70b87">QFile</a>, <a href="qsocket.html#64bd57">QSocket</a> and <a href="qbuffer.html#434945">QBuffer</a>.
<h3 class="fn"><a href="qbytearray.html">QByteArray</a><a name="c272a4"></a>QIODevice::readAll()</h3>
<p>This convenience function returns all of the remaining data in the
device. Note that this only works for direct access devices, such
as <a href="qfile.html">QFile</a>.
<p>See also <a href="#39a85e">isDirectAccess</a>().
<h3 class="fn">int<a name="c12e6e"></a>QIODevice::readBlock(char*data, uintmaxlen) <code>[virtual]</code></h3>
<p>Reads at most <em>maxlen</em> bytes from the I/O device into <em>data</em> and
returns the number of bytes actually read.
<p>This virtual function must be reimplemented by all subclasses.
<p>See also <a href="#924d2f">writeBlock</a>().
<p>Reimplemented in <a href="qbuffer.html#9062f3">QBuffer</a>, <a href="qsocket.html#d942f7">QSocket</a>, <a href="qfile.html#8c8ccc">QFile</a> and <a href="qsocketdevice.html#f51391">QSocketDevice</a>.
<h3 class="fn">int<a name="0b6051"></a>QIODevice::readLine(char*data, uintmaxlen) <code>[virtual]</code></h3>
<p>Reads a line of text, up to <em>maxlen</em> bytes including a terminating
\0. If there is a newline at the end if the line, it is not stripped.
<p>Returns the number of bytes read including the terminating \0, or -1 in case
of error.
<p>This virtual function can be reimplemented much more efficiently by
the most subclasses.
<p>See also <a href="#c12e6e">readBlock</a>() and <a href="qtextstream.html#ae4af4">QTextStream::readLine</a>().
<p>Reimplemented in <a href="qfile.html#0a06c2">QFile</a>, <a href="qsocket.html#068c90">QSocket</a> and <a href="qbuffer.html#07bef1">QBuffer</a>.
<h3 class="fn">bool<a name="f119f6"></a>QIODevice::reset()</h3>
<p>Sets the device index to 0.
<p>See also <a href="#90fb01">at</a>().
<h3 class="fn">void<a name="0fbc1d"></a>QIODevice::resetStatus()</h3>
<p>Sets the I/O device status to <code>IO_Ok.</code>
<p>See also <a href="#494f6f">status</a>().
<h3 class="fn">uint<a name="8ddedd"></a>QIODevice::size()const <code>[virtual]</code></h3>
<p>Virtual function that returns the size of the I/O device.
<p>See also <a href="#90fb01">at</a>().
<p>Reimplemented in <a href="qsocket.html#abe4ea">QSocket</a>, <a href="qfile.html#1e3b5e">QFile</a>, <a href="qbuffer.html#c4d405">QBuffer</a> and <a href="qsocketdevice.html#a126c7">QSocketDevice</a>.
<h3 class="fn">int<a name="27e36d"></a>QIODevice::state()const</h3>
<p>Returns bits OR'ed together that specify the current state.
<p>The flags are: <code>IO_Open.</code>
<p>Subclasses may define more flags.
<h3 class="fn">int<a name="494f6f"></a>QIODevice::status()const</h3>
<p>Returns the I/O device status.
<p>The I/O device status returns an error code. If <a href="#756b18">open</a>() returns FALSE
or <a href="#c12e6e">readBlock</a>() or <a href="#924d2f">writeBlock</a>() return -1, this function can be called to
get the reason why the operation did not succeed.
<p>The status codes are:
<ul>
<li><code>IO_Ok</code> The operation was successful.
<li><code>IO_ReadError</code> Could not read from the device.
<li><code>IO_WriteError</code> Could not write to the device.
<li><code>IO_FatalError</code> A fatal unrecoverable error occurred.
<li><code>IO_OpenError</code> Could not open the device.
<li><code>IO_ConnectError</code> Could not connect to the device.
<li><code>IO_AbortError</code> The operation was unexpectedly aborted.
<li><code>IO_TimeOutError</code> The operation timed out.
<li><code>IO_UnspecifiedError</code> An unspecified error happened on close.
</ul>
<p>See also <a href="#0fbc1d">resetStatus</a>().
<h3 class="fn">int<a name="05a43c"></a>QIODevice::ungetch(intch) <code>[virtual]</code></h3>
<p>Puts the character <em>ch</em> back into the I/O device and decrements the
index if it is not zero.
<p>This function is normally called to "undo" a <a href="#09409b">getch</a>() operation.
<p>Returns <em>ch,</em> or -1 if some error occurred.
<p>This virtual function must be reimplemented by all subclasses.
<p>See also <a href="#09409b">getch</a>() and <a href="#71cd12">putch</a>().
<p>Reimplemented in <a href="qsocket.html#a6be3e">QSocket</a>, <a href="qbuffer.html#4788e0">QBuffer</a>, <a href="qfile.html#471cf3">QFile</a> and <a href="qsocketdevice.html#68f6c9">QSocketDevice</a>.
<h3 class="fn">int<a name="ed9d37"></a>QIODevice::writeBlock(const<a href="qbytearray.html">QByteArray</a>&data)</h3>
<p>This convenience function is the same as calling
<a href="#924d2f">writeBlock</a>( data.data(), data.<a href="#8ddedd">size</a>() ).
<h3 class="fn">int<a name="924d2f"></a>QIODevice::writeBlock(constchar*data, uintlen) <code>[virtual]</code></h3>
<p>Writes <em>len</em> bytes from <em>p</em> to the I/O device and returns the number of
bytes actually written.
<p>This virtual function must be reimplemented by all subclasses.
<p>See also <a href="#c12e6e">readBlock</a>().
<p>Reimplemented in <a href="qsocketdevice.html#61dc32">QSocketDevice</a>, <a href="qfile.html#a44b6a">QFile</a>, <a href="qbuffer.html#d0ec2c">QBuffer</a> and <a href="qsocket.html#3cd3d6">QSocket</a>.
<h3 class="fn">void<a name="3975e7"></a>QIODevice::setFlags(intf) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="fff4ec"></a>QIODevice::setMode(intm) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="5af6f9"></a>QIODevice::setState(ints) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="b7a5e7"></a>QIODevice::setStatus(ints) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="4915ca"></a>QIODevice::setType(intt) <code>[protected]</code></h3>
<p>For internal use only.
<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>
|