Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTextStreamPrivate Class Reference

#include <qtextstream_p.h>

+ Collaboration diagram for QTextStreamPrivate:

Classes

struct  PaddingResult
 
class  Params
 

Public Types

enum  TokenDelimiter { Space , NotSpace , EndOfLine }
 
enum  NumberParsingStatus { npsOk , npsMissingDigit , npsInvalidPrefix }
 

Public Member Functions

 QTextStreamPrivate (QTextStream *q_ptr)
 
 ~QTextStreamPrivate ()
 
void reset ()
 
QString read (int maxlen)
 
bool scan (const QChar **ptr, int *tokenLength, int maxlen, TokenDelimiter delimiter)
 
const QCharreadPtr () const
 
void consumeLastToken ()
 
void consume (int nchars)
 
void saveConverterState (qint64 newPos)
 
void restoreToSavedConverterState ()
 
bool getChar (QChar *ch)
 
void ungetChar (QChar ch)
 
NumberParsingStatus getNumber (qulonglong *l)
 
bool getReal (double *f)
 
void write (QStringView data)
 
void write (QChar ch)
 
void write (const QChar *data, qsizetype len)
 
void write (QLatin1StringView data)
 
void writePadding (qsizetype len)
 
void putString (QStringView string, bool number=false)
 
void putString (const QChar *data, qsizetype len, bool number=false)
 
void putString (QLatin1StringView data, bool number=false)
 
void putString (QUtf8StringView data, bool number=false)
 
void putChar (QChar ch)
 
void putNumber (qulonglong number, bool negative)
 
PaddingResult padding (qsizetype len) const
 
bool fillReadBuffer (qint64 maxBytes=-1)
 
void resetReadBuffer ()
 
void flushWriteBuffer ()
 

Public Attributes

QIODevicedevice
 
QDeviceClosedNotifier deviceClosedNotifier
 
QStringstring
 
int stringOffset
 
QIODevice::OpenMode stringOpenMode
 
QStringConverter::Encoding encoding = QStringConverter::Utf8
 
QStringEncoder fromUtf16
 
QStringDecoder toUtf16
 
QStringDecoder savedToUtf16
 
QString writeBuffer
 
QString readBuffer
 
int readBufferOffset
 
int readConverterSavedStateOffset
 
qint64 readBufferStartDevicePos
 
Params params
 
QTextStream::Status status
 
QLocale locale
 
QTextStreamq_ptr
 
int lastTokenSize
 
bool deleteDevice
 
bool autoDetectUnicode
 
bool hasWrittenData = false
 
bool generateBOM = false
 

Detailed Description

Definition at line 56 of file qtextstream_p.h.

Member Enumeration Documentation

◆ NumberParsingStatus

Enumerator
npsOk 
npsMissingDigit 
npsInvalidPrefix 

Definition at line 131 of file qtextstream_p.h.

◆ TokenDelimiter

Enumerator
Space 
NotSpace 
EndOfLine 

Definition at line 115 of file qtextstream_p.h.

Constructor & Destructor Documentation

◆ QTextStreamPrivate()

QTextStreamPrivate::QTextStreamPrivate ( QTextStream * q_ptr)

Definition at line 257 of file qtextstream.cpp.

References q_ptr, and reset().

+ Here is the call graph for this function:

◆ ~QTextStreamPrivate()

QTextStreamPrivate::~QTextStreamPrivate ( )

Definition at line 268 of file qtextstream.cpp.

References QObject::blockSignals(), deleteDevice, and device.

+ Here is the call graph for this function:

Member Function Documentation

◆ consume()

void QTextStreamPrivate::consume ( int size)
inline

Definition at line 638 of file qtextstream.cpp.

References device, QIODevice::pos(), qDebug, QTEXTSTREAM_BUFFERSIZE, readBufferOffset, readConverterSavedStateOffset, saveConverterState(), and stringOffset.

Referenced by consumeLastToken(), and getChar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ consumeLastToken()

void QTextStreamPrivate::consumeLastToken ( )
inline

Definition at line 628 of file qtextstream.cpp.

References consume(), and lastTokenSize.

Referenced by getNumber(), getReal(), and read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillReadBuffer()

bool QTextStreamPrivate::fillReadBuffer ( qint64 maxBytes = -1)

Definition at line 317 of file qtextstream.cpp.

References autoDetectUnicode, ch, device, encoding, QStringConverter::encodingForData(), file, fromUtf16, QFileDevice::handle(), QIODevice::isSequential(), QIODevice::isTextModeEnabled(), QStringConverter::nameForEncoding(), Q_ASSERT, Q_UNUSED, qDebug, QTEXTSTREAM_BUFFERSIZE, QIODevice::read(), readBufferOffset, QIODevice::readLine(), readPtr(), QIODevice::setTextModeEnabled(), QtDebugUtils::toPrintable(), and toUtf16.

Referenced by getChar(), read(), and scan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flushWriteBuffer()

void QTextStreamPrivate::flushWriteBuffer ( )

Definition at line 438 of file qtextstream.cpp.

References device, file, QFileDevice::flush(), fromUtf16, hasWrittenData, QIODevice::isTextModeEnabled(), qDebug, QIODevice::setTextModeEnabled(), status, QtDebugUtils::toPrintable(), and QIODevice::write().

Referenced by write(), write(), write(), and writePadding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChar()

bool QTextStreamPrivate::getChar ( QChar * ch)
inline

Definition at line 747 of file qtextstream.cpp.

References ch, consume(), device, fillReadBuffer(), readPtr(), and stringOffset.

Referenced by getNumber(), and getReal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumber()

QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber ( qulonglong * ret)

Definition at line 1616 of file qtextstream.cpp.

References base, QLocale::c(), ch, consumeLastToken(), QtMiscUtils::fromHex(), getChar(), QLocale::groupSeparator(), QtMiscUtils::isOctalDigit(), locale, QLocale::negativeSign(), NotSpace, npsInvalidPrefix, npsMissingDigit, npsOk, QLocale::positiveSign(), ret, scan(), sign(), and ungetChar().

+ Here is the call graph for this function:

◆ getReal()

bool QTextStreamPrivate::getReal ( double * f)

(hihi)

Definition at line 1790 of file qtextstream.cpp.

References BufferSize, QLocale::c(), consumeLastToken(), QLocale::decimalPoint(), Dot, QLocale::exponential(), QString::fromLatin1(), getChar(), QLocale::groupSeparator(), i, locale, QLocale::negativeSign(), None, NotSpace, ok, QLocale::positiveSign(), qstricmp(), qt_inf(), qt_qnan(), scan(), state, QLocale::toDouble(), QString::toLower(), and ungetChar().

+ Here is the call graph for this function:

◆ padding()

QTextStreamPrivate::PaddingResult QTextStreamPrivate::padding ( qsizetype len) const

Definition at line 797 of file qtextstream.cpp.

References Q_ASSERT.

Referenced by putString(), and putString().

+ Here is the caller graph for this function:

◆ putChar()

void QTextStreamPrivate::putChar ( QChar ch)
inline

Definition at line 785 of file qtextstream.cpp.

References ch, putString(), and write().

+ Here is the call graph for this function:

◆ putNumber()

void QTextStreamPrivate::putNumber ( qulonglong number,
bool negative )

◆ putString() [1/4]

void QTextStreamPrivate::putString ( const QChar * data,
qsizetype len,
bool number = false )

Definition at line 824 of file qtextstream.cpp.

References QTextStreamPrivate::PaddingResult::left, locale, QLocale::negativeSign(), number, padding(), QLocale::positiveSign(), Q_UNLIKELY, QTextStreamPrivate::PaddingResult::right, sign(), write(), and writePadding().

+ Here is the call graph for this function:

◆ putString() [2/4]

void QTextStreamPrivate::putString ( QLatin1StringView data,
bool number = false )

Definition at line 853 of file qtextstream.cpp.

References QTextStreamPrivate::PaddingResult::left, locale, QLocale::negativeSign(), number, padding(), QLocale::positiveSign(), Q_UNLIKELY, QTextStreamPrivate::PaddingResult::right, sign(), write(), and writePadding().

+ Here is the call graph for this function:

◆ putString() [3/4]

void QTextStreamPrivate::putString ( QStringView string,
bool number = false )
inline

Definition at line 147 of file qtextstream_p.h.

References number, and putString().

Referenced by putChar(), putNumber(), putString(), and putString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ putString() [4/4]

void QTextStreamPrivate::putString ( QUtf8StringView data,
bool number = false )

Definition at line 878 of file qtextstream.cpp.

References number, and putString().

+ Here is the call graph for this function:

◆ read()

QString QTextStreamPrivate::read ( int maxlen)

Definition at line 500 of file qtextstream.cpp.

References consumeLastToken(), fillReadBuffer(), lastTokenSize, qDebug, qMin(), readBufferOffset, ret, and stringOffset.

+ Here is the call graph for this function:

◆ readPtr()

const QChar * QTextStreamPrivate::readPtr ( ) const
inline

Definition at line 617 of file qtextstream.cpp.

References Q_ASSERT, readBufferOffset, and stringOffset.

Referenced by fillReadBuffer(), getChar(), and scan().

+ Here is the caller graph for this function:

◆ reset()

void QTextStreamPrivate::reset ( )

Definition at line 292 of file qtextstream.cpp.

References autoDetectUnicode, deleteDevice, device, encoding, fromUtf16, generateBOM, hasWrittenData, lastTokenSize, readBufferOffset, readBufferStartDevicePos, stringOffset, stringOpenMode, toUtf16, and QStringConverter::Utf8.

Referenced by QTextStreamPrivate().

+ Here is the caller graph for this function:

◆ resetReadBuffer()

void QTextStreamPrivate::resetReadBuffer ( )

Definition at line 428 of file qtextstream.cpp.

References device, QIODevice::pos(), readBufferOffset, and readBufferStartDevicePos.

+ Here is the call graph for this function:

◆ restoreToSavedConverterState()

void QTextStreamPrivate::restoreToSavedConverterState ( )
inline

Definition at line 675 of file qtextstream.cpp.

References QStringConverter::isValid(), QStringConverter::resetState(), savedToUtf16, and toUtf16.

+ Here is the call graph for this function:

◆ saveConverterState()

void QTextStreamPrivate::saveConverterState ( qint64 newPos)
inline

Definition at line 664 of file qtextstream.cpp.

References readBufferStartDevicePos, readConverterSavedStateOffset, savedToUtf16, and toUtf16.

Referenced by consume().

+ Here is the caller graph for this function:

◆ scan()

bool QTextStreamPrivate::scan ( const QChar ** ptr,
int * length,
int maxlen,
TokenDelimiter delimiter )

Scans no more than maxlen QChars in the current buffer for the first delimiter. Stores a pointer to the start offset of the token in ptr, and the length in QChars in length.

Definition at line 526 of file qtextstream.cpp.

References QIODevice::atEnd(), ch, device, EndOfLine, fillReadBuffer(), lastTokenSize, NotSpace, ptr(), qDebug, readBufferOffset, readPtr(), Space, and stringOffset.

Referenced by getNumber(), and getReal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ungetChar()

void QTextStreamPrivate::ungetChar ( QChar ch)
inline

Definition at line 764 of file qtextstream.cpp.

References ch, readBufferOffset, and stringOffset.

Referenced by getNumber(), and getReal().

+ Here is the caller graph for this function:

◆ write() [1/4]

void QTextStreamPrivate::write ( const QChar * data,
qsizetype len )

Definition at line 687 of file qtextstream.cpp.

References flushWriteBuffer(), and QTEXTSTREAM_BUFFERSIZE.

+ Here is the call graph for this function:

◆ write() [2/4]

void QTextStreamPrivate::write ( QChar ch)
inline

Definition at line 702 of file qtextstream.cpp.

References ch, flushWriteBuffer(), and QTEXTSTREAM_BUFFERSIZE.

+ Here is the call graph for this function:

◆ write() [3/4]

void QTextStreamPrivate::write ( QLatin1StringView data)

Definition at line 717 of file qtextstream.cpp.

References flushWriteBuffer(), and QTEXTSTREAM_BUFFERSIZE.

+ Here is the call graph for this function:

◆ write() [4/4]

void QTextStreamPrivate::write ( QStringView data)
inline

Definition at line 142 of file qtextstream_p.h.

References write().

Referenced by putChar(), putString(), putString(), and write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePadding()

void QTextStreamPrivate::writePadding ( qsizetype len)

Definition at line 732 of file qtextstream.cpp.

References flushWriteBuffer(), and QTEXTSTREAM_BUFFERSIZE.

Referenced by putString(), and putString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ autoDetectUnicode

bool QTextStreamPrivate::autoDetectUnicode

Definition at line 110 of file qtextstream_p.h.

Referenced by fillReadBuffer(), and reset().

◆ deleteDevice

bool QTextStreamPrivate::deleteDevice

Definition at line 109 of file qtextstream_p.h.

Referenced by ~QTextStreamPrivate(), and reset().

◆ device

QIODevice* QTextStreamPrivate::device

◆ deviceClosedNotifier

QDeviceClosedNotifier QTextStreamPrivate::deviceClosedNotifier

Definition at line 82 of file qtextstream_p.h.

◆ encoding

QStringConverter::Encoding QTextStreamPrivate::encoding = QStringConverter::Utf8

Definition at line 90 of file qtextstream_p.h.

Referenced by fillReadBuffer(), and reset().

◆ fromUtf16

QStringEncoder QTextStreamPrivate::fromUtf16

Definition at line 91 of file qtextstream_p.h.

Referenced by fillReadBuffer(), flushWriteBuffer(), and reset().

◆ generateBOM

bool QTextStreamPrivate::generateBOM = false

Definition at line 112 of file qtextstream_p.h.

Referenced by reset().

◆ hasWrittenData

bool QTextStreamPrivate::hasWrittenData = false

Definition at line 111 of file qtextstream_p.h.

Referenced by flushWriteBuffer(), and reset().

◆ lastTokenSize

int QTextStreamPrivate::lastTokenSize

Definition at line 108 of file qtextstream_p.h.

Referenced by consumeLastToken(), read(), reset(), and scan().

◆ locale

QLocale QTextStreamPrivate::locale

Definition at line 105 of file qtextstream_p.h.

Referenced by getNumber(), getReal(), putNumber(), putString(), and putString().

◆ params

Params QTextStreamPrivate::params

Definition at line 101 of file qtextstream_p.h.

◆ q_ptr

QTextStream* QTextStreamPrivate::q_ptr

Definition at line 106 of file qtextstream_p.h.

Referenced by QTextStreamPrivate().

◆ readBuffer

QString QTextStreamPrivate::readBuffer

Definition at line 96 of file qtextstream_p.h.

◆ readBufferOffset

int QTextStreamPrivate::readBufferOffset

◆ readBufferStartDevicePos

qint64 QTextStreamPrivate::readBufferStartDevicePos

Definition at line 99 of file qtextstream_p.h.

Referenced by reset(), resetReadBuffer(), and saveConverterState().

◆ readConverterSavedStateOffset

int QTextStreamPrivate::readConverterSavedStateOffset

Definition at line 98 of file qtextstream_p.h.

Referenced by consume(), and saveConverterState().

◆ savedToUtf16

QStringDecoder QTextStreamPrivate::savedToUtf16

Definition at line 93 of file qtextstream_p.h.

Referenced by restoreToSavedConverterState(), and saveConverterState().

◆ status

QTextStream::Status QTextStreamPrivate::status

Definition at line 104 of file qtextstream_p.h.

Referenced by flushWriteBuffer().

◆ string

QString* QTextStreamPrivate::string

Definition at line 86 of file qtextstream_p.h.

◆ stringOffset

int QTextStreamPrivate::stringOffset

Definition at line 87 of file qtextstream_p.h.

Referenced by consume(), getChar(), read(), readPtr(), reset(), scan(), and ungetChar().

◆ stringOpenMode

QIODevice::OpenMode QTextStreamPrivate::stringOpenMode

Definition at line 88 of file qtextstream_p.h.

Referenced by reset().

◆ toUtf16

QStringDecoder QTextStreamPrivate::toUtf16

◆ writeBuffer

QString QTextStreamPrivate::writeBuffer

Definition at line 95 of file qtextstream_p.h.


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