summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qtextstream_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-15 10:45:11 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-10-22 18:41:56 +0000
commita903ddd8dc806b51c21c84965611880a25037562 (patch)
treed3dd3dfe4ce8915039bca90544cf93315be331d6 /src/corelib/io/qtextstream_p.h
parentd206d04b7c368754bca9c43d8a67895b4baa8893 (diff)
QTextStream: Extract Method padding() from putString()
This is in preparation of adding a putString(QLatin1String) overload. To keep the change simple, I kept the construction of the padChar chain per putString() call. It probably makes sense to have a QString::resize(int, QChar) to perform the padding operation in-place. Let's leave that for another changeset. Change-Id: I9ef66b8df38117e1669fd2bece6ee180a2ce3369 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qtextstream_p.h')
-rw-r--r--src/corelib/io/qtextstream_p.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h
index 01289d7dc6..c44ae5dada 100644
--- a/src/corelib/io/qtextstream_p.h
+++ b/src/corelib/io/qtextstream_p.h
@@ -173,6 +173,14 @@ public:
inline void putChar(QChar ch);
void putNumber(qulonglong number, bool negative);
+ struct PaddingResult {
+ enum { PreallocatedPadding = 80 }; // typical line length
+
+ int right, left;
+ QVarLengthArray<QChar, PreallocatedPadding> padding;
+ };
+ PaddingResult padding(int len) const;
+
// buffers
bool fillReadBuffer(qint64 maxBytes = -1);
void resetReadBuffer();