Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::TextStream Class Reference

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>

Collaboration diagram for Qx::TextStream:
[legend]

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)
 
- Public Member Functions inherited from QTextStream
 QTextStream (const QByteArray &array, QIODeviceBase::OpenMode openMode)
 
 QTextStream (FILE *fileHandle, QIODeviceBase::OpenMode openMode)
 
 QTextStream (QByteArray *array, QIODeviceBase::OpenMode openMode)
 
 QTextStream (QIODevice *device)
 
 QTextStream (QString *string, QIODeviceBase::OpenMode openMode)
 
bool atEnd () const const
 
bool autoDetectUnicode () const const
 
QIODevicedevice () const const
 
QStringConverter::Encoding encoding () const const
 
QTextStream::FieldAlignment fieldAlignment () const const
 
int fieldWidth () const const
 
void flush ()
 
bool generateByteOrderMark () const const
 
int integerBase () const const
 
QLocale locale () const const
 
QTextStream::NumberFlags numberFlags () const const
 
QTextStreamoperator<< (char c)
 
QTextStreamoperator<< (char16_t c)
 
QTextStreamoperator<< (const char *string)
 
QTextStreamoperator<< (const QByteArray &array)
 
QTextStreamoperator<< (const QString &string)
 
QTextStreamoperator<< (const void *ptr)
 
QTextStreamoperator<< (double f)
 
QTextStreamoperator<< (float f)
 
QTextStreamoperator<< (int i)
 
QTextStreamoperator<< (long i)
 
QTextStreamoperator<< (QChar c)
 
QTextStreamoperator<< (QLatin1StringView string)
 
QTextStreamoperator<< (qlonglong i)
 
QTextStreamoperator<< (QStringView string)
 
QTextStreamoperator<< (qulonglong i)
 
QTextStreamoperator<< (short i)
 
QTextStreamoperator<< (unsigned int i)
 
QTextStreamoperator<< (unsigned long i)
 
QTextStreamoperator<< (unsigned short i)
 
QTextStreamoperator>> (char &c)
 
QTextStreamoperator>> (char *c)
 
QTextStreamoperator>> (char16_t &c)
 
QTextStreamoperator>> (double &f)
 
QTextStreamoperator>> (float &f)
 
QTextStreamoperator>> (int &i)
 
QTextStreamoperator>> (long &i)
 
QTextStreamoperator>> (QByteArray &array)
 
QTextStreamoperator>> (QChar &c)
 
QTextStreamoperator>> (qlonglong &i)
 
QTextStreamoperator>> (QString &str)
 
QTextStreamoperator>> (qulonglong &i)
 
QTextStreamoperator>> (short &i)
 
QTextStreamoperator>> (unsigned int &i)
 
QTextStreamoperator>> (unsigned long &i)
 
QTextStreamoperator>> (unsigned short &i)
 
QChar padChar () const const
 
qint64 pos () const const
 
QTextStreamManipulator qSetFieldWidth (int width)
 
QTextStreamManipulator qSetPadChar (QChar ch)
 
QTextStreamManipulator qSetRealNumberPrecision (int precision)
 
QString read (qint64 maxlen)
 
QString readAll ()
 
QString readLine (qint64 maxlen)
 
bool readLineInto (QString *line, qint64 maxlen)
 
QTextStream::RealNumberNotation realNumberNotation () const const
 
int realNumberPrecision () const const
 
void reset ()
 
void resetStatus ()
 
bool seek (qint64 pos)
 
void setAutoDetectUnicode (bool enabled)
 
void setDevice (QIODevice *device)
 
void setEncoding (QStringConverter::Encoding encoding)
 
void setFieldAlignment (QTextStream::FieldAlignment mode)
 
void setFieldWidth (int width)
 
void setGenerateByteOrderMark (bool generate)
 
void setIntegerBase (int base)
 
void setLocale (const QLocale &locale)
 
void setNumberFlags (QTextStream::NumberFlags flags)
 
void setPadChar (QChar ch)
 
void setRealNumberNotation (QTextStream::RealNumberNotation notation)
 
void setRealNumberPrecision (int precision)
 
void setStatus (QTextStream::Status status)
 
void setString (QString *string, QIODeviceBase::OpenMode openMode)
 
void skipWhiteSpace ()
 
QTextStream::Status status () const const
 
QStringstring () const const
 

Additional Inherited Members

- Public Types inherited from QTextStream
enum  FieldAlignment
 
enum  NumberFlag
 
enum  RealNumberNotation
 
enum  Status
 
- Public Types inherited from QIODeviceBase
enum  OpenModeFlag
 
- Public Attributes inherited from QTextStream
 AlignAccountingStyle
 
 AlignCenter
 
 AlignLeft
 
 AlignRight
 
 FixedNotation
 
 ForcePoint
 
 ForceSign
 
typedef NumberFlags
 
 Ok
 
 ReadCorruptData
 
 ReadPastEnd
 
 ScientificNotation
 
 ShowBase
 
 SmartNotation
 
 UppercaseBase
 
 UppercaseDigits
 
 WriteFailed
 
- Public Attributes inherited from QIODeviceBase
 Append
 
 ExistingOnly
 
 NewOnly
 
 NotOpen
 
typedef OpenMode
 
 ReadOnly
 
 ReadWrite
 
 Text
 
 Truncate
 
 Unbuffered
 
 WriteOnly
 

Detailed Description

TextStream derives from QTextStream and therefore shares all of its functionality, but this Qx variant provides additional facilities not present in its base class.

Constructor & Destructor Documentation

◆ TextStream() [1/5]

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.

See also
QTextStream::QTextStream(const QByteArray &array, QIODevice::OpenMode openMode).

◆ TextStream() [2/5]

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.

◆ TextStream() [3/5]

Qx::TextStream::TextStream ( QString * string,
QIODevice::OpenMode openMode = QIODevice::ReadWrite )

Constructs a QTextStream that operates on string, using openMode to define the open mode.

◆ TextStream() [4/5]

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.

See also
QTextStream::TextStream(FILE* fileHandle, QIODevice::OpenMode openMode).

◆ TextStream() [5/5]

Qx::TextStream::TextStream ( QIODevice * device)

Constructs a QTextStream that operates on device.

Member Function Documentation

◆ precedingBreak()

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.

Warning
This function should be used conservatively as it temporarily seeks within the stream and may require a rebuild of its internal buffer.

◆ readLineWithBreak()

QString Qx::TextStream::readLineWithBreak ( qint64 maxlen = 0)

Same as readLine() except that trailing new line characters are not discarded.

Warning
If maxlen is > 0, this function temporarily seeks within the stream and may require a rebuild of its internal buffer. This significantly hinders the performance of the stream when used in rapid succession (e.g. in a loop), so great care should be taken to use this function with such an argument sparingly.

The documentation for this class was generated from the following files: