Qt 4.8
Public Types | Public Functions | Public Variables | List of all members
QTextStreamPrivate Class Reference

Public Types

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

Public Functions

void consume (int nchars)
 
void consumeLastToken ()
 
bool fillReadBuffer (qint64 maxBytes=-1)
 
void flushWriteBuffer ()
 
bool getChar (QChar *ch)
 
NumberParsingStatus getNumber (qulonglong *l)
 
bool getReal (double *f)
 
void putNumber (qulonglong number, bool negative)
 
void putString (const QString &ch, bool number=false)
 
 QTextStreamPrivate (QTextStream *q_ptr)
 
QString read (int maxlen)
 
const QCharreadPtr () const
 
void reset ()
 
void resetReadBuffer ()
 
void restoreToSavedConverterState ()
 
void saveConverterState (qint64 newPos)
 
bool scan (const QChar **ptr, int *tokenLength, int maxlen, TokenDelimiter delimiter)
 Scans no more than maxlen QChars in the current buffer for the first delimiter. More...
 
void ungetChar (const QChar &ch)
 
void write (const QString &data)
 
 ~QTextStreamPrivate ()
 

Public Variables

bool autoDetectUnicode
 
QTextCodeccodec
 
bool deleteDevice
 
QIODevicedevice
 
QDeviceClosedNotifier deviceClosedNotifier
 
QTextStream::FieldAlignment fieldAlignment
 
int fieldWidth
 
int integerBase
 
int lastTokenSize
 
QLocale locale
 
QTextStream::NumberFlags numberFlags
 
QChar padChar
 
QTextStreamq_ptr
 
QString readBuffer
 
int readBufferOffset
 
qint64 readBufferStartDevicePos
 
QTextCodec::ConverterStatereadConverterSavedState
 
int readConverterSavedStateOffset
 
QTextCodec::ConverterState readConverterState
 
QTextStream::RealNumberNotation realNumberNotation
 
int realNumberPrecision
 
QTextStream::Status status
 
QStringstring
 
int stringOffset
 
QIODevice::OpenMode stringOpenMode
 
QString writeBuffer
 
QTextCodec::ConverterState writeConverterState
 

Detailed Description

Definition at line 357 of file qtextstream.cpp.

Enumerations

◆ NumberParsingStatus

Enumerator
npsOk 
npsMissingDigit 
npsInvalidPrefix 

Definition at line 404 of file qtextstream.cpp.

◆ TokenDelimiter

Enumerator
Space 
NotSpace 
EndOfLine 

Definition at line 387 of file qtextstream.cpp.

Constructors and Destructors

◆ QTextStreamPrivate()

QTextStreamPrivate::QTextStreamPrivate ( QTextStream q_ptr)
Warning
This function is not part of the public interface.

Definition at line 448 of file qtextstream.cpp.

449  :
450 #ifndef QT_NO_TEXTCODEC
452 #endif
454  locale(QLocale::c())
455 {
456  this->q_ptr = q_ptr;
457  reset();
458 }
QTextCodec::ConverterState * readConverterSavedState
QTextStream * q_ptr
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
Definition: qlocale.h:773

◆ ~QTextStreamPrivate()

QTextStreamPrivate::~QTextStreamPrivate ( )
Warning
This function is not part of the public interface.

Definition at line 462 of file qtextstream.cpp.

463 {
464  if (deleteDevice) {
465 #ifndef QT_NO_QOBJECT
466  device->blockSignals(true);
467 #endif
468  delete device;
469  }
470 #ifndef QT_NO_TEXTCODEC
472 #endif
473 }
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
Definition: qobject.cpp:1406
QTextCodec::ConverterState * readConverterSavedState
QIODevice * device

Functions

◆ consume()

void QTextStreamPrivate::consume ( int  size)
inline
Warning
This function is not part of the public interface.

Definition at line 872 of file qtextstream.cpp.

Referenced by consumeLastToken(), and getChar().

873 {
874 #if defined (QTEXTSTREAM_DEBUG)
875  qDebug("QTextStreamPrivate::consume(%d)", size);
876 #endif
877  if (string) {
878  stringOffset += size;
879  if (stringOffset > string->size())
880  stringOffset = string->size();
881  } else {
882  readBufferOffset += size;
883  if (readBufferOffset >= readBuffer.size()) {
884  readBufferOffset = 0;
885  readBuffer.clear();
890  readBufferOffset = 0;
891  }
892  }
893 }
static const int QTEXTSTREAM_BUFFERSIZE
Definition: qtextstream.cpp:43
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
Definition: qiodevice.cpp:624
void saveConverterState(qint64 newPos)
Q_CORE_EXPORT void qDebug(const char *,...)
QIODevice * device
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867

◆ consumeLastToken()

void QTextStreamPrivate::consumeLastToken ( )
inline
Warning
This function is not part of the public interface.

Definition at line 863 of file qtextstream.cpp.

Referenced by read().

864 {
865  if (lastTokenSize)
867  lastTokenSize = 0;
868 }
void consume(int nchars)

◆ fillReadBuffer()

bool QTextStreamPrivate::fillReadBuffer ( qint64  maxBytes = -1)
Warning
This function is not part of the public interface.

Definition at line 531 of file qtextstream.cpp.

Referenced by getChar(), QTextStream::pos(), read(), and scan().

532 {
533  // no buffer next to the QString itself; this function should only
534  // be called internally, for devices.
535  Q_ASSERT(!string);
536  Q_ASSERT(device);
537 
538  // handle text translation and bypass the Text flag in the device.
539  bool textModeEnabled = device->isTextModeEnabled();
540  if (textModeEnabled)
541  device->setTextModeEnabled(false);
542 
543  // read raw data into a temporary buffer
544  char buf[QTEXTSTREAM_BUFFERSIZE];
545  qint64 bytesRead = 0;
546 #if defined(Q_OS_WIN)
547  // On Windows, there is no non-blocking stdin - so we fall back to reading
548  // lines instead. If there is no QOBJECT, we read lines for all sequential
549  // devices; otherwise, we read lines only for stdin.
550  QFile *file = 0;
551  Q_UNUSED(file);
552  if (device->isSequential()
553 #if !defined(QT_NO_QOBJECT)
554  && (file = qobject_cast<QFile *>(device)) && file->handle() == 0
555 #endif
556  ) {
557  if (maxBytes != -1)
558  bytesRead = device->readLine(buf, qMin<qint64>(sizeof(buf), maxBytes));
559  else
560  bytesRead = device->readLine(buf, sizeof(buf));
561  } else
562 #endif
563  {
564  if (maxBytes != -1)
565  bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes));
566  else
567  bytesRead = device->read(buf, sizeof(buf));
568  }
569 
570 #ifndef QT_NO_TEXTCODEC
571  // codec auto detection, explicitly defaults to locale encoding if the
572  // codec has been set to 0.
573  if (!codec || autoDetectUnicode) {
574  autoDetectUnicode = false;
575 
577  if (!codec) {
580  }
581  }
582 #if defined (QTEXTSTREAM_DEBUG)
583  qDebug("QTextStreamPrivate::fillReadBuffer(), using %s codec",
584  codec->name().constData());
585 #endif
586 #endif
587 
588 #if defined (QTEXTSTREAM_DEBUG)
589  qDebug("QTextStreamPrivate::fillReadBuffer(), device->read(\"%s\", %d) == %d",
590  qt_prettyDebug(buf, qMin(32,int(bytesRead)) , int(bytesRead)).constData(), sizeof(buf), int(bytesRead));
591 #endif
592 
593  if (bytesRead <= 0)
594  return false;
595 
596  int oldReadBufferSize = readBuffer.size();
597 #ifndef QT_NO_TEXTCODEC
598  // convert to unicode
599  readBuffer += codec->toUnicode(buf, bytesRead, &readConverterState);
600 #else
601  readBuffer += QString::fromLatin1(QByteArray(buf, bytesRead).constData());
602 #endif
603 
604  // reset the Text flag.
605  if (textModeEnabled)
606  device->setTextModeEnabled(true);
607 
608  // remove all '\r\n' in the string.
609  if (readBuffer.size() > oldReadBufferSize && textModeEnabled) {
610  QChar CR = QLatin1Char('\r');
611  QChar *writePtr = readBuffer.data() + oldReadBufferSize;
612  QChar *readPtr = readBuffer.data() + oldReadBufferSize;
613  QChar *endPtr = readBuffer.data() + readBuffer.size();
614 
615  int n = oldReadBufferSize;
616  if (readPtr < endPtr) {
617  // Cut-off to avoid unnecessary self-copying.
618  while (*readPtr++ != CR) {
619  ++n;
620  if (++writePtr == endPtr)
621  break;
622  }
623  }
624  while (readPtr < endPtr) {
625  QChar ch = *readPtr++;
626  if (ch != CR) {
627  *writePtr++ = ch;
628  } else {
629  if (n < readBufferOffset)
631  --bytesRead;
632  }
633  ++n;
634  }
635  readBuffer.resize(writePtr - readBuffer.data());
636  }
637 
638 #if defined (QTEXTSTREAM_DEBUG)
639  qDebug("QTextStreamPrivate::fillReadBuffer() read %d bytes from device. readBuffer = [%s]", int(bytesRead),
640  qt_prettyDebug(readBuffer.toLatin1(), readBuffer.size(), readBuffer.size()).data());
641 #endif
642  return true;
643 }
static QTextCodec * codecForLocale()
Returns a pointer to the codec most suitable for this locale.
T qobject_cast(QObject *object)
Definition: qobject.h:375
const QChar * readPtr() const
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
static const int QTEXTSTREAM_BUFFERSIZE
Definition: qtextstream.cpp:43
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QTextCodec::ConverterState writeConverterState
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
void setTextModeEnabled(bool enabled)
If enabled is true, this function sets the Text flag on the device; otherwise the Text flag is remove...
Definition: qiodevice.cpp:499
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
Definition: qiodevice.cpp:791
Q_CORE_EXPORT void qDebug(const char *,...)
QIODevice * device
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static QByteArray fromRawData(const char *, int size)
Constructs a QByteArray that uses the first size bytes of the data array.
static const char * data(const QByteArray &arr)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
__int64 qint64
Definition: qglobal.h:942
int handle() const
Returns the file handle of the file.
Definition: qfile.cpp:1419
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
Definition: qiodevice.cpp:454
ConversionFlags flags
Definition: qtextcodec.h:106
void resize(int size)
Sets the size of the string to size characters.
Definition: qstring.cpp:1353
virtual QByteArray name() const =0
QTextCodec subclasses must reimplement this function.
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QString toUnicode(const QByteArray &) const
Converts a from the encoding of this codec to Unicode, and returns the result in a QString...
QTextCodec * codec
QTextCodec::ConverterState readConverterState
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
qint64 readLine(char *data, qint64 maxlen)
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes...
Definition: qiodevice.cpp:1110
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
bool isTextModeEnabled() const
Returns true if the Text flag is enabled; otherwise returns false.
Definition: qiodevice.cpp:517
static QTextCodec * codecForUtfText(const QByteArray &ba)
Tries to detect the encoding of the provided snippet ba by using the BOM (Byte Order Mark) and return...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ flushWriteBuffer()

void QTextStreamPrivate::flushWriteBuffer ( )
Warning
This function is not part of the public interface.

Definition at line 656 of file qtextstream.cpp.

Referenced by write().

657 {
658  // no buffer next to the QString itself; this function should only
659  // be called internally, for devices.
660  if (string || !device)
661  return;
662 
663  // Stream went bye-bye already. Appending further data may succeed again,
664  // but would create a corrupted stream anyway.
665  if (status != QTextStream::Ok)
666  return;
667 
668  if (writeBuffer.isEmpty())
669  return;
670 
671 #if defined (Q_OS_WIN)
672  // handle text translation and bypass the Text flag in the device.
673  bool textModeEnabled = device->isTextModeEnabled();
674  if (textModeEnabled) {
675  device->setTextModeEnabled(false);
677  }
678 #endif
679 
680 #ifndef QT_NO_TEXTCODEC
681  if (!codec)
683 #if defined (QTEXTSTREAM_DEBUG)
684  qDebug("QTextStreamPrivate::flushWriteBuffer(), using %s codec (%s generating BOM)",
686 #endif
687 
688  // convert from unicode to raw data
690 #else
692 #endif
693  writeBuffer.clear();
694 
695  // write raw data to the device
696  qint64 bytesWritten = device->write(data);
697 #if defined (QTEXTSTREAM_DEBUG)
698  qDebug("QTextStreamPrivate::flushWriteBuffer(), device->write(\"%s\") == %d",
699  qt_prettyDebug(data.constData(), qMin(data.size(),32), data.size()).constData(), int(bytesWritten));
700 #endif
701  if (bytesWritten <= 0) {
703  return;
704  }
705 
706 #if defined (Q_OS_WIN)
707  // replace the text flag
708  if (textModeEnabled)
709  device->setTextModeEnabled(true);
710 #endif
711 
712  // flush the file
713 #ifndef QT_NO_QOBJECT
714  QFile *file = qobject_cast<QFile *>(device);
715  bool flushed = !file || file->flush();
716 #else
717  bool flushed = true;
718 #endif
719 
720 #if defined (QTEXTSTREAM_DEBUG)
721  qDebug("QTextStreamPrivate::flushWriteBuffer() wrote %d bytes",
722  int(bytesWritten));
723 #endif
724  if (!flushed || bytesWritten != qint64(data.size()))
726 }
static QTextCodec * codecForLocale()
Returns a pointer to the codec most suitable for this locale.
T qobject_cast(QObject *object)
Definition: qobject.h:375
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QTextCodec::ConverterState writeConverterState
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
void setTextModeEnabled(bool enabled)
If enabled is true, this function sets the Text flag on the device; otherwise the Text flag is remove...
Definition: qiodevice.cpp:499
Q_CORE_EXPORT void qDebug(const char *,...)
QIODevice * device
QByteArray fromUnicode(const QString &uc) const
Converts str from Unicode to the encoding of this codec, and returns the result in a QByteArray...
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
bool flush()
Flushes any buffered data to the file.
Definition: qfile.cpp:1645
static const char * data(const QByteArray &arr)
QTextStream::Status status
__int64 qint64
Definition: qglobal.h:942
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049
ConversionFlags flags
Definition: qtextcodec.h:106
virtual QByteArray name() const =0
QTextCodec subclasses must reimplement this function.
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QTextCodec * codec
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
bool isTextModeEnabled() const
Returns true if the Text flag is enabled; otherwise returns false.
Definition: qiodevice.cpp:517
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
Definition: qiodevice.cpp:1342
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ getChar()

bool QTextStreamPrivate::getChar ( QChar ch)
inline
Warning
This function is not part of the public interface.

Definition at line 948 of file qtextstream.cpp.

949 {
950  if ((string && stringOffset == string->size())
951  || (device && readBuffer.isEmpty() && !fillReadBuffer())) {
952  if (ch)
953  *ch = 0;
954  return false;
955  }
956  if (ch)
957  *ch = *readPtr();
958  consume(1);
959  return true;
960 }
const QChar * readPtr() const
bool fillReadBuffer(qint64 maxBytes=-1)
QIODevice * device
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void consume(int nchars)

◆ getNumber()

QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber ( qulonglong ret)
Warning
This function is not part of the public interface.

Definition at line 1731 of file qtextstream.cpp.

1732 {
1733  scan(0, 0, 0, NotSpace);
1734  consumeLastToken();
1735 
1736  // detect int encoding
1737  int base = integerBase;
1738  if (base == 0) {
1739  QChar ch;
1740  if (!getChar(&ch))
1741  return npsInvalidPrefix;
1742  if (ch == QLatin1Char('0')) {
1743  QChar ch2;
1744  if (!getChar(&ch2)) {
1745  // Result is the number 0
1746  *ret = 0;
1747  return npsOk;
1748  }
1749  ch2 = ch2.toLower();
1750 
1751  if (ch2 == QLatin1Char('x')) {
1752  base = 16;
1753  } else if (ch2 == QLatin1Char('b')) {
1754  base = 2;
1755  } else if (ch2.isDigit() && ch2.digitValue() >= 0 && ch2.digitValue() <= 7) {
1756  base = 8;
1757  } else {
1758  base = 10;
1759  }
1760  ungetChar(ch2);
1761  } else if (ch == locale.negativeSign() || ch == locale.positiveSign() || ch.isDigit()) {
1762  base = 10;
1763  } else {
1764  ungetChar(ch);
1765  return npsInvalidPrefix;
1766  }
1767  ungetChar(ch);
1768  // State of the stream is now the same as on entry
1769  // (cursor is at prefix),
1770  // and local variable 'base' has been set appropriately.
1771  }
1772 
1773  qulonglong val=0;
1774  switch (base) {
1775  case 2: {
1776  QChar pf1, pf2, dig;
1777  // Parse prefix '0b'
1778  if (!getChar(&pf1) || pf1 != QLatin1Char('0'))
1779  return npsInvalidPrefix;
1780  if (!getChar(&pf2) || pf2.toLower() != QLatin1Char('b'))
1781  return npsInvalidPrefix;
1782  // Parse digits
1783  int ndigits = 0;
1784  while (getChar(&dig)) {
1785  int n = dig.toLower().unicode();
1786  if (n == '0' || n == '1') {
1787  val <<= 1;
1788  val += n - '0';
1789  } else {
1790  ungetChar(dig);
1791  break;
1792  }
1793  ndigits++;
1794  }
1795  if (ndigits == 0) {
1796  // Unwind the prefix and abort
1797  ungetChar(pf2);
1798  ungetChar(pf1);
1799  return npsMissingDigit;
1800  }
1801  break;
1802  }
1803  case 8: {
1804  QChar pf, dig;
1805  // Parse prefix '0'
1806  if (!getChar(&pf) || pf != QLatin1Char('0'))
1807  return npsInvalidPrefix;
1808  // Parse digits
1809  int ndigits = 0;
1810  while (getChar(&dig)) {
1811  int n = dig.toLower().unicode();
1812  if (n >= '0' && n <= '7') {
1813  val *= 8;
1814  val += n - '0';
1815  } else {
1816  ungetChar(dig);
1817  break;
1818  }
1819  ndigits++;
1820  }
1821  if (ndigits == 0) {
1822  // Unwind the prefix and abort
1823  ungetChar(pf);
1824  return npsMissingDigit;
1825  }
1826  break;
1827  }
1828  case 10: {
1829  // Parse sign (or first digit)
1830  QChar sign;
1831  int ndigits = 0;
1832  if (!getChar(&sign))
1833  return npsMissingDigit;
1834  if (sign != locale.negativeSign() && sign != locale.positiveSign()) {
1835  if (!sign.isDigit()) {
1836  ungetChar(sign);
1837  return npsMissingDigit;
1838  }
1839  val += sign.digitValue();
1840  ndigits++;
1841  }
1842  // Parse digits
1843  QChar ch;
1844  while (getChar(&ch)) {
1845  if (ch.isDigit()) {
1846  val *= 10;
1847  val += ch.digitValue();
1848  } else if (locale != QLocale::c() && ch == locale.groupSeparator()) {
1849  continue;
1850  } else {
1851  ungetChar(ch);
1852  break;
1853  }
1854  ndigits++;
1855  }
1856  if (ndigits == 0)
1857  return npsMissingDigit;
1858  if (sign == locale.negativeSign()) {
1859  qlonglong ival = qlonglong(val);
1860  if (ival > 0)
1861  ival = -ival;
1862  val = qulonglong(ival);
1863  }
1864  break;
1865  }
1866  case 16: {
1867  QChar pf1, pf2, dig;
1868  // Parse prefix ' 0x'
1869  if (!getChar(&pf1) || pf1 != QLatin1Char('0'))
1870  return npsInvalidPrefix;
1871  if (!getChar(&pf2) || pf2.toLower() != QLatin1Char('x'))
1872  return npsInvalidPrefix;
1873  // Parse digits
1874  int ndigits = 0;
1875  while (getChar(&dig)) {
1876  int n = dig.toLower().unicode();
1877  if (n >= '0' && n <= '9') {
1878  val <<= 4;
1879  val += n - '0';
1880  } else if (n >= 'a' && n <= 'f') {
1881  val <<= 4;
1882  val += 10 + (n - 'a');
1883  } else {
1884  ungetChar(dig);
1885  break;
1886  }
1887  ndigits++;
1888  }
1889  if (ndigits == 0) {
1890  return npsMissingDigit;
1891  }
1892  break;
1893  }
1894  default:
1895  // Unsupported integerBase
1896  return npsInvalidPrefix;
1897  }
1898 
1899  if (ret)
1900  *ret = val;
1901  return npsOk;
1902 }
void ungetChar(const QChar &ch)
QChar positiveSign() const
Returns the positive sign character of this locale.
Definition: qlocale.cpp:1830
int digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
Definition: qchar.cpp:817
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
bool scan(const QChar **ptr, int *tokenLength, int maxlen, TokenDelimiter delimiter)
Scans no more than maxlen QChars in the current buffer for the first delimiter.
static const uint base
Definition: qurl.cpp:268
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static int sign(int x)
QChar groupSeparator() const
Returns the group separator character of this locale.
Definition: qlocale.cpp:1778
QChar negativeSign() const
Returns the negative sign character of this locale.
Definition: qlocale.cpp:1817
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
Definition: qlocale.h:773
quint64 qulonglong
Definition: qglobal.h:952
bool getChar(QChar *ch)
qint64 qlonglong
Definition: qglobal.h:951
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
bool isDigit() const
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false...
Definition: qchar.cpp:699

◆ getReal()

bool QTextStreamPrivate::getReal ( double *  f)
Warning
This function is not part of the public interface. (hihi)

Definition at line 1907 of file qtextstream.cpp.

1908 {
1909  // We use a table-driven FSM to parse floating point numbers
1910  // strtod() cannot be used directly since we may be reading from a
1911  // QIODevice.
1912  enum ParserState {
1913  Init = 0,
1914  Sign = 1,
1915  Mantissa = 2,
1916  Dot = 3,
1917  Abscissa = 4,
1918  ExpMark = 5,
1919  ExpSign = 6,
1920  Exponent = 7,
1921  Nan1 = 8,
1922  Nan2 = 9,
1923  Inf1 = 10,
1924  Inf2 = 11,
1925  NanInf = 12,
1926  Done = 13
1927  };
1928  enum InputToken {
1929  None = 0,
1930  InputSign = 1,
1931  InputDigit = 2,
1932  InputDot = 3,
1933  InputExp = 4,
1934  InputI = 5,
1935  InputN = 6,
1936  InputF = 7,
1937  InputA = 8,
1938  InputT = 9
1939  };
1940 
1941  static const uchar table[13][10] = {
1942  // None InputSign InputDigit InputDot InputExp InputI InputN InputF InputA InputT
1943  { 0, Sign, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, // 0 Init
1944  { 0, 0, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, // 1 Sign
1945  { Done, Done, Mantissa, Dot, ExpMark, 0, 0, 0, 0, 0 }, // 2 Mantissa
1946  { 0, 0, Abscissa, 0, 0, 0, 0, 0, 0, 0 }, // 3 Dot
1947  { Done, Done, Abscissa, Done, ExpMark, 0, 0, 0, 0, 0 }, // 4 Abscissa
1948  { 0, ExpSign, Exponent, 0, 0, 0, 0, 0, 0, 0 }, // 5 ExpMark
1949  { 0, 0, Exponent, 0, 0, 0, 0, 0, 0, 0 }, // 6 ExpSign
1950  { Done, Done, Exponent, Done, Done, 0, 0, 0, 0, 0 }, // 7 Exponent
1951  { 0, 0, 0, 0, 0, 0, 0, 0, Nan2, 0 }, // 8 Nan1
1952  { 0, 0, 0, 0, 0, 0, NanInf, 0, 0, 0 }, // 9 Nan2
1953  { 0, 0, 0, 0, 0, 0, Inf2, 0, 0, 0 }, // 10 Inf1
1954  { 0, 0, 0, 0, 0, 0, 0, NanInf, 0, 0 }, // 11 Inf2
1955  { Done, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 11 NanInf
1956  };
1957 
1958  ParserState state = Init;
1959  InputToken input = None;
1960 
1961  scan(0, 0, 0, NotSpace);
1962  consumeLastToken();
1963 
1964  const int BufferSize = 128;
1965  char buf[BufferSize];
1966  int i = 0;
1967 
1968  QChar c;
1969  while (getChar(&c)) {
1970  switch (c.unicode()) {
1971  case '0': case '1': case '2': case '3': case '4':
1972  case '5': case '6': case '7': case '8': case '9':
1973  input = InputDigit;
1974  break;
1975  case 'i': case 'I':
1976  input = InputI;
1977  break;
1978  case 'n': case 'N':
1979  input = InputN;
1980  break;
1981  case 'f': case 'F':
1982  input = InputF;
1983  break;
1984  case 'a': case 'A':
1985  input = InputA;
1986  break;
1987  case 't': case 'T':
1988  input = InputT;
1989  break;
1990  default: {
1991  QChar lc = c.toLower();
1992  if (lc == locale.decimalPoint().toLower())
1993  input = InputDot;
1994  else if (lc == locale.exponential().toLower())
1995  input = InputExp;
1996  else if (lc == locale.negativeSign().toLower()
1997  || lc == locale.positiveSign().toLower())
1998  input = InputSign;
1999  else if (locale != QLocale::c() // backward-compatibility
2000  && lc == locale.groupSeparator().toLower())
2001  input = InputDigit; // well, it isn't a digit, but no one cares.
2002  else
2003  input = None;
2004  }
2005  break;
2006  }
2007 
2008  state = ParserState(table[state][input]);
2009 
2010  if (state == Init || state == Done || i > (BufferSize - 5)) {
2011  ungetChar(c);
2012  if (i > (BufferSize - 5)) { // ignore rest of digits
2013  while (getChar(&c)) {
2014  if (!c.isDigit()) {
2015  ungetChar(c);
2016  break;
2017  }
2018  }
2019  }
2020  break;
2021  }
2022 
2023  buf[i++] = c.toLatin1();
2024  }
2025 
2026  if (i == 0)
2027  return false;
2028  if (!f)
2029  return true;
2030  buf[i] = '\0';
2031 
2032  // backward-compatibility. Old implementation supported +nan/-nan
2033  // for some reason. QLocale only checks for lower-case
2034  // nan/+inf/-inf, so here we also check for uppercase and mixed
2035  // case versions.
2036  if (!qstricmp(buf, "nan") || !qstricmp(buf, "+nan") || !qstricmp(buf, "-nan")) {
2037  *f = qSNaN();
2038  return true;
2039  } else if (!qstricmp(buf, "+inf") || !qstricmp(buf, "inf")) {
2040  *f = qInf();
2041  return true;
2042  } else if (!qstricmp(buf, "-inf")) {
2043  *f = -qInf();
2044  return true;
2045  }
2046  bool ok;
2047  *f = locale.toDouble(QString::fromLatin1(buf), &ok);
2048  return ok;
2049 }
void ungetChar(const QChar &ch)
QChar positiveSign() const
Returns the positive sign character of this locale.
Definition: qlocale.cpp:1830
unsigned char c[8]
Definition: qnumeric_p.h:62
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
QChar exponential() const
Returns the exponential character of this locale.
Definition: qlocale.cpp:1843
bool scan(const QChar **ptr, int *tokenLength, int maxlen, TokenDelimiter delimiter)
Scans no more than maxlen QChars in the current buffer for the first delimiter.
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
unsigned char uchar
Definition: qglobal.h:994
QChar decimalPoint() const
Returns the decimal point character of this locale.
Definition: qlocale.cpp:1765
QChar groupSeparator() const
Returns the group separator character of this locale.
Definition: qlocale.cpp:1778
QChar negativeSign() const
Returns the negative sign character of this locale.
Definition: qlocale.cpp:1817
#define None
Q_CORE_EXPORT double qSNaN()
Returns the bit pattern of a signalling NaN as a double.
Definition: qnumeric.cpp:80
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
Definition: qlocale.h:773
double toDouble(const QString &s, bool *ok=0) const
Returns the double represented by the localized string s, or 0.0 if the conversion failed...
Definition: qlocale.cpp:1279
Q_CORE_EXPORT double qInf()
Returns the bit pattern for an infinite number as a double.
Definition: qnumeric.cpp:90
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
char toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0.
Definition: qchar.h:376
bool getChar(QChar *ch)
Q_CORE_EXPORT int qstricmp(const char *, const char *)
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239
bool isDigit() const
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false...
Definition: qchar.cpp:699

◆ putNumber()

void QTextStreamPrivate::putNumber ( qulonglong  number,
bool  negative 
)
Warning
This function is not part of the public interface.

Definition at line 2341 of file qtextstream.cpp.

2342 {
2343  QString result;
2344 
2345  unsigned flags = 0;
2347  flags |= QLocalePrivate::ShowBase;
2353  flags |= QLocalePrivate::CapitalEorX;
2354 
2355  // add thousands group separators. For backward compatibility we
2356  // don't add a group separator for C locale.
2357  if (locale != QLocale::c())
2359 
2360  const QLocalePrivate *dd = locale.d();
2361  int base = integerBase ? integerBase : 10;
2362  if (negative && base == 10) {
2363  result = dd->longLongToString(-static_cast<qlonglong>(number), -1,
2364  base, -1, flags);
2365  } else if (negative) {
2366  // Workaround for backward compatibility for writing negative
2367  // numbers in octal and hex:
2368  // QTextStream(result) << showbase << hex << -1 << oct << -1
2369  // should output: -0x1 -0b1
2370  result = dd->unsLongLongToString(number, -1, base, -1, flags);
2371  result.prepend(locale.negativeSign());
2372  } else {
2373  result = dd->unsLongLongToString(number, -1, base, -1, flags);
2374  // workaround for backward compatibility - in octal form with
2375  // ShowBase flag set zero should be written as '00'
2376  if (number == 0 && base == 8 && numberFlags & QTextStream::ShowBase
2377  && result == QLatin1String("0")) {
2378  result.prepend(QLatin1Char('0'));
2379  }
2380  }
2381  putString(result, true);
2382 }
void putString(const QString &ch, bool number=false)
QString & prepend(QChar c)
Definition: qstring.h:261
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static const uint base
Definition: qurl.cpp:268
static QString unsLongLongToString(const QChar zero, const QChar group, const QChar plus, quint64 l, int precision, int base, int width, unsigned flags)
Definition: qlocale.cpp:2870
static QString longLongToString(const QChar zero, const QChar group, const QChar plus, const QChar minus, qint64 l, int precision, int base, int width, unsigned flags)
Definition: qlocale.cpp:2775
QChar negativeSign() const
Returns the negative sign character of this locale.
Definition: qlocale.cpp:1817
const QLocalePrivate * d() const
Definition: qlocale.cpp:761
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
Definition: qlocale.h:773
QTextStream::NumberFlags numberFlags
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ putString()

void QTextStreamPrivate::putString ( const QString s,
bool  number = false 
)
inline
Warning
This function is not part of the public interface.

Definition at line 984 of file qtextstream.cpp.

985 {
986  QString tmp = s;
987 
988  // handle padding
989  int padSize = fieldWidth - s.size();
990  if (padSize > 0) {
991  QString pad(padSize, padChar);
993  tmp.append(QString(padSize, padChar));
996  tmp.prepend(QString(padSize, padChar));
998  const QChar sign = s.size() > 0 ? s.at(0) : QChar();
999  if (sign == locale.negativeSign() || sign == locale.positiveSign()) {
1000  QChar *data = tmp.data();
1001  data[padSize] = tmp.at(0);
1002  data[0] = sign;
1003  }
1004  }
1005  } else if (fieldAlignment == QTextStream::AlignCenter) {
1006  tmp.prepend(QString(padSize/2, padChar));
1007  tmp.append(QString(padSize - padSize/2, padChar));
1008  }
1009  }
1010 
1011 #if defined (QTEXTSTREAM_DEBUG)
1012  QByteArray a = s.toUtf8();
1013  QByteArray b = tmp.toUtf8();
1014  qDebug("QTextStreamPrivate::putString(\"%s\") calls write(\"%s\")",
1015  qt_prettyDebug(a.constData(), a.size(), qMax(16, a.size())).constData(),
1016  qt_prettyDebug(b.constData(), b.size(), qMax(16, b.size())).constData());
1017 #endif
1018  write(tmp);
1019 }
QChar positiveSign() const
Returns the positive sign character of this locale.
Definition: qlocale.cpp:1830
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
void write(const QString &data)
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QString & prepend(QChar c)
Definition: qstring.h:261
long ASN1_INTEGER_get ASN1_INTEGER * a
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QTextStream::FieldAlignment fieldAlignment
static int sign(int x)
Q_CORE_EXPORT void qDebug(const char *,...)
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static const char * data(const QByteArray &arr)
QChar negativeSign() const
Returns the negative sign character of this locale.
Definition: qlocale.cpp:1817
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QString & append(QChar c)
Definition: qstring.cpp:1777
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402

◆ read()

QString QTextStreamPrivate::read ( int  maxlen)

Definition at line 728 of file qtextstream.cpp.

729 {
730  QString ret;
731  if (string) {
732  lastTokenSize = qMin(maxlen, string->size() - stringOffset);
733  ret = string->mid(stringOffset, lastTokenSize);
734  } else {
735  while (readBuffer.size() - readBufferOffset < maxlen && fillReadBuffer()) ;
738  }
740 
741 #if defined (QTEXTSTREAM_DEBUG)
742  qDebug("QTextStreamPrivate::read() maxlen = %d, token length = %d", maxlen, ret.length());
743 #endif
744  return ret;
745 }
bool fillReadBuffer(qint64 maxBytes=-1)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_CORE_EXPORT void qDebug(const char *,...)
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706

◆ readPtr()

const QChar * QTextStreamPrivate::readPtr ( ) const
inline
Warning
This function is not part of the public interface.

Definition at line 853 of file qtextstream.cpp.

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

854 {
856  if (string)
857  return string->constData() + stringOffset;
859 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712

◆ reset()

void QTextStreamPrivate::reset ( )
Warning
This function is not part of the public interface.

Definition at line 498 of file qtextstream.cpp.

Referenced by QTextStreamPrivate().

499 {
501  integerBase = 0;
502  fieldWidth = 0;
503  padChar = QLatin1Char(' ');
506  numberFlags = 0;
507 
508  device = 0;
509  deleteDevice = false;
510  string = 0;
511  stringOffset = 0;
513 
514  readBufferOffset = 0;
516  lastTokenSize = 0;
517 
518 #ifndef QT_NO_TEXTCODEC
525  autoDetectUnicode = true;
526 #endif
527 }
static QTextCodec * codecForLocale()
Returns a pointer to the codec most suitable for this locale.
QTextCodec::ConverterState writeConverterState
QTextStream::RealNumberNotation realNumberNotation
QTextStream::FieldAlignment fieldAlignment
QTextCodec::ConverterState * readConverterSavedState
QIODevice * device
static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)
ConversionFlags flags
Definition: qtextcodec.h:106
QTextCodec * codec
QTextCodec::ConverterState readConverterState
qint64 readBufferStartDevicePos
QTextStream::NumberFlags numberFlags
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QIODevice::OpenMode stringOpenMode

◆ resetReadBuffer()

void QTextStreamPrivate::resetReadBuffer ( )
Warning
This function is not part of the public interface.

Definition at line 647 of file qtextstream.cpp.

648 {
649  readBuffer.clear();
650  readBufferOffset = 0;
652 }
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
Definition: qiodevice.cpp:624
QIODevice * device
qint64 readBufferStartDevicePos
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723

◆ restoreToSavedConverterState()

void QTextStreamPrivate::restoreToSavedConverterState ( )
inline
Warning
This function is not part of the public interface.

Definition at line 917 of file qtextstream.cpp.

Referenced by QTextStream::pos().

918 {
919 #ifndef QT_NO_TEXTCODEC
921  // we have a saved state
922  // that means the converter can be copied
924  } else {
925  // the only state we could save was the initial
926  // so reset to that
928  }
929 #endif
930 }
static void copyConverterStateHelper(QTextCodec::ConverterState *dest, const QTextCodec::ConverterState *src)
QTextCodec::ConverterState * readConverterSavedState
static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)
QTextCodec::ConverterState readConverterState

◆ saveConverterState()

void QTextStreamPrivate::saveConverterState ( qint64  newPos)
inline
Warning
This function is not part of the public interface.

Definition at line 897 of file qtextstream.cpp.

Referenced by consume().

898 {
899 #ifndef QT_NO_TEXTCODEC
900  if (readConverterState.d) {
901  // converter cannot be copied, so don't save anything
902  // don't update readBufferStartDevicePos either
903  return;
904  }
905 
909 #endif
910 
911  readBufferStartDevicePos = newPos;
913 }
static void copyConverterStateHelper(QTextCodec::ConverterState *dest, const QTextCodec::ConverterState *src)
QTextCodec::ConverterState * readConverterSavedState
QTextCodec::ConverterState readConverterState
qint64 readBufferStartDevicePos

◆ 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.

Warning
This function is not part of the public interface.

Stores a pointer to the start offset of the token in ptr, and the length in QChars in length.

Definition at line 756 of file qtextstream.cpp.

757 {
758  int totalSize = 0;
759  int delimSize = 0;
760  bool consumeDelimiter = false;
761  bool foundToken = false;
762  int startOffset = device ? readBufferOffset : stringOffset;
763  QChar lastChar;
764 
765  bool canStillReadFromDevice = true;
766  do {
767  int endOffset;
768  const QChar *chPtr;
769  if (device) {
770  chPtr = readBuffer.constData();
771  endOffset = readBuffer.size();
772  } else {
773  chPtr = string->constData();
774  endOffset = string->size();
775  }
776  chPtr += startOffset;
777 
778  for (; !foundToken && startOffset < endOffset && (!maxlen || totalSize < maxlen); ++startOffset) {
779  const QChar ch = *chPtr++;
780  ++totalSize;
781 
782  switch (delimiter) {
783  case Space:
784  if (ch.isSpace()) {
785  foundToken = true;
786  delimSize = 1;
787  }
788  break;
789  case NotSpace:
790  if (!ch.isSpace()) {
791  foundToken = true;
792  delimSize = 1;
793  }
794  break;
795  case EndOfLine:
796  if (ch == QLatin1Char('\n')) {
797  foundToken = true;
798  delimSize = (lastChar == QLatin1Char('\r')) ? 2 : 1;
799  consumeDelimiter = true;
800  }
801  lastChar = ch;
802  break;
803  }
804  }
805  } while (!foundToken
806  && (!maxlen || totalSize < maxlen)
807  && (device && (canStillReadFromDevice = fillReadBuffer())));
808 
809  // if the token was not found, but we reached the end of input,
810  // then we accept what we got. if we are not at the end of input,
811  // we return false.
812  if (!foundToken && (!maxlen || totalSize < maxlen)
813  && (totalSize == 0
814  || (string && stringOffset + totalSize < string->size())
815  || (device && !device->atEnd() && canStillReadFromDevice))) {
816 #if defined (QTEXTSTREAM_DEBUG)
817  qDebug("QTextStreamPrivate::scan() did not find the token.");
818 #endif
819  return false;
820  }
821 
822  // if we find a '\r' at the end of the data when reading lines,
823  // don't make it part of the line.
824  if (delimiter == EndOfLine && totalSize > 0 && !foundToken) {
825  if (((string && stringOffset + totalSize == string->size()) || (device && device->atEnd()))
826  && lastChar == QLatin1Char('\r')) {
827  consumeDelimiter = true;
828  ++delimSize;
829  }
830  }
831 
832  // set the read offset and length of the token
833  if (length)
834  *length = totalSize - delimSize;
835  if (ptr)
836  *ptr = readPtr();
837 
838  // update last token size. the callee will call consumeLastToken() when
839  // done.
840  lastTokenSize = totalSize;
841  if (!consumeDelimiter)
842  lastTokenSize -= delimSize;
843 
844 #if defined (QTEXTSTREAM_DEBUG)
845  qDebug("QTextStreamPrivate::scan(%p, %p, %d, %x) token length = %d, delimiter = %d",
846  ptr, length, maxlen, (int)delimiter, totalSize - delimSize, delimSize);
847 #endif
848  return true;
849 }
const QChar * readPtr() const
bool fillReadBuffer(qint64 maxBytes=-1)
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
Definition: qiodevice.cpp:711
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
Definition: qchar.cpp:609
Q_CORE_EXPORT void qDebug(const char *,...)
QIODevice * device
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712

◆ ungetChar()

void QTextStreamPrivate::ungetChar ( const QChar ch)
inline
Warning
This function is not part of the public interface.

Definition at line 964 of file qtextstream.cpp.

965 {
966  if (string) {
967  if (stringOffset == 0)
968  string->prepend(ch);
969  else
970  (*string)[--stringOffset] = ch;
971  return;
972  }
973 
974  if (readBufferOffset == 0) {
975  readBuffer.prepend(ch);
976  return;
977  }
978 
980 }
QString & prepend(QChar c)
Definition: qstring.h:261

◆ write()

void QTextStreamPrivate::write ( const QString data)
inline
Warning
This function is not part of the public interface.

Definition at line 934 of file qtextstream.cpp.

Referenced by putString().

935 {
936  if (string) {
937  // ### What about seek()??
938  string->append(data);
939  } else {
940  writeBuffer += data;
943  }
944 }
static const int QTEXTSTREAM_BUFFERSIZE
Definition: qtextstream.cpp:43
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static const char * data(const QByteArray &arr)

Properties

◆ autoDetectUnicode

bool QTextStreamPrivate::autoDetectUnicode

Definition at line 383 of file qtextstream.cpp.

Referenced by fillReadBuffer(), QTextStream::pos(), and reset().

◆ codec

QTextCodec* QTextStreamPrivate::codec

Definition at line 379 of file qtextstream.cpp.

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

◆ deleteDevice

bool QTextStreamPrivate::deleteDevice

Definition at line 370 of file qtextstream.cpp.

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

◆ device

QIODevice* QTextStreamPrivate::device

◆ deviceClosedNotifier

QDeviceClosedNotifier QTextStreamPrivate::deviceClosedNotifier

Definition at line 368 of file qtextstream.cpp.

◆ fieldAlignment

QTextStream::FieldAlignment QTextStreamPrivate::fieldAlignment

Definition at line 434 of file qtextstream.cpp.

Referenced by putString(), and reset().

◆ fieldWidth

int QTextStreamPrivate::fieldWidth

Definition at line 432 of file qtextstream.cpp.

Referenced by putString(), and reset().

◆ integerBase

int QTextStreamPrivate::integerBase

Definition at line 431 of file qtextstream.cpp.

Referenced by reset().

◆ lastTokenSize

int QTextStreamPrivate::lastTokenSize

Definition at line 401 of file qtextstream.cpp.

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

◆ locale

QLocale QTextStreamPrivate::locale

Definition at line 441 of file qtextstream.cpp.

Referenced by putString().

◆ numberFlags

QTextStream::NumberFlags QTextStreamPrivate::numberFlags

Definition at line 436 of file qtextstream.cpp.

Referenced by reset().

◆ padChar

QChar QTextStreamPrivate::padChar

Definition at line 433 of file qtextstream.cpp.

Referenced by putString(), and reset().

◆ q_ptr

QTextStream* QTextStreamPrivate::q_ptr

Definition at line 443 of file qtextstream.cpp.

Referenced by QTextStreamPrivate().

◆ readBuffer

QString QTextStreamPrivate::readBuffer

◆ readBufferOffset

int QTextStreamPrivate::readBufferOffset

◆ readBufferStartDevicePos

qint64 QTextStreamPrivate::readBufferStartDevicePos

Definition at line 427 of file qtextstream.cpp.

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

◆ readConverterSavedState

QTextCodec::ConverterState* QTextStreamPrivate::readConverterSavedState

◆ readConverterSavedStateOffset

int QTextStreamPrivate::readConverterSavedStateOffset

Definition at line 426 of file qtextstream.cpp.

Referenced by consume(), QTextStream::pos(), and saveConverterState().

◆ readConverterState

QTextCodec::ConverterState QTextStreamPrivate::readConverterState

◆ realNumberNotation

QTextStream::RealNumberNotation QTextStreamPrivate::realNumberNotation

Definition at line 435 of file qtextstream.cpp.

Referenced by reset().

◆ realNumberPrecision

int QTextStreamPrivate::realNumberPrecision

Definition at line 430 of file qtextstream.cpp.

Referenced by reset().

◆ status

QTextStream::Status QTextStreamPrivate::status

Definition at line 439 of file qtextstream.cpp.

Referenced by flushWriteBuffer().

◆ string

QString* QTextStreamPrivate::string

Definition at line 373 of file qtextstream.cpp.

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

◆ stringOffset

int QTextStreamPrivate::stringOffset

Definition at line 374 of file qtextstream.cpp.

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

◆ stringOpenMode

QIODevice::OpenMode QTextStreamPrivate::stringOpenMode

Definition at line 375 of file qtextstream.cpp.

Referenced by reset().

◆ writeBuffer

QString QTextStreamPrivate::writeBuffer

Definition at line 423 of file qtextstream.cpp.

Referenced by flushWriteBuffer(), and write().

◆ writeConverterState

QTextCodec::ConverterState QTextStreamPrivate::writeConverterState

Definition at line 381 of file qtextstream.cpp.

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


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