summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qtextstream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qtextstream.cpp')
-rw-r--r--src/corelib/io/qtextstream.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 66727e7dc4..6cbe91fab2 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -827,6 +827,21 @@ inline void QTextStreamPrivate::write(const QString &data)
/*!
\internal
*/
+inline void QTextStreamPrivate::write(QChar ch)
+{
+ if (string) {
+ // ### What about seek()??
+ string->append(ch);
+ } else {
+ writeBuffer += ch;
+ if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE)
+ flushWriteBuffer();
+ }
+}
+
+/*!
+ \internal
+*/
inline bool QTextStreamPrivate::getChar(QChar *ch)
{
if ((string && stringOffset == string->size())
@@ -865,6 +880,17 @@ inline void QTextStreamPrivate::ungetChar(QChar ch)
/*!
\internal
*/
+inline void QTextStreamPrivate::putChar(QChar ch)
+{
+ if (params.fieldWidth > 0)
+ putString(QString(ch));
+ else
+ write(ch);
+}
+
+/*!
+ \internal
+*/
inline void QTextStreamPrivate::putString(const QString &s, bool number)
{
QString tmp = s;
@@ -2232,7 +2258,7 @@ QTextStream &QTextStream::operator<<(QChar c)
{
Q_D(QTextStream);
CHECK_VALID_STREAM(*this);
- d->putString(QString(c));
+ d->putChar(c);
return *this;
}
@@ -2245,7 +2271,7 @@ QTextStream &QTextStream::operator<<(char c)
{
Q_D(QTextStream);
CHECK_VALID_STREAM(*this);
- d->putString(QString(QChar::fromLatin1(c)));
+ d->putChar(QChar::fromLatin1(c));
return *this;
}