QHttpEngine 0.1.0
Simple and secure HTTP server for Qt applications
|
Data copier for classes deriving from QIODevice. More...
#include <QHttpEngine/QIODeviceCopier>
Public Slots | |
void | start () |
Start the copy operation. | |
void | stop () |
Stop the copy operation. | |
Signals | |
void | error (const QString &message) |
Indicate that an error occurred. | |
void | finished () |
Indicate that the copy operation finished. | |
QIODeviceCopier provides a set of methods for reading data from a QIODevice and writing it to another. The class operates asynchronously and therefore can be used from the main thread. The copier is initialized with pointers to two QIODevices:
Notice in the example above that it is not necessary to open the devices prior to starting the copy operation. The copier will attempt to open both devices with the appropriate mode if they are not already open.
If the source device is sequential, data will be read as it becomes available and immediately written to the destination device. If the source device is not sequential, data will be read and written in blocks. The size of the blocks can be modified with the setBufferSize() method.
If an error occurs, the error() signal will be emitted. When the copy completes, either by reading all of the data from the source device or encountering an error, the finished() signal is emitted.
|
signal |
|
slot |
The source device will be opened for reading and the destination device opened for writing if applicable. If opening either file fails for some reason, the error() signal will be emitted.
This method should never be invoked more than once.
|
slot |
The start() method should not be invoked after stopping the operation. Instead, a new QIODeviceCopier instance should be created.