summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qtextstream_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-11-18 12:04:13 -0800
committerThiago Macieira <thiago.macieira@intel.com>2014-12-13 05:10:10 +0100
commit0bc6c4f7ecfa332de57500fe722872eff4009b9b (patch)
tree5744580102b73fe1c173189f6651e07df1d2ece7 /src/corelib/io/qtextstream_p.h
parent2dd445a25acbf0ff56f0531b70fe04d33ce2349a (diff)
QTextStream: stream QStrings without modifying the user content
QTextStream::operator<< calls QTextStreamPrivate::putString, which was taking a copy of the user's string and modifying it depending on padding. That is not necessary, since we're only talking about padding. Instead, calculate the left and right paddings. For the case of "accounting padding", we move the sign (if any) to the beginning of the left padding and skip it in the data. The one side-effect I can think of is that the stream could flush in the middle of the writing operation. The debugging section had to be removed because it doesn't make sense anymore. Change-Id: I57fdbf98ec6f054f4e085f2e465de3dcbb6225ce Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qtextstream_p.h')
-rw-r--r--src/corelib/io/qtextstream_p.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h
index b7281e42ad..f8c151b76c 100644
--- a/src/corelib/io/qtextstream_p.h
+++ b/src/corelib/io/qtextstream_p.h
@@ -165,9 +165,11 @@ public:
NumberParsingStatus getNumber(qulonglong *l);
bool getReal(double *f);
- inline void write(const QString &data);
+ inline void write(const QString &data) { write(data.begin(), data.length()); }
inline void write(QChar ch);
- inline void putString(const QString &ch, bool number = false);
+ void write(const QChar *data, int len);
+ inline void putString(const QString &ch, bool number = false) { putString(ch.constData(), ch.length(), number); }
+ void putString(const QChar *data, int len, bool number = false);
inline void putChar(QChar ch);
void putNumber(qulonglong number, bool negative);