qiodevice.3qt
来自「tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件」· 3QT 代码 · 共 461 行
3QT
461 行
.TH QIODevice 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQIODevice \- The base class of I/O devices.SH SYNOPSIS.br.PP\fC#include <qiodevice.h>\fR.PPInherited by QBuffer, QFile, QSocket and QSocketDevice..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQIODevice\fR ()".br.ti -1c.BI "virtual \fB~QIODevice\fR ()".br.ti -1c.BI "int \fBflags\fR () const".br.ti -1c.BI "int \fBmode\fR () const".br.ti -1c.BI "int \fBstate\fR () const".br.ti -1c.BI "bool \fBisDirectAccess\fR () const".br.ti -1c.BI "bool \fBisSequentialAccess\fR () const".br.ti -1c.BI "bool \fBisCombinedAccess\fR () const".br.ti -1c.BI "bool \fBisBuffered\fR () const".br.ti -1c.BI "bool \fBisRaw\fR () const".br.ti -1c.BI "bool \fBisSynchronous\fR () const".br.ti -1c.BI "bool \fBisAsynchronous\fR () const".br.ti -1c.BI "bool \fBisTranslated\fR () const".br.ti -1c.BI "bool \fBisReadable\fR () const".br.ti -1c.BI "bool \fBisWritable\fR () const".br.ti -1c.BI "bool \fBisReadWrite\fR () const".br.ti -1c.BI "bool \fBisInactive\fR () const".br.ti -1c.BI "bool \fBisOpen\fR () const".br.ti -1c.BI "int \fBstatus\fR () const".br.ti -1c.BI "void \fBresetStatus\fR ()".br.ti -1c.BI "virtual bool \fBopen\fR ( int mode )".br.ti -1c.BI "virtual void \fBclose\fR ()".br.ti -1c.BI "virtual void \fBflush\fR ()".br.ti -1c.BI "virtual uint \fBsize\fR () const".br.ti -1c.BI "virtual int \fBat\fR () const".br.ti -1c.BI "virtual bool \fBat\fR ( int )".br.ti -1c.BI "virtual bool \fBatEnd\fR () const".br.ti -1c.BI "bool \fBreset\fR ()".br.ti -1c.BI "virtual int \fBreadBlock\fR ( char * " "data" ", uint maxlen )".br.ti -1c.BI "virtual int \fBwriteBlock\fR ( const char * " "data" ", uint len )".br.ti -1c.BI "virtual int \fBreadLine\fR ( char * " "data" ", uint maxlen )".br.ti -1c.BI "int \fBwriteBlock\fR ( const QByteArray & data )".br.ti -1c.BI "QByteArray \fBreadAll\fR ()".br.ti -1c.BI "virtual int \fBgetch\fR ()".br.ti -1c.BI "virtual int \fBputch\fR ( int )".br.ti -1c.BI "virtual int \fBungetch\fR ( int )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBsetFlags\fR ( int f )".br.ti -1c.BI "void \fBsetType\fR ( int )".br.ti -1c.BI "void \fBsetMode\fR ( int )".br.ti -1c.BI "void \fBsetState\fR ( int )".br.ti -1c.BI "void \fBsetStatus\fR ( int )".br.in -1c.SH DESCRIPTIONThe QIODevice class is the base class of I/O devices..PPAn I/O device represents a medium that one can read bytes from and write bytes to. The QIODevice class itself is not capable of reading or writing any data; it has virtual functions for doing so. These functions are implemented by the subclasses QFile and QBuffer..PPThere are two types of I/O devices; <em>direct access</em> and <em>sequential access </em> devices. Files can normally be accessed directly, except \fCstdin\fR etc., which must be processed sequentially. Buffers are always direct access devices..PPThe access mode of an I/O device can be either \fIraw\fR or \fIbuffered.\fR QFile objects can be created using one of these. Raw access mode is more low level, while buffered access use smart buffering techniques. The raw access mode is best when I/O is block-operated using 4kB block size or greater. Buffered access works better when reading small portions of data at a time..PPAn I/O device operation can be executed in either \fIsynchronous\fR or \fIasynchronous\fR mode. The I/O devices currently supported by Qt only execute synchronously..PPThe QDataStream and QTextStream provide binary and text operations on QIODevice objects..PPQIODevice provides numerous pure virtual functions you need to implement when subclassing it. Here is a skeleton subclass:.PP.nf.br class YourDevice : public QIODevice.br {.br public:.br YourDevice();.br ~YourDevice();.br.br bool open( int mode );.br void close();.br void flush();.br.br uint size() const;.br int at() const; // not a pure virtual function.br bool at( int ); // not a pure virtual function.br bool atEnd() const; // not a pure virtual function.br.br int readBlock( char *data, uint maxlen );.br int writeBlock( const char *data, uint len );.br int readLine( char *data, uint maxlen );.br.br int getch();.br int putch( int );.br int ungetch( int );.br };.fi.PPThe three non-pure virtual functions can be ignored if your device is sequential (e.g. a tape device)..PPSee also: QDataStream and QTextStream..SH MEMBER FUNCTION DOCUMENTATION.SH "QIODevice::QIODevice ()"Constructs an I/O device..SH "QIODevice::~QIODevice () \fC[virtual]\fR"Destroys the I/O device..SH "bool QIODevice::at ( int pos ) \fC[virtual]\fR"Virtual function that sets the I/O device index to \fIpos.\fR.PPSee also: size()..PPReimplemented in QSocketDevice, QSocket, QFile and QBuffer..SH "int QIODevice::at () const \fC[virtual]\fR"Virtual function that returns the current I/O device index..PPThis index is the data read/write head of the I/O device..PPSee also: size()..PPReimplemented in QFile, QBuffer, QSocket and QSocketDevice..SH "bool QIODevice::atEnd () const \fC[virtual]\fR"Virtual function that returns TRUE if the I/O device index is at the end of the input..PPReimplemented in QSocketDevice, QFile and QSocket..SH "void QIODevice::close () \fC[virtual]\fR"Closes the I/O device..PPThis virtual function must be reimplemented by all subclasses..PPSee also: open()..PPReimplemented in QSocketDevice, QFile, QSocket and QBuffer..SH "int QIODevice::flags () const"Returns the current I/O device flags setting..PPFlags consists of mode flags and state flags..PPSee also: mode() and state()..SH "void QIODevice::flush () \fC[virtual]\fR"Flushes an open I/O device..PPThis virtual function must be reimplemented by all subclasses..PPReimplemented in QBuffer, QSocketDevice, QFile and QSocket..SH "int QIODevice::getch () \fC[virtual]\fR"Reads a single byte/character from the I/O device..PPReturns the byte/character read, or -1 if the end of the I/O device has been reached..PPThis virtual function must be reimplemented by all subclasses..PPSee also: putch() and ungetch()..PPReimplemented in QSocketDevice, QSocket, QFile and QBuffer..SH "bool QIODevice::isAsynchronous () const"Returns TRUE if the I/O device is a asynchronous device, otherwise FALSE..PPThis mode is currently not in use..PPSee also: isSynchronous()..SH "bool QIODevice::isBuffered () const"Returns TRUE if the I/O device is a buffered (not raw) device, otherwise FALSE..PPSee also: isRaw()..SH "bool QIODevice::isCombinedAccess () const"Returns TRUE if the I/O device is a combined access (both direct and sequential) device, otherwise FALSE..PPThis access method is currently not in use..SH "bool QIODevice::isDirectAccess () const"Returns TRUE if the I/O device is a direct access (not sequential) device, otherwise FALSE..PPSee also: isSequentialAccess()..SH "bool QIODevice::isInactive () const"Returns TRUE if the I/O device state is 0, i.e. the device is not open..PPSee also: isOpen()..SH "bool QIODevice::isOpen () const"Returns TRUE if the I/O device state has been opened, otherwise FALSE..PPSee also: isInactive()..SH "bool QIODevice::isRaw () const"Returns TRUE if the I/O device is a raw (not buffered) device, otherwise FALSE..PPSee also: isBuffered()..SH "bool QIODevice::isReadWrite () const"Returns TRUE if the I/O device was opened using \fCIO_ReadWrite\fR mode..PPSee also: isReadable() and isWritable()..SH "bool QIODevice::isReadable () const"Returns TRUE if the I/O device was opened using \fCIO_ReadOnly\fR or \fCIO_ReadWrite\fR mode..PPSee also: isWritable() and isReadWrite()..SH "bool QIODevice::isSequentialAccess () const"Returns TRUE if the I/O device is a sequential access (not direct) device, otherwise FALSE. Operations involving size() and at(int) are not valid on sequential devices..PPSee also: isDirectAccess()..SH "bool QIODevice::isSynchronous () const"Returns TRUE if the I/O device is a synchronous device, otherwise FALSE..PPSee also: isAsynchronous()..SH "bool QIODevice::isTranslated () const"Returns TRUE if the I/O device translates carriage-return and linefeed characters..PPA QFile is translated if it is opened with the \fCIO_Translate\fR mode flag..SH "bool QIODevice::isWritable () const"Returns TRUE if the I/O device was opened using \fCIO_WriteOnly\fR or \fCIO_ReadWrite\fR mode..PPSee also: isReadable() and isReadWrite()..SH "int QIODevice::mode () const"Returns bits OR'ed together that specify the current operation mode..PPThese are the flags that were given to the open() function..PPThe flags are: \fCIO_ReadOnly, IO_WriteOnly, IO_ReadWrite, IO_Append, IO_Truncate\fR and \fCIO_Translate.\fR.SH "bool QIODevice::open ( int mode ) \fC[virtual]\fR"Opens the I/O device using the specified \fImode.\fR Returns TRUE if successful, or FALSE if the device could not be opened..PPThe mode parameter \fIm\fR must be a combination of the following flags..TP\fCIO_Raw\fR specified raw (unbuffered) file access..TP\fCIO_ReadOnly\fR opens a file in read-only mode..TP\fCIO_WriteOnly\fR opens a file in write-only mode..TP\fCIO_ReadWrite\fR opens a file in read/write mode..TP\fCIO_Append\fR sets the file index to the end of the file..TP\fCIO_Truncate\fR truncates the file..TP\fCIO_Translate\fR enables carriage returns and linefeed translation for text files under MS-DOS, Window, OS/2 and Macintosh. Cannot be combined with \fCIO_Raw.\fR.PPThis virtual function must be reimplemented by all subclasses..PPSee also: close()..PPReimplemented in QSocketDevice, QSocket, QBuffer and QFile..SH "int QIODevice::putch ( int ch ) \fC[virtual]\fR"Writes the character \fIch\fR to the I/O device..PPReturns \fIch,\fR or -1 if some error occurred..PPThis virtual function must be reimplemented by all subclasses..PPSee also: getch() and ungetch()..PPReimplemented in QSocketDevice, QSocket, QFile and QBuffer..SH "QByteArray QIODevice::readAll ()"This convenience function returns all of the remaining data in the device. Note that this only works for <em>direct access</em> devices, such as QFile..SH "int QIODevice::readBlock ( char * data, uint maxlen ) \fC[virtual]\fR"Reads at most \fImaxlen\fR bytes from the I/O device into \fIdata\fR and returns the number of bytes actually read..PPThis virtual function must be reimplemented by all subclasses..PPSee also: writeBlock()..PPReimplemented in QSocket, QBuffer, QSocketDevice and QFile..SH "int QIODevice::readLine ( char * data, uint maxlen ) \fC[virtual]\fR"Reads a line of text, up to \fImaxlen\fR bytes including a terminating \\0. If there is a newline at the end if the line, it is not stripped..PPReturns the number of bytes read, or -1 in case of error..PPThis virtual function can be reimplemented much more efficiently by the most subclasses..PPSee also: readBlock() and QTextStream::readLine()..PPReimplemented in QBuffer and QFile..SH "bool QIODevice::reset ()"Sets the device index to 0..PPSee also: at()..SH "void QIODevice::resetStatus ()"Sets the I/O device status to \fCIO_Ok.\fR.PPSee also: status()..SH "void QIODevice::setFlags ( int f ) \fC[protected]\fR"For internal use only..SH "void QIODevice::setMode ( int m ) \fC[protected]\fR"For internal use only..SH "void QIODevice::setState ( int s ) \fC[protected]\fR"For internal use only..SH "void QIODevice::setStatus ( int s ) \fC[protected]\fR"For internal use only..SH "void QIODevice::setType ( int t ) \fC[protected]\fR"For internal use only..SH "uint QIODevice::size () const \fC[virtual]\fR"Virtual function that returns the size of the I/O device..PPSee also: at()..PPReimplemented in QSocket, QSocketDevice, QFile and QBuffer..SH "int QIODevice::state () const"Returns bits OR'ed together that specify the current state..PPThe flags are: \fCIO_Open.\fR.PPSubclasses may define more flags..SH "int QIODevice::status () const"Returns the I/O device status..PPThe I/O device status returns an error code. If open() returns FALSE or readBlock() or writeBlock() return -1, this function can be called to get the reason why the operation did not succeed..PPThe status codes are:.TP\fCIO_Ok\fR The operation was successful..TP\fCIO_ReadError\fR Could not read from the device..TP\fCIO_WriteError\fR Could not write to the device..TP\fCIO_FatalError\fR A fatal unrecoverable error occurred..TP\fCIO_OpenError\fR Could not open the device..TP\fCIO_ConnectError\fR Could not connect to the device..TP\fCIO_AbortError\fR The operation was unexpectedly aborted..TP\fCIO_TimeOutError\fR The operation timed out..TP\fCIO_OnCloseError\fR An unspecified error happend on close..PPSee also: resetStatus()..SH "int QIODevice::ungetch ( int ch ) \fC[virtual]\fR"Puts the character \fIch\fR back into the I/O device and decrements the index if it is not zero..PPThis function is normally called to "undo" a getch() operation..PPReturns \fIch,\fR or -1 if some error occurred..PPThis virtual function must be reimplemented by all subclasses..PPSee also: getch() and putch()..PPReimplemented in QBuffer, QFile, QSocketDevice and QSocket..SH "int QIODevice::writeBlock ( const QByteArray & data )"This convenience function is the same as calling writeBlock( data.data(), data.size() )..SH "int QIODevice::writeBlock ( const char * data, uint len ) \fC[virtual]\fR"Writes \fIlen\fR bytes from \fIp\fR to the I/O device and returns the number of bytes actually written..PPThis virtual function must be reimplemented by all subclasses..PPSee also: readBlock()..PPReimplemented in QBuffer, QSocketDevice, QFile and QSocket..SH "SEE ALSO".BR http://www.troll.no/qt/qiodevice.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS. See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?