#include <QIODeviceAdaptor.H>
This class adapts a standard input stream (std::istream) into a valid Qt QIODevice. All function calls performed on an instance of this class are transformed into calls to the istream data member. Although this class extends QIODevice, it implements only a sequential input stream
For compatibility reasons with the parent class QIODevice, this class implements some inherited function members that are not relevant for a sequential output stream. These members are:
Any attempt to use these function members will raise a std::runtime_error exception.
Definition at line 81 of file QIODeviceAdaptor.H.
Public Member Functions | |
| virtual bool | open (int mode) |
| Open the I/O device using a specified mode. | |
| virtual void | close () |
| Closes the device. | |
| virtual void | flush () |
| flushes an open iodevice | |
| virtual Offset | size () const |
| Returns the size of the IODevice. | |
| virtual Q_LONG | readBlock (char *data, Q_ULONG maxlen) |
| Reads a block of data from the stream. | |
| virtual Q_LONG | writeBlock (const char *data, Q_ULONG len) |
| Writes a block of data to the stream. | |
| virtual int | getch () |
| reads a single byte from the stream. | |
| virtual int | putch (int ch) |
| Writes a single byte to the stream. | |
| virtual int | ungetch (int ch) |
| Puts the character ch back into the I/O device and decrements the index position if it is not zero. | |
Constructors | |
| QIODeviceAdaptor (std::istream *stream) | |
| Default constructor. | |
Destructors | |
| virtual | ~QIODeviceAdaptor () |
| Destructor. | |
Protected Attributes | |
| std::istream * | _stream |
| The input stream implementing this IODevice. | |
|
|
Default constructor. Create an adaptor redirecting class to a QIODevice instance to a istream instance. This QIODevice should be used only as a sequential input device. The QIODevice flags set at the creation are:
|
|
|
Destructor.
Definition at line 72 of file QIODeviceAdaptor.C. References close(). |
|
|
Closes the device.
Definition at line 90 of file QIODeviceAdaptor.C. References flush(). Referenced by ~QIODeviceAdaptor(). |
|
|
flushes an open iodevice
Definition at line 98 of file QIODeviceAdaptor.C. References _stream. Referenced by close(). |
|
|
reads a single byte from the stream.
Definition at line 135 of file QIODeviceAdaptor.C. References _stream. |
|
|
Open the I/O device using a specified mode. This function is provided for compatibility purpose only. The stream is declared opened at creation time (see QIODeviceAdatptor) and will remain this way until destroyed. Thus this function member returns always true.
Definition at line 82 of file QIODeviceAdaptor.C. |
|
|
Writes a single byte to the stream.
Definition at line 143 of file QIODeviceAdaptor.C. |
|
||||||||||||
|
Reads a block of data from the stream. Reads at most maxlen bytes from the I/O device into data and returns the number of bytes actually read.
Definition at line 117 of file QIODeviceAdaptor.C. References _stream. |
|
|
Returns the size of the IODevice.
Definition at line 106 of file QIODeviceAdaptor.C. |
|
|
Puts the character ch back into the I/O device and decrements the index position if it is not zero.
Definition at line 153 of file QIODeviceAdaptor.C. References _stream. |
|
||||||||||||
|
Writes a block of data to the stream.
Definition at line 125 of file QIODeviceAdaptor.C. |
|
|
The input stream implementing this IODevice. This data member is the 'real' implementation of the IODevice. Every calls to a function member of this class is translated and redirected to it. Definition at line 247 of file QIODeviceAdaptor.H. Referenced by flush(), getch(), readBlock(), and ungetch(). |