⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qiodevice.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
'\" t.TH QIODevice 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech 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 SYNOPSISAll the functions in this class are reentrant when Qt is built with thread support.</p>.PP\fC#include <qiodevice.h>\fR.PPInherited by QBuffer, QFile, QSocket, and QSocketDevice..PP.SS "Public Members".in +1c.ti -1c.BI "typedef Q_ULONG \fBOffset\fR".br.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 ) = 0".br.ti -1c.BI "virtual void \fBclose\fR () = 0".br.ti -1c.BI "virtual void \fBflush\fR () = 0".br.ti -1c.BI "virtual Offset \fBsize\fR () const = 0".br.ti -1c.BI "virtual Offset \fBat\fR () const".br.ti -1c.BI "virtual bool \fBat\fR ( Offset pos )".br.ti -1c.BI "virtual bool \fBatEnd\fR () const".br.ti -1c.BI "bool \fBreset\fR ()".br.ti -1c.BI "virtual Q_LONG \fBreadBlock\fR ( char * data, Q_ULONG maxlen ) = 0".br.ti -1c.BI "virtual Q_LONG \fBwriteBlock\fR ( const char * data, Q_ULONG len ) = 0".br.ti -1c.BI "virtual Q_LONG \fBreadLine\fR ( char * data, Q_ULONG maxlen )".br.ti -1c.BI "Q_LONG \fBwriteBlock\fR ( const QByteArray & data )".br.ti -1c.BI "virtual QByteArray \fBreadAll\fR ()".br.ti -1c.BI "virtual int \fBgetch\fR () = 0".br.ti -1c.BI "virtual int \fBputch\fR ( int ch ) = 0".br.ti -1c.BI "virtual int \fBungetch\fR ( int ch ) = 0".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/or write bytes to. The QIODevice class is the abstract superclass of all such devices; classes such as QFile, QBuffer and QSocket inherit QIODevice and implement virtual functions such as write() appropriately..PPAlthough applications sometimes use QIODevice directly, it is usually better to use QTextStream and QDataStream, which provide stream operations on any QIODevice subclass. QTextStream provides text-oriented stream functionality (for human-readable ASCII files, for example), whereas QDataStream deals with binary data in a totally platform-independent manner..PPThe public member functions in QIODevice roughly fall into two groups: the action functions and the state access functions. The most important action functions are:.IP.TPopen() opens a device for reading and/or writing, depending on the mode argument..IP.TPclose() closes the device and tidies up (e.g. flushes buffered data).IP.TPreadBlock() reads a block of data from the device..IP.TPwriteBlock() writes a block of data to the device..IP.TPreadLine() reads a line (of text, usually) from the device..IP.TPflush() ensures that all buffered data are written to the real device..IP.PPThere are also some other, less used, action functions:.IP.TPgetch() reads a single character..IP.TPungetch() forgets the last call to getch(), if possible..IP.TPputch() writes a single character..IP.TPsize() returns the size of the device, if there is one..IP.TPat() returns the current read/write pointer's position, if there is one for this device, or it moves the pointer if given an offset..IP.TPatEnd() indicates whether there is more to read, if this is meaningful for this device..IP.TPreset() moves the read/write pointer to the start of the device, if that is possible for this device..IP.PPThe state access are all "get" functions. The QIODevice subclass calls setState() 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:.IP.TPAccess type. Some devices are direct access (it is possible to read/write anywhere), whereas others are sequential. QIODevice provides the access functions (isDirectAccess(), isSequentialAccess(), and isCombinedAccess()) to tell users what a given I/O device supports..IP.TPBuffering. Some devices are accessed in raw mode, whereas others are buffered. Buffering usually provides greater efficiency, particularly for small read/write operations. isBuffered() tells the user whether a given device is buffered. (This can often be set by the application in the call to open().).IP.TPSynchronicity. Synchronous devices work immediately (for example, files). When you read from a file, the file delivers its data straight away. Other kinds of device, such as a socket connected to a HTTP server, may not deliver the data until seconds after you ask to read it. isSynchronous() and isAsynchronous() tell the user how this device operates..IP.TPCR/LF translation. For simplicity, applications often like to see just a single CR/LF style, and QIODevice subclasses can provide this. isTranslated() returns TRUE if this object translates CR/LF to just LF. (This can often be set by the application in the call to open().).IP.TPPermissions. Some files cannot be written. For example, isReadable(), isWritable() and isReadWrite() tell 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().).IP.TPFinally, isOpen() returns TRUE if the device is open, i.e. after an open() call..IP.PPQIODevice provides numerous pure virtual functions that you need to implement when subclassing it. Here is a skeleton subclass with all the members you are sure to need and some that you will probably need:.PP.nf.br    class MyDevice : public QIODevice.br    {.br    public:.br        MyDevice();.br        ~MyDevice();.br.br        bool open( int mode );.br        void close();.br        void flush();.br.br        uint size() const;.br        int  at() const;        // non-pure virtual.br        bool at( int );         // non-pure virtual.br        bool atEnd() const;     // non-pure virtual.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    };.br.fi.PPThe three non-pure virtual functions need not be reimplemented for sequential devices..PPSee also QDataStream, QTextStream, and Input/Output and Networking..SS "Member Type Documentation"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -