Qx v0.7
Qt Extensions Library
|
The TextStream class is a more robust variant of QTextStream, which provides a convenient interface for reading and writing text. More...
#include <qx/io/qx-textstream.h>
Public Member Functions | |
TextStream (const QByteArray &array, QIODevice::OpenMode openMode=QIODevice::ReadOnly) | |
TextStream (FILE *fileHandle, QIODevice::OpenMode openMode=QIODevice::ReadWrite) | |
TextStream (QByteArray *array, QIODevice::OpenMode openMode=QIODevice::ReadWrite) | |
TextStream (QIODevice *device) | |
TextStream (QString *string, QIODevice::OpenMode openMode=QIODevice::ReadWrite) | |
bool | precedingBreak () |
QString | readLineWithBreak (qint64 maxlen=0) |
TextStream derives from QTextStream and therefore shares all of its functionality, but this Qx variant provides additional facilities not present in its base class.
Qx::TextStream::TextStream | ( | const QByteArray & | array, |
QIODevice::OpenMode | openMode = QIODevice::ReadOnly ) |
Constructs a QTextStream that operates on array, using openMode to define the open mode. The array is accessed as read-only, regardless of the values in openMode.
Qx::TextStream::TextStream | ( | QByteArray * | array, |
QIODevice::OpenMode | openMode = QIODevice::ReadWrite ) |
Constructs a QTextStream that operates on array, using openMode to define the open mode. Internally, the array is wrapped by a QBuffer.
Qx::TextStream::TextStream | ( | QString * | string, |
QIODevice::OpenMode | openMode = QIODevice::ReadWrite ) |
Constructs a QTextStream that operates on string, using openMode to define the open mode.
Qx::TextStream::TextStream | ( | FILE * | fileHandle, |
QIODevice::OpenMode | openMode = QIODevice::ReadWrite ) |
Constructs a QTextStream that operates on fileHandle, using openMode to define the open mode. Internally, a QFile is created to handle the FILE pointer.
Qx::TextStream::TextStream | ( | QIODevice * | device | ) |
Constructs a QTextStream that operates on device.
bool Qx::TextStream::precedingBreak | ( | ) |
Returns true
if the character at the stream's current position - 1 is the line feed character ('\n'
), or rather, that the stream is currently positioned immediately after a line break; otherwise returns false
.
QString Qx::TextStream::readLineWithBreak | ( | qint64 | maxlen = 0 | ) |
Same as readLine() except that trailing new line characters are not discarded.