OpenCoverage

qtextstream.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qtextstream.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41//#define QTEXTSTREAM_DEBUG-
42static const int QTEXTSTREAM_BUFFERSIZE = 16384;-
43-
44/*!-
45 \class QTextStream-
46 \inmodule QtCore-
47-
48 \brief The QTextStream class provides a convenient interface for-
49 reading and writing text.-
50-
51 \ingroup io-
52 \ingroup string-processing-
53 \reentrant-
54-
55 QTextStream can operate on a QIODevice, a QByteArray or a-
56 QString. Using QTextStream's streaming operators, you can-
57 conveniently read and write words, lines and numbers. For-
58 generating text, QTextStream supports formatting options for field-
59 padding and alignment, and formatting of numbers. Example:-
60-
61 \snippet code/src_corelib_io_qtextstream.cpp 0-
62-
63 It's also common to use QTextStream to read console input and write-
64 console output. QTextStream is locale aware, and will automatically decode-
65 standard input using the correct codec. Example:-
66-
67 \snippet code/src_corelib_io_qtextstream.cpp 1-
68-
69 Besides using QTextStream's constructors, you can also set the-
70 device or string QTextStream operates on by calling setDevice() or-
71 setString(). You can seek to a position by calling seek(), and-
72 atEnd() will return true when there is no data left to be read. If-
73 you call flush(), QTextStream will empty all data from its write-
74 buffer into the device and call flush() on the device.-
75-
76 Internally, QTextStream uses a Unicode based buffer, and-
77 QTextCodec is used by QTextStream to automatically support-
78 different character sets. By default, QTextCodec::codecForLocale()-
79 is used for reading and writing, but you can also set the codec by-
80 calling setCodec(). Automatic Unicode detection is also-
81 supported. When this feature is enabled (the default behavior),-
82 QTextStream will detect the UTF-16 or the UTF-32 BOM (Byte Order Mark) and-
83 switch to the appropriate UTF codec when reading. QTextStream-
84 does not write a BOM by default, but you can enable this by calling-
85 setGenerateByteOrderMark(true). When QTextStream operates on a QString-
86 directly, the codec is disabled.-
87-
88 There are three general ways to use QTextStream when reading text-
89 files:-
90-
91 \list-
92-
93 \li Chunk by chunk, by calling readLine() or readAll().-
94-
95 \li Word by word. QTextStream supports streaming into \l {QString}s,-
96 \l {QByteArray}s and char* buffers. Words are delimited by space, and-
97 leading white space is automatically skipped.-
98-
99 \li Character by character, by streaming into QChar or char types.-
100 This method is often used for convenient input handling when-
101 parsing files, independent of character encoding and end-of-line-
102 semantics. To skip white space, call skipWhiteSpace().-
103-
104 \endlist-
105-
106 Since the text stream uses a buffer, you should not read from-
107 the stream using the implementation of a superclass. For instance,-
108 if you have a QFile and read from it directly using-
109 QFile::readLine() instead of using the stream, the text stream's-
110 internal position will be out of sync with the file's position.-
111-
112 By default, when reading numbers from a stream of text,-
113 QTextStream will automatically detect the number's base-
114 representation. For example, if the number starts with "0x", it is-
115 assumed to be in hexadecimal form. If it starts with the digits-
116 1-9, it is assumed to be in decimal form, and so on. You can set-
117 the integer base, thereby disabling the automatic detection, by-
118 calling setIntegerBase(). Example:-
119-
120 \snippet code/src_corelib_io_qtextstream.cpp 2-
121-
122 QTextStream supports many formatting options for generating text.-
123 You can set the field width and pad character by calling-
124 setFieldWidth() and setPadChar(). Use setFieldAlignment() to set-
125 the alignment within each field. For real numbers, call-
126 setRealNumberNotation() and setRealNumberPrecision() to set the-
127 notation (SmartNotation, ScientificNotation, FixedNotation) and precision in-
128 digits of the generated number. Some extra number formatting-
129 options are also available through setNumberFlags().-
130-
131 \target QTextStream manipulators-
132-
133 Like \c <iostream> in the standard C++ library, QTextStream also-
134 defines several global manipulator functions:-
135-
136 \table-
137 \header \li Manipulator \li Description-
138 \row \li \c bin \li Same as setIntegerBase(2).-
139 \row \li \c oct \li Same as setIntegerBase(8).-
140 \row \li \c dec \li Same as setIntegerBase(10).-
141 \row \li \c hex \li Same as setIntegerBase(16).-
142 \row \li \c showbase \li Same as setNumberFlags(numberFlags() | ShowBase).-
143 \row \li \c forcesign \li Same as setNumberFlags(numberFlags() | ForceSign).-
144 \row \li \c forcepoint \li Same as setNumberFlags(numberFlags() | ForcePoint).-
145 \row \li \c noshowbase \li Same as setNumberFlags(numberFlags() & ~ShowBase).-
146 \row \li \c noforcesign \li Same as setNumberFlags(numberFlags() & ~ForceSign).-
147 \row \li \c noforcepoint \li Same as setNumberFlags(numberFlags() & ~ForcePoint).-
148 \row \li \c uppercasebase \li Same as setNumberFlags(numberFlags() | UppercaseBase).-
149 \row \li \c uppercasedigits \li Same as setNumberFlags(numberFlags() | UppercaseDigits).-
150 \row \li \c lowercasebase \li Same as setNumberFlags(numberFlags() & ~UppercaseBase).-
151 \row \li \c lowercasedigits \li Same as setNumberFlags(numberFlags() & ~UppercaseDigits).-
152 \row \li \c fixed \li Same as setRealNumberNotation(FixedNotation).-
153 \row \li \c scientific \li Same as setRealNumberNotation(ScientificNotation).-
154 \row \li \c left \li Same as setFieldAlignment(AlignLeft).-
155 \row \li \c right \li Same as setFieldAlignment(AlignRight).-
156 \row \li \c center \li Same as setFieldAlignment(AlignCenter).-
157 \row \li \c endl \li Same as operator<<('\\n') and flush().-
158 \row \li \c flush \li Same as flush().-
159 \row \li \c reset \li Same as reset().-
160 \row \li \c ws \li Same as skipWhiteSpace().-
161 \row \li \c bom \li Same as setGenerateByteOrderMark(true).-
162 \endtable-
163-
164 In addition, Qt provides three global manipulators that take a-
165 parameter: qSetFieldWidth(), qSetPadChar(), and-
166 qSetRealNumberPrecision().-
167-
168 \sa QDataStream, QIODevice, QFile, QBuffer, QTcpSocket, {Text Codecs Example}-
169*/-
170-
171/*! \enum QTextStream::RealNumberNotation-
172-
173 This enum specifies which notations to use for expressing \c-
174 float and \c double as strings.-
175-
176 \value ScientificNotation Scientific notation (\c{printf()}'s \c %e flag).-
177 \value FixedNotation Fixed-point notation (\c{printf()}'s \c %f flag).-
178 \value SmartNotation Scientific or fixed-point notation, depending on which makes most sense (\c{printf()}'s \c %g flag).-
179-
180 \sa setRealNumberNotation()-
181*/-
182-
183/*! \enum QTextStream::FieldAlignment-
184-
185 This enum specifies how to align text in fields when the field is-
186 wider than the text that occupies it.-
187-
188 \value AlignLeft Pad on the right side of fields.-
189 \value AlignRight Pad on the left side of fields.-
190 \value AlignCenter Pad on both sides of field.-
191 \value AlignAccountingStyle Same as AlignRight, except that the-
192 sign of a number is flush left.-
193-
194 \sa setFieldAlignment()-
195*/-
196-
197/*! \enum QTextStream::NumberFlag-
198-
199 This enum specifies various flags that can be set to affect the-
200 output of integers, \c{float}s, and \c{double}s.-
201-
202 \value ShowBase Show the base as a prefix if the base-
203 is 16 ("0x"), 8 ("0"), or 2 ("0b").-
204 \value ForcePoint Always put the decimal separator in numbers, even if-
205 there are no decimals.-
206 \value ForceSign Always put the sign in numbers, even for positive numbers.-
207 \value UppercaseBase Use uppercase versions of base prefixes ("0X", "0B").-
208 \value UppercaseDigits Use uppercase letters for expressing-
209 digits 10 to 35 instead of lowercase.-
210-
211 \sa setNumberFlags()-
212*/-
213-
214/*! \enum QTextStream::Status-
215-
216 This enum describes the current status of the text stream.-
217-
218 \value Ok The text stream is operating normally.-
219 \value ReadPastEnd The text stream has read past the end of the-
220 data in the underlying device.-
221 \value ReadCorruptData The text stream has read corrupt data.-
222 \value WriteFailed The text stream cannot write to the underlying device.-
223-
224 \sa status()-
225*/-
226-
227#include "qtextstream.h"-
228#include "private/qtextstream_p.h"-
229#include "qbuffer.h"-
230#include "qfile.h"-
231#include "qnumeric.h"-
232#include "qvarlengtharray.h"-
233-
234#ifndef Q_OS_WINCE-
235#include <locale.h>-
236#endif-
237#include "private/qlocale_p.h"-
238-
239#include <stdlib.h>-
240#include <limits.h>-
241#include <new>-
242-
243#if defined QTEXTSTREAM_DEBUG-
244#include <ctype.h>-
245#include "private/qtools_p.h"-
246-
247QT_BEGIN_NAMESPACE-
248-
249// Returns a human readable representation of the first \a len-
250// characters in \a data.-
251static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)-
252{-
253 if (!data) return "(null)";-
254 QByteArray out;-
255 for (int i = 0; i < len; ++i) {-
256 char c = data[i];-
257 if (isprint(int(uchar(c)))) {-
258 out += c;-
259 } else switch (c) {-
260 case '\n': out += "\\n"; break;-
261 case '\r': out += "\\r"; break;-
262 case '\t': out += "\\t"; break;-
263 default: {-
264 const char buf[] = {-
265 '\\',-
266 'x',-
267 QtMiscUtils::toHexLower(uchar(c) / 16),-
268 QtMiscUtils::toHexLower(uchar(c) % 16),-
269 0-
270 };-
271 out += buf;-
272 }-
273 }-
274 }-
275-
276 if (len < maxSize)-
277 out += "...";-
278-
279 return out;-
280}-
281QT_END_NAMESPACE-
282-
283#endif-
284-
285// A precondition macro-
286#define Q_VOID-
287#define CHECK_VALID_STREAM(x) do { \-
288 if (!d->string && !d->device) { \-
289 qWarning("QTextStream: No device"); \-
290 return x; \-
291 } } while (0)-
292-
293// Base implementations of operator>> for ints and reals-
294#define IMPLEMENT_STREAM_RIGHT_INT_OPERATOR(type) do { \-
295 Q_D(QTextStream); \-
296 CHECK_VALID_STREAM(*this); \-
297 qulonglong tmp; \-
298 switch (d->getNumber(&tmp)) { \-
299 case QTextStreamPrivate::npsOk: \-
300 i = (type)tmp; \-
301 break; \-
302 case QTextStreamPrivate::npsMissingDigit: \-
303 case QTextStreamPrivate::npsInvalidPrefix: \-
304 i = (type)0; \-
305 setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); \-
306 break; \-
307 } \-
308 return *this; } while (0)-
309-
310#define IMPLEMENT_STREAM_RIGHT_REAL_OPERATOR(type) do { \-
311 Q_D(QTextStream); \-
312 CHECK_VALID_STREAM(*this); \-
313 double tmp; \-
314 if (d->getReal(&tmp)) { \-
315 f = (type)tmp; \-
316 } else { \-
317 f = (type)0; \-
318 setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); \-
319 } \-
320 return *this; } while (0)-
321-
322QT_BEGIN_NAMESPACE-
323-
324//--------------------------------------------------------------------
325-
326/*!-
327 \internal-
328*/-
329QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)-
330 :-
331#ifndef QT_NO_TEXTCODEC-
332 readConverterSavedState(0),-
333#endif-
334 readConverterSavedStateOffset(0),-
335 locale(QLocale::c())-
336{-
337 this->q_ptr = q_ptr;-
338 reset();-
339}
executed 79221 times by 96 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
79221
340-
341/*!-
342 \internal-
343*/-
344QTextStreamPrivate::~QTextStreamPrivate()-
345{-
346 if (deleteDevice) {
deleteDeviceDescription
TRUEevaluated 845 times by 8 tests
Evaluated by:
  • tst_QKeyEvent
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qmakelib
  • tst_qtextstream - unknown status
FALSEevaluated 78376 times by 93 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
845-78376
347#ifndef QT_NO_QOBJECT-
348 device->blockSignals(true);-
349#endif-
350 delete device;-
351 }
executed 845 times by 8 tests: end of block
Executed by:
  • tst_QKeyEvent
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qmakelib
  • tst_qtextstream - unknown status
845
352#ifndef QT_NO_TEXTCODEC-
353 delete readConverterSavedState;-
354#endif-
355}
executed 79221 times by 96 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
79221
356-
357#ifndef QT_NO_TEXTCODEC-
358static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)-
359{-
360 state->~ConverterState();-
361 new (state) QTextCodec::ConverterState;-
362}
executed 589195 times by 96 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
589195
363-
364static void copyConverterStateHelper(QTextCodec::ConverterState *dest,-
365 const QTextCodec::ConverterState *src)-
366{-
367 // ### QTextCodec::ConverterState's copy constructors and assignments are-
368 // private. This function copies the structure manually.-
369 Q_ASSERT(!src->d);-
370 dest->flags = src->flags;-
371 dest->invalidChars = src->invalidChars;-
372 dest->state_data[0] = src->state_data[0];-
373 dest->state_data[1] = src->state_data[1];-
374 dest->state_data[2] = src->state_data[2];-
375}
executed 2698 times by 16 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
2698
376#endif-
377-
378void QTextStreamPrivate::Params::reset()-
379{-
380 realNumberPrecision = 6;-
381 integerBase = 0;-
382 fieldWidth = 0;-
383 padChar = QLatin1Char(' ');-
384 fieldAlignment = QTextStream::AlignRight;-
385 realNumberNotation = QTextStream::SmartNotation;-
386 numberFlags = 0;-
387}
executed 93328 times by 96 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
93328
388-
389/*!-
390 \internal-
391*/-
392void QTextStreamPrivate::reset()-
393{-
394 params.reset();-
395-
396 device = 0;-
397 deleteDevice = false;-
398 string = 0;-
399 stringOffset = 0;-
400 stringOpenMode = QIODevice::NotOpen;-
401-
402 readBufferOffset = 0;-
403 readBufferStartDevicePos = 0;-
404 lastTokenSize = 0;-
405-
406#ifndef QT_NO_TEXTCODEC-
407 codec = QTextCodec::codecForLocale();-
408 resetCodecConverterStateHelper(&readConverterState);-
409 resetCodecConverterStateHelper(&writeConverterState);-
410 delete readConverterSavedState;-
411 readConverterSavedState = 0;-
412 writeConverterState.flags |= QTextCodec::IgnoreHeader;-
413 autoDetectUnicode = true;-
414#endif-
415}
executed 79239 times by 96 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
79239
416-
417/*!-
418 \internal-
419*/-
420bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)-
421{-
422 // no buffer next to the QString itself; this function should only-
423 // be called internally, for devices.-
424 Q_ASSERT(!string);-
425 Q_ASSERT(device);-
426-
427 // handle text translation and bypass the Text flag in the device.-
428 bool textModeEnabled = device->isTextModeEnabled();-
429 if (textModeEnabled)
textModeEnabledDescription
TRUEevaluated 41040053 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 2563 times by 13 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
2563-41040053
430 device->setTextModeEnabled(false);
executed 41040053 times by 6 tests: device->setTextModeEnabled(false);
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
41040053
431-
432 // read raw data into a temporary buffer-
433 char buf[QTEXTSTREAM_BUFFERSIZE];-
434 qint64 bytesRead = 0;-
435#if defined(Q_OS_WIN)-
436 // On Windows, there is no non-blocking stdin - so we fall back to reading-
437 // lines instead. If there is no QOBJECT, we read lines for all sequential-
438 // devices; otherwise, we read lines only for stdin.-
439 QFile *file = 0;-
440 Q_UNUSED(file);-
441 if (device->isSequential()-
442#if !defined(QT_NO_QOBJECT)-
443 && (file = qobject_cast<QFile *>(device)) && file->handle() == 0-
444#endif-
445 ) {-
446 if (maxBytes != -1)-
447 bytesRead = device->readLine(buf, qMin<qint64>(sizeof(buf), maxBytes));-
448 else-
449 bytesRead = device->readLine(buf, sizeof(buf));-
450 } else-
451#endif-
452 {-
453 if (maxBytes != -1)
maxBytes != -1Description
TRUEevaluated 41035294 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 7322 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
7322-41035294
454 bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes));
executed 41035294 times by 1 test: bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes));
Executed by:
  • tst_QTextStream
41035294
455 else-
456 bytesRead = device->read(buf, sizeof(buf));
executed 7322 times by 17 tests: bytesRead = device->read(buf, sizeof(buf));
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
7322
457 }-
458-
459 // reset the Text flag.-
460 if (textModeEnabled)
textModeEnabledDescription
TRUEevaluated 41040053 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 2563 times by 13 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
2563-41040053
461 device->setTextModeEnabled(true);
executed 41040053 times by 6 tests: device->setTextModeEnabled(true);
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
41040053
462-
463 if (bytesRead <= 0)
bytesRead <= 0Description
TRUEevaluated 2523 times by 7 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 41040093 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
2523-41040093
464 return false;
executed 2523 times by 7 tests: return false;
Executed by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTextStream
  • tst_QXmlSimpleReader
2523
465-
466#ifndef QT_NO_TEXTCODEC-
467 // codec auto detection, explicitly defaults to locale encoding if the-
468 // codec has been set to 0.-
469 if (!codec || autoDetectUnicode) {
!codecDescription
TRUEnever evaluated
FALSEevaluated 41040093 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
autoDetectUnicodeDescription
TRUEevaluated 4547 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 41035546 times by 5 tests
Evaluated by:
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QSplitter
  • tst_QTextStream
  • tst_QTimeZone
0-41040093
470 autoDetectUnicode = false;-
471-
472 codec = QTextCodec::codecForUtfText(QByteArray::fromRawData(buf, bytesRead), codec);-
473 if (!codec) {
!codecDescription
TRUEnever evaluated
FALSEevaluated 4547 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
0-4547
474 codec = QTextCodec::codecForLocale();-
475 writeConverterState.flags |= QTextCodec::IgnoreHeader;-
476 }
never executed: end of block
0
477 }
executed 4547 times by 17 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
4547
478#if defined (QTEXTSTREAM_DEBUG)-
479 qDebug("QTextStreamPrivate::fillReadBuffer(), using %s codec",-
480 codec ? codec->name().constData() : "no");-
481#endif-
482#endif-
483-
484#if defined (QTEXTSTREAM_DEBUG)-
485 qDebug("QTextStreamPrivate::fillReadBuffer(), device->read(\"%s\", %d) == %d",-
486 qt_prettyDebug(buf, qMin(32,int(bytesRead)) , int(bytesRead)).constData(), int(sizeof(buf)), int(bytesRead));-
487#endif-
488-
489 int oldReadBufferSize = readBuffer.size();-
490#ifndef QT_NO_TEXTCODEC-
491 // convert to unicode-
492 readBuffer += Q_LIKELY(codec) ? codec->toUnicode(buf, bytesRead, &readConverterState)
__builtin_expe...(codec), true)Description
TRUEevaluated 41040093 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
FALSEnever evaluated
0-41040093
493 : QString::fromLatin1(buf, bytesRead);-
494#else-
495 readBuffer += QString::fromLatin1(buf, bytesRead);-
496#endif-
497-
498 // remove all '\r\n' in the string.-
499 if (readBuffer.size() > oldReadBufferSize && textModeEnabled) {
readBuffer.siz...ReadBufferSizeDescription
TRUEevaluated 41039411 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 682 times by 1 test
Evaluated by:
  • tst_QTextStream
textModeEnabledDescription
TRUEevaluated 41037818 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 1593 times by 13 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
682-41039411
500 QChar CR = QLatin1Char('\r');-
501 QChar *writePtr = readBuffer.data() + oldReadBufferSize;-
502 QChar *readPtr = readBuffer.data() + oldReadBufferSize;-
503 QChar *endPtr = readBuffer.data() + readBuffer.size();-
504-
505 int n = oldReadBufferSize;-
506 if (readPtr < endPtr) {
readPtr < endPtrDescription
TRUEevaluated 41037818 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEnever evaluated
0-41037818
507 // Cut-off to avoid unnecessary self-copying.-
508 while (*readPtr++ != CR) {
*readPtr++ != CRDescription
TRUEevaluated 63893758 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 110 times by 1 test
Evaluated by:
  • tst_QTextStream
110-63893758
509 ++n;-
510 if (++writePtr == endPtr)
++writePtr == endPtrDescription
TRUEevaluated 41037708 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 22856050 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
22856050-41037708
511 break;
executed 41037708 times by 6 tests: break;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
41037708
512 }
executed 22856050 times by 6 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
22856050
513 }
executed 41037818 times by 6 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
41037818
514 while (readPtr < endPtr) {
readPtr < endPtrDescription
TRUEevaluated 146620 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 41037818 times by 6 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
146620-41037818
515 QChar ch = *readPtr++;-
516 if (ch != CR) {
ch != CRDescription
TRUEevaluated 124415 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 22205 times by 1 test
Evaluated by:
  • tst_QTextStream
22205-124415
517 *writePtr++ = ch;-
518 } else {
executed 124415 times by 1 test: end of block
Executed by:
  • tst_QTextStream
124415
519 if (n < readBufferOffset)
n < readBufferOffsetDescription
TRUEnever evaluated
FALSEevaluated 22205 times by 1 test
Evaluated by:
  • tst_QTextStream
0-22205
520 --readBufferOffset;
never executed: --readBufferOffset;
0
521 --bytesRead;-
522 }
executed 22205 times by 1 test: end of block
Executed by:
  • tst_QTextStream
22205
523 ++n;-
524 }
executed 146620 times by 1 test: end of block
Executed by:
  • tst_QTextStream
146620
525 readBuffer.resize(writePtr - readBuffer.data());-
526 }
executed 41037818 times by 6 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_QXmlSimpleReader
41037818
527-
528#if defined (QTEXTSTREAM_DEBUG)-
529 qDebug("QTextStreamPrivate::fillReadBuffer() read %d bytes from device. readBuffer = [%s]", int(bytesRead),-
530 qt_prettyDebug(readBuffer.toLatin1(), readBuffer.size(), readBuffer.size()).data());-
531#endif-
532 return true;
executed 41040093 times by 17 tests: return true;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
41040093
533}-
534-
535/*!-
536 \internal-
537*/-
538void QTextStreamPrivate::resetReadBuffer()-
539{-
540 readBuffer.clear();-
541 readBufferOffset = 0;-
542 readBufferStartDevicePos = (device ? device->pos() : 0);
deviceDescription
TRUEevaluated 214481 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
1-214481
543}
executed 214482 times by 1 test: end of block
Executed by:
  • tst_QTextStream
214482
544-
545/*!-
546 \internal-
547*/-
548void QTextStreamPrivate::flushWriteBuffer()-
549{-
550 // no buffer next to the QString itself; this function should only-
551 // be called internally, for devices.-
552 if (string || !device)
stringDescription
TRUEevaluated 48597 times by 7 tests
Evaluated by:
  • tst_QDBusXmlParser
  • tst_QGraphicsItem
  • tst_QGuiVariant
  • tst_QLogging
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
FALSEevaluated 241565 times by 19 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
!deviceDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 241552 times by 19 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
13-241565
553 return;
executed 48610 times by 7 tests: return;
Executed by:
  • tst_QDBusXmlParser
  • tst_QGraphicsItem
  • tst_QGuiVariant
  • tst_QLogging
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
48610
554-
555 // Stream went bye-bye already. Appending further data may succeed again,-
556 // but would create a corrupted stream anyway.-
557 if (status != QTextStream::Ok)
status != QTextStream::OkDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 241549 times by 19 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
3-241549
558 return;
executed 3 times by 1 test: return;
Executed by:
  • tst_QTextStream
3
559-
560 if (writeBuffer.isEmpty())
writeBuffer.isEmpty()Description
TRUEevaluated 214885 times by 6 tests
Evaluated by:
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QSaveFile
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_qdbusxml2cpp - unknown status
FALSEevaluated 26664 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
26664-214885
561 return;
executed 214885 times by 6 tests: return;
Executed by:
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QSaveFile
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_qdbusxml2cpp - unknown status
214885
562-
563#if defined (Q_OS_WIN)-
564 // handle text translation and bypass the Text flag in the device.-
565 bool textModeEnabled = device->isTextModeEnabled();-
566 if (textModeEnabled) {-
567 device->setTextModeEnabled(false);-
568 writeBuffer.replace(QLatin1Char('\n'), QLatin1String("\r\n"));-
569 }-
570#endif-
571-
572#ifndef QT_NO_TEXTCODEC-
573 if (!codec)
!codecDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qtextstream - unknown status
FALSEevaluated 26663 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
1-26663
574 codec = QTextCodec::codecForLocale();
executed 1 time by 1 test: codec = QTextCodec::codecForLocale();
Executed by:
  • tst_qtextstream - unknown status
1
575#if defined (QTEXTSTREAM_DEBUG)-
576 qDebug("QTextStreamPrivate::flushWriteBuffer(), using %s codec (%s generating BOM)",-
577 codec ? codec->name().constData() : "no",-
578 !codec || (writeConverterState.flags & QTextCodec::IgnoreHeader) ? "not" : "");-
579#endif-
580-
581 // convert from unicode to raw data-
582 // codec might be null if we're already inside global destructors (QTestCodec::codecForLocale returned null)-
583 QByteArray data = Q_LIKELY(codec) ? codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState)
__builtin_expe...(codec), true)Description
TRUEevaluated 26663 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qtextstream - unknown status
1-26663
584 : writeBuffer.toLatin1();-
585#else-
586 QByteArray data = writeBuffer.toLatin1();-
587#endif-
588 writeBuffer.clear();-
589-
590 // write raw data to the device-
591 qint64 bytesWritten = device->write(data);-
592#if defined (QTEXTSTREAM_DEBUG)-
593 qDebug("QTextStreamPrivate::flushWriteBuffer(), device->write(\"%s\") == %d",-
594 qt_prettyDebug(data.constData(), qMin(data.size(),32), data.size()).constData(), int(bytesWritten));-
595#endif-
596-
597#if defined (Q_OS_WIN)-
598 // reset the text flag-
599 if (textModeEnabled)-
600 device->setTextModeEnabled(true);-
601#endif-
602-
603 if (bytesWritten <= 0) {
bytesWritten <= 0Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 26662 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
2-26662
604 status = QTextStream::WriteFailed;-
605 return;
executed 2 times by 2 tests: return;
Executed by:
  • tst_QString
  • tst_QTextStream
2
606 }-
607-
608 // flush the file-
609#ifndef QT_NO_QOBJECT-
610 QFileDevice *file = qobject_cast<QFileDevice *>(device);-
611 bool flushed = !file || file->flush();
!fileDescription
TRUEevaluated 10830 times by 7 tests
Evaluated by:
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
FALSEevaluated 15832 times by 11 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QTextStream
file->flush()Description
TRUEevaluated 15832 times by 11 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QTextStream
FALSEnever evaluated
0-15832
612#else-
613 bool flushed = true;-
614#endif-
615-
616#if defined (QTEXTSTREAM_DEBUG)-
617 qDebug("QTextStreamPrivate::flushWriteBuffer() wrote %d bytes",-
618 int(bytesWritten));-
619#endif-
620 if (!flushed || bytesWritten != qint64(data.size()))
!flushedDescription
TRUEnever evaluated
FALSEevaluated 26662 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
bytesWritten !...4(data.size())Description
TRUEnever evaluated
FALSEevaluated 26662 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
0-26662
621 status = QTextStream::WriteFailed;
never executed: status = QTextStream::WriteFailed;
0
622}
executed 26662 times by 17 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
26662
623-
624QString QTextStreamPrivate::read(int maxlen)-
625{-
626 QString ret;-
627 if (string) {
stringDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1871 times by 2 tests
Evaluated by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
5-1871
628 lastTokenSize = qMin(maxlen, string->size() - stringOffset);-
629 ret = string->mid(stringOffset, lastTokenSize);-
630 } else {
executed 5 times by 1 test: end of block
Executed by:
  • tst_QTextStream
5
631 while (readBuffer.size() - readBufferOffset < maxlen && fillReadBuffer()) ;
executed 1867 times by 2 tests: ;
Executed by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
readBuffer.siz...ffset < maxlenDescription
TRUEevaluated 3731 times by 2 tests
Evaluated by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QTextStream
fillReadBuffer()Description
TRUEevaluated 1867 times by 2 tests
Evaluated by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 1864 times by 2 tests
Evaluated by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
7-3731
632 lastTokenSize = qMin(maxlen, readBuffer.size() - readBufferOffset);-
633 ret = readBuffer.mid(readBufferOffset, lastTokenSize);-
634 }
executed 1871 times by 2 tests: end of block
Executed by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
1871
635 consumeLastToken();-
636-
637#if defined (QTEXTSTREAM_DEBUG)-
638 qDebug("QTextStreamPrivate::read() maxlen = %d, token length = %d", maxlen, ret.length());-
639#endif-
640 return ret;
executed 1876 times by 2 tests: return ret;
Executed by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
1876
641}-
642-
643/*!-
644 \internal-
645-
646 Scans no more than \a maxlen QChars in the current buffer for the-
647 first \a delimiter. Stores a pointer to the start offset of the-
648 token in \a ptr, and the length in QChars in \a length.-
649*/-
650bool QTextStreamPrivate::scan(const QChar **ptr, int *length, int maxlen, TokenDelimiter delimiter)-
651{-
652 int totalSize = 0;-
653 int delimSize = 0;-
654 bool consumeDelimiter = false;-
655 bool foundToken = false;-
656 int startOffset = device ? readBufferOffset : stringOffset;
deviceDescription
TRUEevaluated 183752 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 24207 times by 4 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
24207-183752
657 QChar lastChar;-
658-
659 bool canStillReadFromDevice = true;-
660 do {-
661 int endOffset;-
662 const QChar *chPtr;-
663 if (device) {
deviceDescription
TRUEevaluated 186683 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 24207 times by 4 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
24207-186683
664 chPtr = readBuffer.constData();-
665 endOffset = readBuffer.size();-
666 } else {
executed 186683 times by 16 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
186683
667 chPtr = string->constData();-
668 endOffset = string->size();-
669 }
executed 24207 times by 4 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
24207
670 chPtr += startOffset;-
671-
672 for (; !foundToken && startOffset < endOffset && (!maxlen || totalSize < maxlen); ++startOffset) {
!foundTokenDescription
TRUEevaluated 4218720 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 207676 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
startOffset < endOffsetDescription
TRUEevaluated 4215516 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 3204 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
!maxlenDescription
TRUEevaluated 4164300 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 51216 times by 2 tests
Evaluated by:
  • tst_QLayout
  • tst_QTextStream
totalSize < maxlenDescription
TRUEevaluated 51206 times by 2 tests
Evaluated by:
  • tst_QLayout
  • tst_QTextStream
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTextStream
10-4218720
673 const QChar ch = *chPtr++;-
674 ++totalSize;-
675-
676 switch (delimiter) {-
677 case Space:
executed 5982 times by 4 tests: case Space:
Executed by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
5982
678 if (ch.isSpace()) {
ch.isSpace()Description
TRUEevaluated 424 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEevaluated 5558 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
424-5558
679 foundToken = true;-
680 delimSize = 1;-
681 }
executed 424 times by 3 tests: end of block
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
424
682 break;
executed 5982 times by 4 tests: break;
Executed by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
5982
683 case NotSpace:
executed 63851 times by 4 tests: case NotSpace:
Executed by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
63851
684 if (!ch.isSpace()) {
!ch.isSpace()Description
TRUEevaluated 22940 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEevaluated 40911 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
22940-40911
685 foundToken = true;-
686 delimSize = 1;-
687 }
executed 22940 times by 4 tests: end of block
Executed by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
22940
688 break;
executed 63851 times by 4 tests: break;
Executed by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
63851
689 case EndOfLine:
executed 4145673 times by 14 tests: case EndOfLine:
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
4145673
690 if (ch == QLatin1Char('\n')) {
ch == QLatin1Char('\n')Description
TRUEevaluated 184312 times by 13 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 3961361 times by 14 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
184312-3961361
691 foundToken = true;-
692 delimSize = (lastChar == QLatin1Char('\r')) ? 2 : 1;
(lastChar == Q...in1Char('\r'))Description
TRUEevaluated 75386 times by 2 tests
Evaluated by:
  • tst_QTcpSocket
  • tst_QTextStream
FALSEevaluated 108926 times by 12 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
75386-108926
693 consumeDelimiter = true;-
694 }
executed 184312 times by 13 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
184312
695 lastChar = ch;-
696 break;
executed 4145673 times by 14 tests: break;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
4145673
697 }-
698 }
executed 4214578 times by 17 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
4214578
699 } while (!foundToken
executed 210890 times by 17 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
!foundTokenDescription
TRUEevaluated 3214 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 207676 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
3214-210890
700 && (!maxlen || totalSize < maxlen)
!maxlenDescription
TRUEevaluated 3186 times by 15 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QLayout
  • tst_QTextStream
totalSize < maxlenDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QLayout
  • tst_QTextStream
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QTextStream
12-3186
701 && (device && (canStillReadFromDevice = fillReadBuffer())));
deviceDescription
TRUEevaluated 3174 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QLoggingRegistry
  • tst_QTextStream
(canStillReadF...lReadBuffer())Description
TRUEevaluated 2931 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 243 times by 6 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTextStream
28-3174
702-
703 if (totalSize == 0) {
totalSize == 0Description
TRUEevaluated 79 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 207880 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
79-207880
704#if defined (QTEXTSTREAM_DEBUG)-
705 qDebug("QTextStreamPrivate::scan() reached the end of input.");-
706#endif-
707 return false;
executed 79 times by 1 test: return false;
Executed by:
  • tst_QTextStream
79
708 }-
709-
710 // if we find a '\r' at the end of the data when reading lines,-
711 // don't make it part of the line.-
712 if (delimiter == EndOfLine && totalSize > 0 && !foundToken) {
delimiter == EndOfLineDescription
TRUEevaluated 184388 times by 14 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 23492 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
totalSize > 0Description
TRUEevaluated 184388 times by 14 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEnever evaluated
!foundTokenDescription
TRUEevaluated 76 times by 4 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTextStream
FALSEevaluated 184312 times by 13 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
0-184388
713 if (((string && stringOffset + totalSize == string->size()) || (device && device->atEnd()))
stringDescription
TRUEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QLoggingRegistry
  • tst_QTextStream
FALSEevaluated 55 times by 4 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTextStream
stringOffset +...string->size()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QLoggingRegistry
  • tst_QTextStream
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QTextStream
deviceDescription
TRUEevaluated 55 times by 4 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTextStream
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QTextStream
device->atEnd()Description
TRUEevaluated 53 times by 4 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTextStream
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
2-55
714 && lastChar == QLatin1Char('\r')) {
lastChar == QLatin1Char('\r')Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 58 times by 4 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTextStream
11-58
715 consumeDelimiter = true;-
716 ++delimSize;-
717 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_QTextStream
11
718 }
executed 76 times by 4 tests: end of block
Executed by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTextStream
76
719-
720 // set the read offset and length of the token-
721 if (length)
lengthDescription
TRUEevaluated 184841 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 23039 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
23039-184841
722 *length = totalSize - delimSize;
executed 184841 times by 17 tests: *length = totalSize - delimSize;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
184841
723 if (ptr)
ptrDescription
TRUEevaluated 184841 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 23039 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
23039-184841
724 *ptr = readPtr();
executed 184841 times by 17 tests: *ptr = readPtr();
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
184841
725-
726 // update last token size. the callee will call consumeLastToken() when-
727 // done.-
728 lastTokenSize = totalSize;-
729 if (!consumeDelimiter)
!consumeDelimiterDescription
TRUEevaluated 23557 times by 7 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEevaluated 184323 times by 13 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
23557-184323
730 lastTokenSize -= delimSize;
executed 23557 times by 7 tests: lastTokenSize -= delimSize;
Executed by:
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
23557
731-
732#if defined (QTEXTSTREAM_DEBUG)-
733 qDebug("QTextStreamPrivate::scan(%p, %p, %d, %x) token length = %d, delimiter = %d",-
734 ptr, length, maxlen, (int)delimiter, totalSize - delimSize, delimSize);-
735#endif-
736 return true;
executed 207880 times by 17 tests: return true;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
207880
737}-
738-
739/*!-
740 \internal-
741*/-
742inline const QChar *QTextStreamPrivate::readPtr() const-
743{-
744 Q_ASSERT(readBufferOffset <= readBuffer.size());-
745 if (string)
stringDescription
TRUEevaluated 24368 times by 4 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
FALSEevaluated 230089 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
24368-230089
746 return string->constData() + stringOffset;
executed 24368 times by 4 tests: return string->constData() + stringOffset;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
24368
747 return readBuffer.constData() + readBufferOffset;
executed 230089 times by 16 tests: return readBuffer.constData() + readBufferOffset;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
230089
748}-
749-
750/*!-
751 \internal-
752*/-
753inline void QTextStreamPrivate::consumeLastToken()-
754{-
755 if (lastTokenSize)
lastTokenSizeDescription
TRUEevaluated 208105 times by 18 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 867 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
867-208105
756 consume(lastTokenSize);
executed 208105 times by 18 tests: consume(lastTokenSize);
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
208105
757 lastTokenSize = 0;-
758}
executed 208972 times by 18 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
208972
759-
760/*!-
761 \internal-
762*/-
763inline void QTextStreamPrivate::consume(int size)-
764{-
765#if defined (QTEXTSTREAM_DEBUG)-
766 qDebug("QTextStreamPrivate::consume(%d)", size);-
767#endif-
768 if (string) {
stringDescription
TRUEevaluated 24412 times by 4 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
FALSEevaluated 253309 times by 17 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
24412-253309
769 stringOffset += size;-
770 if (stringOffset > string->size())
stringOffset > string->size()Description
TRUEnever evaluated
FALSEevaluated 24412 times by 4 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
0-24412
771 stringOffset = string->size();
never executed: stringOffset = string->size();
0
772 } else {
executed 24412 times by 4 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QString
  • tst_QTextStream
24412
773 readBufferOffset += size;-
774 if (readBufferOffset >= readBuffer.size()) {
readBufferOffs...dBuffer.size()Description
TRUEevaluated 2698 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 250611 times by 10 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QSplitter
  • tst_QString
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
2698-250611
775 readBufferOffset = 0;-
776 readBuffer.clear();-
777 saveConverterState(device->pos());-
778 } else if (readBufferOffset > QTEXTSTREAM_BUFFERSIZE) {
executed 2698 times by 16 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
readBufferOffs...EAM_BUFFERSIZEDescription
TRUEevaluated 1300 times by 3 tests
Evaluated by:
  • tst_QLayout
  • tst_QTextStream
  • tst_QTimeZone
FALSEevaluated 249311 times by 10 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QSplitter
  • tst_QString
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
1300-249311
779 readBuffer = readBuffer.remove(0,readBufferOffset);-
780 readConverterSavedStateOffset += readBufferOffset;-
781 readBufferOffset = 0;-
782 }
executed 1300 times by 3 tests: end of block
Executed by:
  • tst_QLayout
  • tst_QTextStream
  • tst_QTimeZone
1300
783 }
executed 253309 times by 17 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
253309
784}-
785-
786/*!-
787 \internal-
788*/-
789inline void QTextStreamPrivate::saveConverterState(qint64 newPos)-
790{-
791#ifndef QT_NO_TEXTCODEC-
792 if (readConverterState.d) {
readConverterState.dDescription
TRUEnever evaluated
FALSEevaluated 2698 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
0-2698
793 // converter cannot be copied, so don't save anything-
794 // don't update readBufferStartDevicePos either-
795 return;
never executed: return;
0
796 }-
797-
798 if (!readConverterSavedState)
!readConverterSavedStateDescription
TRUEevaluated 2666 times by 16 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
32-2666
799 readConverterSavedState = new QTextCodec::ConverterState;
executed 2666 times by 16 tests: readConverterSavedState = new QTextCodec::ConverterState;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
2666
800 copyConverterStateHelper(readConverterSavedState, &readConverterState);-
801#endif-
802-
803 readBufferStartDevicePos = newPos;-
804 readConverterSavedStateOffset = 0;-
805}
executed 2698 times by 16 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSettings
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
2698
806-
807/*!-
808 \internal-
809*/-
810inline void QTextStreamPrivate::restoreToSavedConverterState()-
811{-
812#ifndef QT_NO_TEXTCODEC-
813 if (readConverterSavedState) {
readConverterSavedStateDescription
TRUEnever evaluated
FALSEevaluated 1775 times by 1 test
Evaluated by:
  • tst_QTextStream
0-1775
814 // we have a saved state-
815 // that means the converter can be copied-
816 copyConverterStateHelper(&readConverterState, readConverterSavedState);-
817 } else {
never executed: end of block
0
818 // the only state we could save was the initial-
819 // so reset to that-
820 resetCodecConverterStateHelper(&readConverterState);-
821 }
executed 1775 times by 1 test: end of block
Executed by:
  • tst_QTextStream
1775
822#endif-
823}-
824-
825/*!-
826 \internal-
827*/-
828void QTextStreamPrivate::write(const QChar *data, int len)-
829{-
830 if (string) {
stringDescription
TRUEevaluated 162509 times by 79 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • ...
FALSEevaluated 33084 times by 13 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
33084-162509
831 // ### What about seek()??-
832 string->append(data, len);-
833 } else {
executed 162509 times by 79 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • ...
162509
834 writeBuffer.append(data, len);-
835 if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE)
writeBuffer.si...EAM_BUFFERSIZEDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QLocalSocket
  • tst_QTextStream
FALSEevaluated 33080 times by 13 tests
Evaluated by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
4-33080
836 flushWriteBuffer();
executed 4 times by 2 tests: flushWriteBuffer();
Executed by:
  • tst_QLocalSocket
  • tst_QTextStream
4
837 }
executed 33084 times by 13 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
33084
838}-
839-
840/*!-
841 \internal-
842*/-
843inline void QTextStreamPrivate::write(QChar ch)-
844{-
845 if (string) {
stringDescription
TRUEevaluated 94016 times by 75 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • ...
FALSEevaluated 70541 times by 11 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
70541-94016
846 // ### What about seek()??-
847 string->append(ch);-
848 } else {
executed 94016 times by 75 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • ...
94016
849 writeBuffer += ch;-
850 if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE)
writeBuffer.si...EAM_BUFFERSIZEDescription
TRUEnever evaluated
FALSEevaluated 70541 times by 11 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
0-70541
851 flushWriteBuffer();
never executed: flushWriteBuffer();
0
852 }
executed 70541 times by 11 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLocalSocket
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
70541
853}-
854-
855/*!-
856 \internal-
857*/-
858void QTextStreamPrivate::write(QLatin1String data)-
859{-
860 if (string) {
stringDescription
TRUEevaluated 41996 times by 19 tests
Evaluated by:
  • tst_QDBusXmlParser
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QLogging
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QOpenGlConfig
  • tst_QString
  • tst_QTextStream
  • tst_QTreeView
  • tst_QVariant
  • tst_QWidget_window
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_Selftests
  • tst_selftests - unknown status
FALSEevaluated 18796 times by 14 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
18796-41996
861 // ### What about seek()??-
862 string->append(data);-
863 } else {
executed 41996 times by 19 tests: end of block
Executed by:
  • tst_QDBusXmlParser
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QLogging
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QOpenGlConfig
  • tst_QString
  • tst_QTextStream
  • tst_QTreeView
  • tst_QVariant
  • tst_QWidget_window
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_Selftests
  • tst_selftests - unknown status
41996
864 writeBuffer += data;-
865 if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE)
writeBuffer.si...EAM_BUFFERSIZEDescription
TRUEnever evaluated
FALSEevaluated 18796 times by 14 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
0-18796
866 flushWriteBuffer();
never executed: flushWriteBuffer();
0
867 }
executed 18796 times by 14 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
18796
868}-
869-
870/*!-
871 \internal-
872*/-
873void QTextStreamPrivate::writePadding(int len)-
874{-
875 if (string) {
stringDescription
TRUEevaluated 72 times by 4 tests
Evaluated by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
FALSEevaluated 4406 times by 1 test
Evaluated by:
  • tst_QTextStream
72-4406
876 // ### What about seek()??-
877 string->resize(string->size() + len, params.padChar);-
878 } else {
executed 72 times by 4 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
72
879 writeBuffer.resize(writeBuffer.size() + len, params.padChar);-
880 if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE)
writeBuffer.si...EAM_BUFFERSIZEDescription
TRUEnever evaluated
FALSEevaluated 4406 times by 1 test
Evaluated by:
  • tst_QTextStream
0-4406
881 flushWriteBuffer();
never executed: flushWriteBuffer();
0
882 }
executed 4406 times by 1 test: end of block
Executed by:
  • tst_QTextStream
4406
883}-
884-
885/*!-
886 \internal-
887*/-
888inline bool QTextStreamPrivate::getChar(QChar *ch)-
889{-
890 if ((string && stringOffset == string->size())
stringDescription
TRUEevaluated 250 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 69793 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
stringOffset == string->size()Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 239 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
11-69793
891 || (device && readBuffer.isEmpty() && !fillReadBuffer())) {
deviceDescription
TRUEevaluated 69793 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
FALSEevaluated 239 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
readBuffer.isEmpty()Description
TRUEevaluated 417 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
FALSEevaluated 69376 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
!fillReadBuffer()Description
TRUEevaluated 416 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSplitter
1-69793
892 if (ch)
chDescription
TRUEevaluated 427 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEnever evaluated
0-427
893 *ch = 0;
executed 427 times by 2 tests: *ch = 0;
Executed by:
  • tst_QString
  • tst_QTextStream
427
894 return false;
executed 427 times by 2 tests: return false;
Executed by:
  • tst_QString
  • tst_QTextStream
427
895 }-
896 if (ch)
chDescription
TRUEevaluated 69616 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEnever evaluated
0-69616
897 *ch = *readPtr();
executed 69616 times by 3 tests: *ch = *readPtr();
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
69616
898 consume(1);-
899 return true;
executed 69616 times by 3 tests: return true;
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
69616
900}-
901-
902/*!-
903 \internal-
904*/-
905inline void QTextStreamPrivate::ungetChar(QChar ch)-
906{-
907 if (string) {
stringDescription
TRUEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 39049 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
51-39049
908 if (stringOffset == 0)
stringOffset == 0Description
TRUEnever evaluated
FALSEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
0-51
909 string->prepend(ch);
never executed: string->prepend(ch);
0
910 else-
911 (*string)[--stringOffset] = ch;
executed 51 times by 2 tests: (*string)[--stringOffset] = ch;
Executed by:
  • tst_QString
  • tst_QTextStream
51
912 return;
executed 51 times by 2 tests: return;
Executed by:
  • tst_QString
  • tst_QTextStream
51
913 }-
914-
915 if (readBufferOffset == 0) {
readBufferOffset == 0Description
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
FALSEevaluated 39004 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
45-39004
916 readBuffer.prepend(ch);-
917 return;
executed 45 times by 2 tests: return;
Executed by:
  • tst_QSplitter
  • tst_QTextStream
45
918 }-
919-
920 readBuffer[--readBufferOffset] = ch;-
921}
executed 39004 times by 2 tests: end of block
Executed by:
  • tst_QSplitter
  • tst_QTextStream
39004
922-
923/*!-
924 \internal-
925*/-
926inline void QTextStreamPrivate::putChar(QChar ch)-
927{-
928 if (params.fieldWidth > 0)
params.fieldWidth > 0Description
TRUEevaluated 2004 times by 2 tests
Evaluated by:
  • tst_QGuiVariant
  • tst_QTextStream
FALSEevaluated 164557 times by 82 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileInfo
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • tst_QHostInfo
  • ...
2004-164557
929 putString(&ch, 1);
executed 2004 times by 2 tests: putString(&ch, 1);
Executed by:
  • tst_QGuiVariant
  • tst_QTextStream
2004
930 else-
931 write(ch);
executed 164428 times by 82 tests: write(ch);
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileInfo
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • tst_QHostInfo
  • ...
164428
932}-
933-
934-
935/*!-
936 \internal-
937*/-
938QTextStreamPrivate::PaddingResult QTextStreamPrivate::padding(int len) const-
939{-
940 Q_ASSERT(params.fieldWidth > len); // calling padding() when no padding is needed is an error-
941-
942 int left = 0, right = 0;-
943-
944 const int padSize = params.fieldWidth - len;-
945-
946 switch (params.fieldAlignment) {-
947 case QTextStream::AlignLeft:
never executed: case QTextStream::AlignLeft:
0
948 right = padSize;-
949 break;
never executed: break;
0
950 case QTextStream::AlignRight:
executed 2235 times by 4 tests: case QTextStream::AlignRight:
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
2235
951 case QTextStream::AlignAccountingStyle:
executed 4 times by 1 test: case QTextStream::AlignAccountingStyle:
Executed by:
  • tst_QTextStream
4
952 left = padSize;-
953 break;
executed 2239 times by 4 tests: break;
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
2239
954 case QTextStream::AlignCenter:
never executed: case QTextStream::AlignCenter:
0
955 left = padSize/2;-
956 right = padSize - padSize/2;-
957 break;
never executed: break;
0
958 }-
959 const PaddingResult result = { left, right };-
960 return result;
executed 2239 times by 4 tests: return result;
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
2239
961}-
962-
963/*!-
964 \internal-
965*/-
966void QTextStreamPrivate::putString(const QChar *data, int len, bool number)-
967{-
968 if (Q_UNLIKELY(params.fieldWidth > len)) {
__builtin_expe...> len), false)Description
TRUEevaluated 2237 times by 4 tests
Evaluated by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
FALSEevaluated 149522 times by 86 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
2237-149522
969-
970 // handle padding:-
971-
972 const PaddingResult pad = padding(len);-
973-
974 if (params.fieldAlignment == QTextStream::AlignAccountingStyle && number) {
params.fieldAl...ccountingStyleDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 2235 times by 4 tests
Evaluated by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
numberDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
0-2235
975 const QChar sign = len > 0 ? data[0] : QChar();
len > 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
0-2
976 if (sign == locale.negativeSign() || sign == locale.positiveSign()) {
sign == locale.negativeSign()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
sign == locale.positiveSign()Description
TRUEnever evaluated
FALSEnever evaluated
0-2
977 // write the sign before the padding, then skip it later-
978 write(&sign, 1);-
979 ++data;-
980 --len;-
981 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTextStream
2
982 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTextStream
2
983-
984 writePadding(pad.left);-
985 write(data, len);-
986 writePadding(pad.right);-
987 } else {
executed 2237 times by 4 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
2237
988 write(data, len);-
989 }
executed 149522 times by 86 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
149522
990}-
991-
992/*!-
993 \internal-
994*/-
995void QTextStreamPrivate::putString(QLatin1String data, bool number)-
996{-
997 if (Q_UNLIKELY(params.fieldWidth > data.size())) {
__builtin_expe...ize()), false)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 60790 times by 30 tests
Evaluated by:
  • tst_QDBusXmlParser
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QOpenGlConfig
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QTreeView
  • tst_QVariant
  • tst_QWidget_window
  • tst_QXmlSimpleReader
  • ...
2-60790
998-
999 // handle padding-
1000-
1001 const PaddingResult pad = padding(data.size());-
1002-
1003 if (params.fieldAlignment == QTextStream::AlignAccountingStyle && number) {
params.fieldAl...ccountingStyleDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
numberDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
0-2
1004 const QChar sign = data.size() > 0 ? QLatin1Char(*data.data()) : QChar();
data.size() > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1005 if (sign == locale.negativeSign() || sign == locale.positiveSign()) {
sign == locale.negativeSign()Description
TRUEnever evaluated
FALSEnever evaluated
sign == locale.positiveSign()Description
TRUEnever evaluated
FALSEnever evaluated
0
1006 // write the sign before the padding, then skip it later-
1007 write(&sign, 1);-
1008 data = QLatin1String(data.data() + 1, data.size() - 1);-
1009 }
never executed: end of block
0
1010 }
never executed: end of block
0
1011-
1012 writePadding(pad.left);-
1013 write(data);-
1014 writePadding(pad.right);-
1015 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTextStream
2
1016 write(data);-
1017 }
executed 60790 times by 30 tests: end of block
Executed by:
  • tst_QDBusXmlParser
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeyEvent
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QOpenGlConfig
  • tst_QSaveFile
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
  • tst_QTreeView
  • tst_QVariant
  • tst_QWidget_window
  • tst_QXmlSimpleReader
  • ...
60790
1018}-
1019-
1020/*!-
1021 Constructs a QTextStream. Before you can use it for reading or-
1022 writing, you must assign a device or a string.-
1023-
1024 \sa setDevice(), setString()-
1025*/-
1026QTextStream::QTextStream()-
1027 : d_ptr(new QTextStreamPrivate(this))-
1028{-
1029#if defined (QTEXTSTREAM_DEBUG)-
1030 qDebug("QTextStream::QTextStream()");-
1031#endif-
1032 Q_D(QTextStream);-
1033 d->status = Ok;-
1034}
executed 15 times by 1 test: end of block
Executed by:
  • tst_QTextStream
15
1035-
1036/*!-
1037 Constructs a QTextStream that operates on \a device.-
1038*/-
1039QTextStream::QTextStream(QIODevice *device)-
1040 : d_ptr(new QTextStreamPrivate(this))-
1041{-
1042#if defined (QTEXTSTREAM_DEBUG)-
1043 qDebug("QTextStream::QTextStream(QIODevice *device == *%p)",-
1044 device);-
1045#endif-
1046 Q_D(QTextStream);-
1047 d->device = device;-
1048#ifndef QT_NO_QOBJECT-
1049 d->deviceClosedNotifier.setupDevice(this, d->device);-
1050#endif-
1051 d->status = Ok;-
1052}
executed 2874 times by 22 tests: end of block
Executed by:
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSaveFile
  • tst_QSettings
  • tst_QSplitter
  • tst_QString
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_QXmlSimpleReader
  • tst_qmakelib
  • tst_qstandardpaths
2874
1053-
1054/*!-
1055 Constructs a QTextStream that operates on \a string, using \a-
1056 openMode to define the open mode.-
1057*/-
1058QTextStream::QTextStream(QString *string, QIODevice::OpenMode openMode)-
1059 : d_ptr(new QTextStreamPrivate(this))-
1060{-
1061#if defined (QTEXTSTREAM_DEBUG)-
1062 qDebug("QTextStream::QTextStream(QString *string == *%p, openMode = %d)",-
1063 string, int(openMode));-
1064#endif-
1065 Q_D(QTextStream);-
1066 d->string = string;-
1067 d->stringOpenMode = openMode;-
1068 d->status = Ok;-
1069}
executed 75486 times by 80 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • ...
75486
1070-
1071/*!-
1072 Constructs a QTextStream that operates on \a array, using \a-
1073 openMode to define the open mode. Internally, the array is wrapped-
1074 by a QBuffer.-
1075*/-
1076QTextStream::QTextStream(QByteArray *array, QIODevice::OpenMode openMode)-
1077 : d_ptr(new QTextStreamPrivate(this))-
1078{-
1079#if defined (QTEXTSTREAM_DEBUG)-
1080 qDebug("QTextStream::QTextStream(QByteArray *array == *%p, openMode = %d)",-
1081 array, int(openMode));-
1082#endif-
1083 Q_D(QTextStream);-
1084 d->device = new QBuffer(array);-
1085 d->device->open(openMode);-
1086 d->deleteDevice = true;-
1087#ifndef QT_NO_QOBJECT-
1088 d->deviceClosedNotifier.setupDevice(this, d->device);-
1089#endif-
1090 d->status = Ok;-
1091}
executed 830 times by 6 tests: end of block
Executed by:
  • tst_QKeyEvent
  • tst_QString
  • tst_QTextStream
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
830
1092-
1093/*!-
1094 Constructs a QTextStream that operates on \a array, using \a-
1095 openMode to define the open mode. The array is accessed as-
1096 read-only, regardless of the values in \a openMode.-
1097-
1098 This constructor is convenient for working on constant-
1099 strings. Example:-
1100-
1101 \snippet code/src_corelib_io_qtextstream.cpp 3-
1102*/-
1103QTextStream::QTextStream(const QByteArray &array, QIODevice::OpenMode openMode)-
1104 : d_ptr(new QTextStreamPrivate(this))-
1105{-
1106#if defined (QTEXTSTREAM_DEBUG)-
1107 qDebug("QTextStream::QTextStream(const QByteArray &array == *(%p), openMode = %d)",-
1108 &array, int(openMode));-
1109#endif-
1110 QBuffer *buffer = new QBuffer;-
1111 buffer->setData(array);-
1112 buffer->open(openMode);-
1113-
1114 Q_D(QTextStream);-
1115 d->device = buffer;-
1116 d->deleteDevice = true;-
1117#ifndef QT_NO_QOBJECT-
1118 d->deviceClosedNotifier.setupDevice(this, d->device);-
1119#endif-
1120 d->status = Ok;-
1121}
executed 16 times by 3 tests: end of block
Executed by:
  • tst_QLoggingRegistry
  • tst_QTextStream
  • tst_qmakelib
16
1122-
1123/*!-
1124 Constructs a QTextStream that operates on \a fileHandle, using \a-
1125 openMode to define the open mode. Internally, a QFile is created-
1126 to handle the FILE pointer.-
1127-
1128 This constructor is useful for working directly with the common-
1129 FILE based input and output streams: stdin, stdout and stderr. Example:-
1130-
1131 \snippet code/src_corelib_io_qtextstream.cpp 4-
1132*/-
1133-
1134QTextStream::QTextStream(FILE *fileHandle, QIODevice::OpenMode openMode)-
1135 : d_ptr(new QTextStreamPrivate(this))-
1136{-
1137#if defined (QTEXTSTREAM_DEBUG)-
1138 qDebug("QTextStream::QTextStream(FILE *fileHandle = %p, openMode = %d)",-
1139 fileHandle, int(openMode));-
1140#endif-
1141 QFile *file = new QFile;-
1142 file->open(fileHandle, openMode);-
1143-
1144 Q_D(QTextStream);-
1145 d->device = file;-
1146 d->deleteDevice = true;-
1147#ifndef QT_NO_QOBJECT-
1148 d->deviceClosedNotifier.setupDevice(this, d->device);-
1149#endif-
1150 d->status = Ok;-
1151}
never executed: end of block
0
1152-
1153/*!-
1154 Destroys the QTextStream.-
1155-
1156 If the stream operates on a device, flush() will be called-
1157 implicitly. Otherwise, the device is unaffected.-
1158*/-
1159QTextStream::~QTextStream()-
1160{-
1161 Q_D(QTextStream);-
1162#if defined (QTEXTSTREAM_DEBUG)-
1163 qDebug("QTextStream::~QTextStream()");-
1164#endif-
1165 if (!d->writeBuffer.isEmpty())
!d->writeBuffer.isEmpty()Description
TRUEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QKeyEvent
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
FALSEevaluated 79200 times by 95 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
21-79200
1166 d->flushWriteBuffer();
executed 21 times by 4 tests: d->flushWriteBuffer();
Executed by:
  • tst_QKeyEvent
  • tst_QSettings
  • tst_QString
  • tst_QTextStream
21
1167}
executed 79221 times by 96 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QBuffer
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
79221
1168-
1169/*!-
1170 Resets QTextStream's formatting options, bringing it back to its-
1171 original constructed state. The device, string and any buffered-
1172 data is left untouched.-
1173*/-
1174void QTextStream::reset()-
1175{-
1176 Q_D(QTextStream);-
1177-
1178 d->params.reset();-
1179}
executed 924 times by 13 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QLocalSocket
  • tst_QMetaObject
  • tst_QNetworkConfigurationManager
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslSocket
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QVariant
  • tst_QWidget
924
1180-
1181/*!-
1182 Flushes any buffered data waiting to be written to the device.-
1183-
1184 If QTextStream operates on a string, this function does nothing.-
1185*/-
1186void QTextStream::flush()-
1187{-
1188 Q_D(QTextStream);-
1189 d->flushWriteBuffer();-
1190}
executed 75666 times by 21 tests: end of block
Executed by:
  • tst_QDBusXmlParser
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QSaveFile
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_qdbusxml2cpp - unknown status
  • tst_qtextstream - unknown status
75666
1191-
1192/*!-
1193 Seeks to the position \a pos in the device. Returns \c true on-
1194 success; otherwise returns \c false.-
1195*/-
1196bool QTextStream::seek(qint64 pos)-
1197{-
1198 Q_D(QTextStream);-
1199 d->lastTokenSize = 0;-
1200-
1201 if (d->device) {
d->deviceDescription
TRUEevaluated 214471 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_QTextStream
47-214471
1202 // Empty the write buffer-
1203 d->flushWriteBuffer();-
1204 if (!d->device->seek(pos))
!d->device->seek(pos)Description
TRUEnever evaluated
FALSEevaluated 214471 times by 1 test
Evaluated by:
  • tst_QTextStream
0-214471
1205 return false;
never executed: return false;
0
1206 d->resetReadBuffer();-
1207-
1208#ifndef QT_NO_TEXTCODEC-
1209 // Reset the codec converter states.-
1210 resetCodecConverterStateHelper(&d->readConverterState);-
1211 resetCodecConverterStateHelper(&d->writeConverterState);-
1212 delete d->readConverterSavedState;-
1213 d->readConverterSavedState = 0;-
1214 d->writeConverterState.flags |= QTextCodec::IgnoreHeader;-
1215#endif-
1216 return true;
executed 214471 times by 1 test: return true;
Executed by:
  • tst_QTextStream
214471
1217 }-
1218-
1219 // string-
1220 if (d->string && pos <= d->string->size()) {
d->stringDescription
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
pos <= d->string->size()Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
0-47
1221 d->stringOffset = int(pos);-
1222 return true;
executed 47 times by 1 test: return true;
Executed by:
  • tst_QTextStream
47
1223 }-
1224 return false;
never executed: return false;
0
1225}-
1226-
1227/*!-
1228 \since 4.2-
1229-
1230 Returns the device position corresponding to the current position of the-
1231 stream, or -1 if an error occurs (e.g., if there is no device or string,-
1232 or if there's a device error).-
1233-
1234 Because QTextStream is buffered, this function may have to-
1235 seek the device to reconstruct a valid device position. This-
1236 operation can be expensive, so you may want to avoid calling this-
1237 function in a tight loop.-
1238-
1239 \sa seek()-
1240*/-
1241qint64 QTextStream::pos() const-
1242{-
1243 Q_D(const QTextStream);-
1244 if (d->device) {
d->deviceDescription
TRUEevaluated 216444 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QTextStream
36-216444
1245 // Cutoff-
1246 if (d->readBuffer.isEmpty())
d->readBuffer.isEmpty()Description
TRUEevaluated 214669 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1775 times by 1 test
Evaluated by:
  • tst_QTextStream
1775-214669
1247 return d->device->pos();
executed 214669 times by 1 test: return d->device->pos();
Executed by:
  • tst_QTextStream
214669
1248 if (d->device->isSequential())
d->device->isSequential()Description
TRUEnever evaluated
FALSEevaluated 1775 times by 1 test
Evaluated by:
  • tst_QTextStream
0-1775
1249 return 0;
never executed: return 0;
0
1250-
1251 // Seek the device-
1252 if (!d->device->seek(d->readBufferStartDevicePos))
!d->device->se...tartDevicePos)Description
TRUEnever evaluated
FALSEevaluated 1775 times by 1 test
Evaluated by:
  • tst_QTextStream
0-1775
1253 return qint64(-1);
never executed: return qint64(-1);
0
1254-
1255 // Reset the read buffer-
1256 QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d);-
1257 thatd->readBuffer.clear();-
1258-
1259#ifndef QT_NO_TEXTCODEC-
1260 thatd->restoreToSavedConverterState();-
1261 if (d->readBufferStartDevicePos == 0)
d->readBufferS...DevicePos == 0Description
TRUEevaluated 1760 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QTextStream
15-1760
1262 thatd->autoDetectUnicode = true;
executed 1760 times by 1 test: thatd->autoDetectUnicode = true;
Executed by:
  • tst_QTextStream
1760
1263#endif-
1264-
1265 // Rewind the device to get to the current position Ensure that-
1266 // readBufferOffset is unaffected by fillReadBuffer()-
1267 int oldReadBufferOffset = d->readBufferOffset + d->readConverterSavedStateOffset;-
1268 while (d->readBuffer.size() < oldReadBufferOffset) {
d->readBuffer....adBufferOffsetDescription
TRUEevaluated 41035294 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1775 times by 1 test
Evaluated by:
  • tst_QTextStream
1775-41035294
1269 if (!thatd->fillReadBuffer(1))
!thatd->fillReadBuffer(1)Description
TRUEnever evaluated
FALSEevaluated 41035294 times by 1 test
Evaluated by:
  • tst_QTextStream
0-41035294
1270 return qint64(-1);
never executed: return qint64(-1);
0
1271 }
executed 41035294 times by 1 test: end of block
Executed by:
  • tst_QTextStream
41035294
1272 thatd->readBufferOffset = oldReadBufferOffset;-
1273 thatd->readConverterSavedStateOffset = 0;-
1274-
1275 // Return the device position.-
1276 return d->device->pos();
executed 1775 times by 1 test: return d->device->pos();
Executed by:
  • tst_QTextStream
1775
1277 }-
1278-
1279 if (d->string)
d->stringDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
0-36
1280 return d->stringOffset;
executed 36 times by 1 test: return d->stringOffset;
Executed by:
  • tst_QTextStream
36
1281-
1282 qWarning("QTextStream::pos: no device");-
1283 return qint64(-1);
never executed: return qint64(-1);
0
1284}-
1285-
1286/*!-
1287 Reads and discards whitespace from the stream until either a-
1288 non-space character is detected, or until atEnd() returns-
1289 true. This function is useful when reading a stream character by-
1290 character.-
1291-
1292 Whitespace characters are all characters for which-
1293 QChar::isSpace() returns \c true.-
1294-
1295 \sa operator>>()-
1296*/-
1297void QTextStream::skipWhiteSpace()-
1298{-
1299 Q_D(QTextStream);-
1300 CHECK_VALID_STREAM(Q_VOID);
never executed: return ;
!d->stringDescription
TRUEevaluated 405 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTextStream
!d->deviceDescription
TRUEnever evaluated
FALSEevaluated 405 times by 2 tests
Evaluated by:
  • tst_QSplitter
  • tst_QTextStream
0-405
1301 d->scan(0, 0, 0, QTextStreamPrivate::NotSpace);-
1302 d->consumeLastToken();-
1303}
executed 408 times by 2 tests: end of block
Executed by:
  • tst_QSplitter
  • tst_QTextStream
408
1304-
1305/*!-
1306 Sets the current device to \a device. If a device has already been-
1307 assigned, QTextStream will call flush() before the old device is-
1308 replaced.-
1309-
1310 \note This function resets locale to the default locale ('C')-
1311 and codec to the default codec, QTextCodec::codecForLocale().-
1312-
1313 \sa device(), setString()-
1314*/-
1315void QTextStream::setDevice(QIODevice *device)-
1316{-
1317 Q_D(QTextStream);-
1318 flush();-
1319 if (d->deleteDevice) {
d->deleteDeviceDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTextStream
1-10
1320#ifndef QT_NO_QOBJECT-
1321 d->deviceClosedNotifier.disconnect();-
1322#endif-
1323 delete d->device;-
1324 d->deleteDevice = false;-
1325 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTextStream
1
1326-
1327 d->reset();-
1328 d->status = Ok;-
1329 d->device = device;-
1330 d->resetReadBuffer();-
1331#ifndef QT_NO_QOBJECT-
1332 d->deviceClosedNotifier.setupDevice(this, d->device);-
1333#endif-
1334}
executed 11 times by 1 test: end of block
Executed by:
  • tst_QTextStream
11
1335-
1336/*!-
1337 Returns the current device associated with the QTextStream,-
1338 or 0 if no device has been assigned.-
1339-
1340 \sa setDevice(), string()-
1341*/-
1342QIODevice *QTextStream::device() const-
1343{-
1344 Q_D(const QTextStream);-
1345 return d->device;
executed 3 times by 1 test: return d->device;
Executed by:
  • tst_QTextStream
3
1346}-
1347-
1348/*!-
1349 Sets the current string to \a string, using the given \a-
1350 openMode. If a device has already been assigned, QTextStream will-
1351 call flush() before replacing it.-
1352-
1353 \sa string(), setDevice()-
1354*/-
1355void QTextStream::setString(QString *string, QIODevice::OpenMode openMode)-
1356{-
1357 Q_D(QTextStream);-
1358 flush();-
1359 if (d->deleteDevice) {
d->deleteDeviceDescription
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QTextStream
0-7
1360#ifndef QT_NO_QOBJECT-
1361 d->deviceClosedNotifier.disconnect();-
1362 d->device->blockSignals(true);-
1363#endif-
1364 delete d->device;-
1365 d->deleteDevice = false;-
1366 }
never executed: end of block
0
1367-
1368 d->reset();-
1369 d->status = Ok;-
1370 d->string = string;-
1371 d->stringOpenMode = openMode;-
1372}
executed 7 times by 1 test: end of block
Executed by:
  • tst_QTextStream
7
1373-
1374/*!-
1375 Returns the current string assigned to the QTextStream, or 0 if no-
1376 string has been assigned.-
1377-
1378 \sa setString(), device()-
1379*/-
1380QString *QTextStream::string() const-
1381{-
1382 Q_D(const QTextStream);-
1383 return d->string;
executed 1 time by 1 test: return d->string;
Executed by:
  • tst_QTextStream
1
1384}-
1385-
1386/*!-
1387 Sets the field alignment to \a mode. When used together with-
1388 setFieldWidth(), this function allows you to generate formatted-
1389 output with text aligned to the left, to the right or center-
1390 aligned.-
1391-
1392 \sa fieldAlignment(), setFieldWidth()-
1393*/-
1394void QTextStream::setFieldAlignment(FieldAlignment mode)-
1395{-
1396 Q_D(QTextStream);-
1397 d->params.fieldAlignment = mode;-
1398}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QTextStream
9
1399-
1400/*!-
1401 Returns the current field alignment.-
1402-
1403 \sa setFieldAlignment(), fieldWidth()-
1404*/-
1405QTextStream::FieldAlignment QTextStream::fieldAlignment() const-
1406{-
1407 Q_D(const QTextStream);-
1408 return d->params.fieldAlignment;
executed 4 times by 1 test: return d->params.fieldAlignment;
Executed by:
  • tst_QTextStream
4
1409}-
1410-
1411/*!-
1412 Sets the pad character to \a ch. The default value is the ASCII-
1413 space character (' '), or QChar(0x20). This character is used to-
1414 fill in the space in fields when generating text.-
1415-
1416 Example:-
1417-
1418 \snippet code/src_corelib_io_qtextstream.cpp 5-
1419-
1420 The string \c s contains:-
1421-
1422 \snippet code/src_corelib_io_qtextstream.cpp 6-
1423-
1424 \sa padChar(), setFieldWidth()-
1425*/-
1426void QTextStream::setPadChar(QChar ch)-
1427{-
1428 Q_D(QTextStream);-
1429 d->params.padChar = ch;-
1430}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QTextStream
9
1431-
1432/*!-
1433 Returns the current pad character.-
1434-
1435 \sa setPadChar(), setFieldWidth()-
1436*/-
1437QChar QTextStream::padChar() const-
1438{-
1439 Q_D(const QTextStream);-
1440 return d->params.padChar;
executed 2 times by 1 test: return d->params.padChar;
Executed by:
  • tst_QTextStream
2
1441}-
1442-
1443/*!-
1444 Sets the current field width to \a width. If \a width is 0 (the-
1445 default), the field width is equal to the length of the generated-
1446 text.-
1447-
1448 \note The field width applies to every element appended to this-
1449 stream after this function has been called (e.g., it also pads-
1450 endl). This behavior is different from similar classes in the STL,-
1451 where the field width only applies to the next element.-
1452-
1453 \sa fieldWidth(), setPadChar()-
1454*/-
1455void QTextStream::setFieldWidth(int width)-
1456{-
1457 Q_D(QTextStream);-
1458 d->params.fieldWidth = width;-
1459}
executed 31 times by 4 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkInterface
  • tst_QTextStream
31
1460-
1461/*!-
1462 Returns the current field width.-
1463-
1464 \sa setFieldWidth()-
1465*/-
1466int QTextStream::fieldWidth() const-
1467{-
1468 Q_D(const QTextStream);-
1469 return d->params.fieldWidth;
executed 3 times by 1 test: return d->params.fieldWidth;
Executed by:
  • tst_QTextStream
3
1470}-
1471-
1472/*!-
1473 Sets the current number flags to \a flags. \a flags is a set of-
1474 flags from the NumberFlag enum, and describes options for-
1475 formatting generated code (e.g., whether or not to always write-
1476 the base or sign of a number).-
1477-
1478 \sa numberFlags(), setIntegerBase(), setRealNumberNotation()-
1479*/-
1480void QTextStream::setNumberFlags(NumberFlags flags)-
1481{-
1482 Q_D(QTextStream);-
1483 d->params.numberFlags = flags;-
1484}
executed 103 times by 4 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QNetworkConfigurationManager
  • tst_QTextStream
103
1485-
1486/*!-
1487 Returns the current number flags.-
1488-
1489 \sa setNumberFlags(), integerBase(), realNumberNotation()-
1490*/-
1491QTextStream::NumberFlags QTextStream::numberFlags() const-
1492{-
1493 Q_D(const QTextStream);-
1494 return d->params.numberFlags;
executed 1624 times by 10 tests: return d->params.numberFlags;
Executed by:
  • tst_QBrush
  • tst_QDebug
  • tst_QGraphicsAnchorLayout
  • tst_QGuiVariant
  • tst_QNetworkConfigurationManager
  • tst_QOpenGlConfig
  • tst_QString
  • tst_QTextLayout
  • tst_QTextStream
  • tst_QVariant
1624
1495}-
1496-
1497/*!-
1498 Sets the base of integers to \a base, both for reading and for-
1499 generating numbers. \a base can be either 2 (binary), 8 (octal),-
1500 10 (decimal) or 16 (hexadecimal). If \a base is 0, QTextStream-
1501 will attempt to detect the base by inspecting the data on the-
1502 stream. When generating numbers, QTextStream assumes base is 10-
1503 unless the base has been set explicitly.-
1504-
1505 \sa integerBase(), QString::number(), setNumberFlags()-
1506*/-
1507void QTextStream::setIntegerBase(int base)-
1508{-
1509 Q_D(QTextStream);-
1510 d->params.integerBase = base;-
1511}
executed 240 times by 7 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QGuiVariant
  • tst_QKeyEvent
  • tst_QNetworkConfigurationManager
  • tst_QSplitter
  • tst_QTextStream
  • tst_QVariant
240
1512-
1513/*!-
1514 Returns the current base of integers. 0 means that the base is-
1515 detected when reading, or 10 (decimal) when generating numbers.-
1516-
1517 \sa setIntegerBase(), QString::number(), numberFlags()-
1518*/-
1519int QTextStream::integerBase() const-
1520{-
1521 Q_D(const QTextStream);-
1522 return d->params.integerBase;
executed 3 times by 1 test: return d->params.integerBase;
Executed by:
  • tst_QTextStream
3
1523}-
1524-
1525/*!-
1526 Sets the real number notation to \a notation (SmartNotation,-
1527 FixedNotation, ScientificNotation). When reading and generating-
1528 numbers, QTextStream uses this value to detect the formatting of-
1529 real numbers.-
1530-
1531 \sa realNumberNotation(), setRealNumberPrecision(), setNumberFlags(), setIntegerBase()-
1532*/-
1533void QTextStream::setRealNumberNotation(RealNumberNotation notation)-
1534{-
1535 Q_D(QTextStream);-
1536 d->params.realNumberNotation = notation;-
1537}
executed 9 times by 1 test: end of block
Executed by:
  • tst_QTextStream
9
1538-
1539/*!-
1540 Returns the current real number notation.-
1541-
1542 \sa setRealNumberNotation(), realNumberPrecision(), numberFlags(), integerBase()-
1543*/-
1544QTextStream::RealNumberNotation QTextStream::realNumberNotation() const-
1545{-
1546 Q_D(const QTextStream);-
1547 return d->params.realNumberNotation;
executed 309 times by 9 tests: return d->params.realNumberNotation;
Executed by:
  • tst_QBrush
  • tst_QDebug
  • tst_QGraphicsAnchorLayout
  • tst_QGuiVariant
  • tst_QOpenGlConfig
  • tst_QString
  • tst_QTextLayout
  • tst_QTextStream
  • tst_QVariant
309
1548}-
1549-
1550/*!-
1551 Sets the precision of real numbers to \a precision. This value-
1552 describes the number of fraction digits QTextStream should-
1553 write when generating real numbers.-
1554-
1555 The precision cannot be a negative value. The default value is 6.-
1556-
1557 \sa realNumberPrecision(), setRealNumberNotation()-
1558*/-
1559void QTextStream::setRealNumberPrecision(int precision)-
1560{-
1561 Q_D(QTextStream);-
1562 if (precision < 0) {
precision < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTextStream
2-10
1563 qWarning("QTextStream::setRealNumberPrecision: Invalid precision (%d)", precision);-
1564 d->params.realNumberPrecision = 6;-
1565 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QTextStream
2
1566 }-
1567 d->params.realNumberPrecision = precision;-
1568}
executed 10 times by 1 test: end of block
Executed by:
  • tst_QTextStream
10
1569-
1570/*!-
1571 Returns the current real number precision, or the number of fraction-
1572 digits QTextStream will write when generating real numbers.-
1573-
1574 \sa setRealNumberNotation(), realNumberNotation(), numberFlags(), integerBase()-
1575*/-
1576int QTextStream::realNumberPrecision() const-
1577{-
1578 Q_D(const QTextStream);-
1579 return d->params.realNumberPrecision;
executed 3 times by 1 test: return d->params.realNumberPrecision;
Executed by:
  • tst_QTextStream
3
1580}-
1581-
1582/*!-
1583 Returns the status of the text stream.-
1584-
1585 \sa QTextStream::Status, setStatus(), resetStatus()-
1586*/-
1587-
1588QTextStream::Status QTextStream::status() const-
1589{-
1590 Q_D(const QTextStream);-
1591 return d->status;
executed 17141 times by 4 tests: return d->status;
Executed by:
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QTextStream
17141
1592}-
1593-
1594/*!-
1595 \since 4.1-
1596-
1597 Resets the status of the text stream.-
1598-
1599 \sa QTextStream::Status, status(), setStatus()-
1600*/-
1601void QTextStream::resetStatus()-
1602{-
1603 Q_D(QTextStream);-
1604 d->status = Ok;-
1605}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QTextStream
3
1606-
1607/*!-
1608 \since 4.1-
1609-
1610 Sets the status of the text stream to the \a status given.-
1611-
1612 Subsequent calls to setStatus() are ignored until resetStatus()-
1613 is called.-
1614-
1615 \sa Status, status(), resetStatus()-
1616*/-
1617void QTextStream::setStatus(Status status)-
1618{-
1619 Q_D(QTextStream);-
1620 if (d->status == Ok)
d->status == OkDescription
TRUEevaluated 79 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
0-79
1621 d->status = status;
executed 79 times by 1 test: d->status = status;
Executed by:
  • tst_QTextStream
79
1622}
executed 79 times by 1 test: end of block
Executed by:
  • tst_QTextStream
79
1623-
1624/*!-
1625 Returns \c true if there is no more data to be read from the-
1626 QTextStream; otherwise returns \c false. This is similar to, but not-
1627 the same as calling QIODevice::atEnd(), as QTextStream also takes-
1628 into account its internal Unicode buffer.-
1629*/-
1630bool QTextStream::atEnd() const-
1631{-
1632 Q_D(const QTextStream);-
1633 CHECK_VALID_STREAM(true);
executed 1 time by 1 test: return true;
Executed by:
  • tst_QTextStream
!d->stringDescription
TRUEevaluated 113676 times by 11 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 48149 times by 3 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTextStream
!d->deviceDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 113675 times by 11 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
1-113676
1634-
1635 if (d->string)
d->stringDescription
TRUEevaluated 48149 times by 3 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTextStream
FALSEevaluated 113675 times by 11 tests
Evaluated by:
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
48149-113675
1636 return d->string->size() == d->stringOffset;
executed 48149 times by 3 tests: return d->string->size() == d->stringOffset;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTextStream
48149
1637 return d->readBuffer.isEmpty() && d->device->atEnd();
executed 113675 times by 11 tests: return d->readBuffer.isEmpty() && d->device->atEnd();
Executed by:
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QSplitter
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
113675
1638}-
1639-
1640/*!-
1641 Reads the entire content of the stream, and returns it as a-
1642 QString. Avoid this function when working on large files, as it-
1643 will consume a significant amount of memory.-
1644-
1645 Calling \l {QTextStream::readLine()}{readLine()} is better if you do not know how much data is-
1646 available.-
1647-
1648 \sa readLine()-
1649*/-
1650QString QTextStream::readAll()-
1651{-
1652 Q_D(QTextStream);-
1653 CHECK_VALID_STREAM(QString());
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTextStream
!d->stringDescription
TRUEevaluated 1865 times by 2 tests
Evaluated by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QTextStream
!d->deviceDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1864 times by 2 tests
Evaluated by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
1-1865
1654-
1655 return d->read(INT_MAX);
executed 1869 times by 2 tests: return d->read(2147483647);
Executed by:
  • tst_QTextStream
  • tst_QXmlSimpleReader
1869
1656}-
1657-
1658/*!-
1659 Reads one line of text from the stream, and returns it as a-
1660 QString. The maximum allowed line length is set to \a maxlen. If-
1661 the stream contains lines longer than this, then the lines will be-
1662 split after \a maxlen characters and returned in parts.-
1663-
1664 If \a maxlen is 0, the lines can be of any length.-
1665-
1666 The returned line has no trailing end-of-line characters ("\\n"-
1667 or "\\r\\n"), so calling QString::trimmed() can be unnecessary.-
1668-
1669 If the stream has read to the end of the file, \l {QTextStream::readLine()}{readLine()}-
1670 will return a null QString. For strings, or for devices that support it,-
1671 you can explicitly test for the end of the stream using atEnd().-
1672-
1673 \sa readAll(), QIODevice::readLine()-
1674*/-
1675QString QTextStream::readLine(qint64 maxlen)-
1676{-
1677 QString line;-
1678-
1679 readLineInto(&line, maxlen);-
1680 return line;
executed 154261 times by 14 tests: return line;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
154261
1681}-
1682-
1683/*!-
1684 \since 5.5-
1685-
1686 Reads one line of text from the stream into \a line.-
1687 If \a line is 0, the read line is not stored.-
1688-
1689 The maximum allowed line length is set to \a maxlen. If-
1690 the stream contains lines longer than this, then the lines will be-
1691 split after \a maxlen characters and returned in parts.-
1692-
1693 If \a maxlen is 0, the lines can be of any length.-
1694-
1695 The resulting line has no trailing end-of-line characters ("\\n"-
1696 or "\\r\\n"), so calling QString::trimmed() can be unnecessary.-
1697-
1698 If \a line has sufficient capacity for the data that is about to be-
1699 read, this function may not need to allocate new memory. Because of-
1700 this, it can be faster than readLine().-
1701-
1702 Returns \c false if the stream has read to the end of the file or-
1703 an error has occurred; otherwise returns \c true. The contents in-
1704 \a line before the call are discarded in any case.-
1705-
1706 \sa readAll(), QIODevice::readLine()-
1707*/-
1708bool QTextStream::readLineInto(QString *line, qint64 maxlen)-
1709{-
1710 Q_D(QTextStream);-
1711 // keep in sync with CHECK_VALID_STREAM-
1712 if (!d->string && !d->device) {
!d->stringDescription
TRUEevaluated 160283 times by 13 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 24119 times by 3 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QTextStream
!d->deviceDescription
TRUEnever evaluated
FALSEevaluated 160283 times by 13 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
0-160283
1713 qWarning("QTextStream: No device");-
1714 if (line && !line->isNull())
lineDescription
TRUEnever evaluated
FALSEnever evaluated
!line->isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1715 line->resize(0);
never executed: line->resize(0);
0
1716 return false;
never executed: return false;
0
1717 }-
1718-
1719 const QChar *readPtr;-
1720 int length;-
1721 if (!d->scan(&readPtr, &length, int(maxlen), QTextStreamPrivate::EndOfLine)) {
!d->scan(&read...te::EndOfLine)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 184388 times by 14 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
14-184388
1722 if (line && !line->isNull())
lineDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
!line->isNull()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTextStream
0-14
1723 line->resize(0);
executed 4 times by 1 test: line->resize(0);
Executed by:
  • tst_QTextStream
4
1724 return false;
executed 14 times by 1 test: return false;
Executed by:
  • tst_QTextStream
14
1725 }-
1726-
1727 if (Q_LIKELY(line))
__builtin_expe...!(line), true)Description
TRUEevaluated 184387 times by 14 tests
Evaluated by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
1-184387
1728 line->setUnicode(readPtr, length);
executed 184387 times by 14 tests: line->setUnicode(readPtr, length);
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
184387
1729 d->consumeLastToken();-
1730 return true;
executed 184388 times by 14 tests: return true;
Executed by:
  • tst_QFile
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QLayout
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QProcess
  • tst_QTcpSocket
  • tst_QTemporaryDir
  • tst_QTextStream
  • tst_QTimeZone
  • tst_qmakelib
  • tst_qstandardpaths
184388
1731}-
1732-
1733/*!-
1734 \since 4.1-
1735-
1736 Reads at most \a maxlen characters from the stream, and returns the data-
1737 read as a QString.-
1738-
1739 \sa readAll(), readLine(), QIODevice::read()-
1740*/-
1741QString QTextStream::read(qint64 maxlen)-
1742{-
1743 Q_D(QTextStream);-
1744 CHECK_VALID_STREAM(QString());
never executed: return QString();
!d->stringDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
!d->deviceDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTextStream
0-8
1745-
1746 if (maxlen <= 0)
maxlen <= 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QTextStream
1-7
1747 return QString::fromLatin1(""); // empty, not null
executed 1 time by 1 test: return QString::fromLatin1("");
Executed by:
  • tst_QTextStream
1
1748-
1749 return d->read(int(maxlen));
executed 7 times by 1 test: return d->read(int(maxlen));
Executed by:
  • tst_QTextStream
7
1750}-
1751-
1752/*!-
1753 \internal-
1754*/-
1755QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong *ret)-
1756{-
1757 scan(0, 0, 0, NotSpace);-
1758 consumeLastToken();-
1759-
1760 // detect int encoding-
1761 int base = params.integerBase;-
1762 if (base == 0) {
base == 0Description
TRUEevaluated 16440 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 4875 times by 1 test
Evaluated by:
  • tst_QSplitter
4875-16440
1763 QChar ch;-
1764 if (!getChar(&ch))
!getChar(&ch)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 16414 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
26-16414
1765 return npsInvalidPrefix;
executed 26 times by 1 test: return npsInvalidPrefix;
Executed by:
  • tst_QTextStream
26
1766 if (ch == QLatin1Char('0')) {
ch == QLatin1Char('0')Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 14681 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
1733-14681
1767 QChar ch2;-
1768 if (!getChar(&ch2)) {
!getChar(&ch2)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1727 times by 1 test
Evaluated by:
  • tst_QTextStream
6-1727
1769 // Result is the number 0-
1770 *ret = 0;-
1771 return npsOk;
executed 6 times by 1 test: return npsOk;
Executed by:
  • tst_QTextStream
6
1772 }-
1773 ch2 = ch2.toLower();-
1774-
1775 if (ch2 == QLatin1Char('x')) {
ch2 == QLatin1Char('x')Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1667 times by 1 test
Evaluated by:
  • tst_QTextStream
60-1667
1776 base = 16;-
1777 } else if (ch2 == QLatin1Char('b')) {
executed 60 times by 1 test: end of block
Executed by:
  • tst_QTextStream
ch2 == QLatin1Char('b')Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1625 times by 1 test
Evaluated by:
  • tst_QTextStream
42-1625
1778 base = 2;-
1779 } else if (ch2.isDigit() && ch2.digitValue() >= 0 && ch2.digitValue() <= 7) {
executed 42 times by 1 test: end of block
Executed by:
  • tst_QTextStream
ch2.isDigit()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 1601 times by 1 test
Evaluated by:
  • tst_QTextStream
ch2.digitValue() >= 0Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
ch2.digitValue() <= 7Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
0-1601
1780 base = 8;-
1781 } else {
executed 24 times by 1 test: end of block
Executed by:
  • tst_QTextStream
24
1782 base = 10;-
1783 }
executed 1601 times by 1 test: end of block
Executed by:
  • tst_QTextStream
1601
1784 ungetChar(ch2);-
1785 } else if (ch == locale.negativeSign() || ch == locale.positiveSign() || ch.isDigit()) {
executed 1727 times by 1 test: end of block
Executed by:
  • tst_QTextStream
ch == locale.negativeSign()Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 14577 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
ch == locale.positiveSign()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 14575 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
ch.isDigit()Description
TRUEevaluated 14567 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTextStream
2-14577
1786 base = 10;-
1787 } else {
executed 14673 times by 2 tests: end of block
Executed by:
  • tst_QString
  • tst_QTextStream
14673
1788 ungetChar(ch);-
1789 return npsInvalidPrefix;
executed 8 times by 1 test: return npsInvalidPrefix;
Executed by:
  • tst_QTextStream
8
1790 }-
1791 ungetChar(ch);-
1792 // State of the stream is now the same as on entry-
1793 // (cursor is at prefix),-
1794 // and local variable 'base' has been set appropriately.-
1795 }
executed 16400 times by 2 tests: end of block
Executed by:
  • tst_QString
  • tst_QTextStream
16400
1796-
1797 qulonglong val=0;-
1798 switch (base) {-
1799 case 2: {
executed 42 times by 1 test: case 2:
Executed by:
  • tst_QTextStream
42
1800 QChar pf1, pf2, dig;-
1801 // Parse prefix '0b'-
1802 if (!getChar(&pf1) || pf1 != QLatin1Char('0'))
!getChar(&pf1)Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_QTextStream
pf1 != QLatin1Char('0')Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_QTextStream
0-42
1803 return npsInvalidPrefix;
never executed: return npsInvalidPrefix;
0
1804 if (!getChar(&pf2) || pf2.toLower() != QLatin1Char('b'))
!getChar(&pf2)Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_QTextStream
pf2.toLower() ...atin1Char('b')Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_QTextStream
0-42
1805 return npsInvalidPrefix;
never executed: return npsInvalidPrefix;
0
1806 // Parse digits-
1807 int ndigits = 0;-
1808 while (getChar(&dig)) {
getChar(&dig)Description
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_QTextStream
30-156
1809 int n = dig.toLower().unicode();-
1810 if (n == '0' || n == '1') {
n == '0'Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_QTextStream
n == '1'Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QTextStream
12-84
1811 val <<= 1;-
1812 val += n - '0';-
1813 } else {
executed 144 times by 1 test: end of block
Executed by:
  • tst_QTextStream
144
1814 ungetChar(dig);-
1815 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_QTextStream
12
1816 }-
1817 ndigits++;-
1818 }
executed 144 times by 1 test: end of block
Executed by:
  • tst_QTextStream
144
1819 if (ndigits == 0) {
ndigits == 0Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_QTextStream
0-42
1820 // Unwind the prefix and abort-
1821 ungetChar(pf2);-
1822 ungetChar(pf1);-
1823 return npsMissingDigit;
never executed: return npsMissingDigit;
0
1824 }-
1825 break;
executed 42 times by 1 test: break;
Executed by:
  • tst_QTextStream
42
1826 }-
1827 case 8: {
executed 24 times by 1 test: case 8:
Executed by:
  • tst_QTextStream
24
1828 QChar pf, dig;-
1829 // Parse prefix '0'-
1830 if (!getChar(&pf) || pf != QLatin1Char('0'))
!getChar(&pf)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTextStream
pf != QLatin1Char('0')Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTextStream
0-24
1831 return npsInvalidPrefix;
never executed: return npsInvalidPrefix;
0
1832 // Parse digits-
1833 int ndigits = 0;-
1834 while (getChar(&dig)) {
getChar(&dig)Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QTextStream
12-72
1835 int n = dig.toLower().unicode();-
1836 if (n >= '0' && n <= '7') {
n >= '0'Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
n <= '7'Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QTextStream
0-72
1837 val *= 8;-
1838 val += n - '0';-
1839 } else {
executed 60 times by 1 test: end of block
Executed by:
  • tst_QTextStream
60
1840 ungetChar(dig);-
1841 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_QTextStream
12
1842 }-
1843 ndigits++;-
1844 }
executed 60 times by 1 test: end of block
Executed by:
  • tst_QTextStream
60
1845 if (ndigits == 0) {
ndigits == 0Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTextStream
0-24
1846 // Unwind the prefix and abort-
1847 ungetChar(pf);-
1848 return npsMissingDigit;
never executed: return npsMissingDigit;
0
1849 }-
1850 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_QTextStream
24
1851 }-
1852 case 10: {
executed 21149 times by 3 tests: case 10:
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
21149
1853 // Parse sign (or first digit)-
1854 QChar sign;-
1855 int ndigits = 0;-
1856 if (!getChar(&sign))
!getChar(&sign)Description
TRUEnever evaluated
FALSEevaluated 21149 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
0-21149
1857 return npsMissingDigit;
never executed: return npsMissingDigit;
0
1858 if (sign != locale.negativeSign() && sign != locale.positiveSign()) {
sign != locale.negativeSign()Description
TRUEevaluated 21045 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEevaluated 104 times by 1 test
Evaluated by:
  • tst_QTextStream
sign != locale.positiveSign()Description
TRUEevaluated 21043 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextStream
2-21045
1859 if (!sign.isDigit()) {
!sign.isDigit()Description
TRUEnever evaluated
FALSEevaluated 21043 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
0-21043
1860 ungetChar(sign);-
1861 return npsMissingDigit;
never executed: return npsMissingDigit;
0
1862 }-
1863 val += sign.digitValue();-
1864 ndigits++;-
1865 }
executed 21043 times by 3 tests: end of block
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
21043
1866 // Parse digits-
1867 QChar ch;-
1868 while (getChar(&ch)) {
getChar(&ch)Description
TRUEevaluated 28447 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEevaluated 260 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
260-28447
1869 if (ch.isDigit()) {
ch.isDigit()Description
TRUEevaluated 7557 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEevaluated 20890 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
7557-20890
1870 val *= 10;-
1871 val += ch.digitValue();-
1872 } else if (locale != QLocale::c() && ch == locale.groupSeparator()) {
executed 7557 times by 3 tests: end of block
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
locale != QLocale::c()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 20889 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
ch == locale.groupSeparator()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
0-20889
1873 continue;
executed 1 time by 1 test: continue;
Executed by:
  • tst_QTextStream
1
1874 } else {-
1875 ungetChar(ch);-
1876 break;
executed 20889 times by 3 tests: break;
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
20889
1877 }-
1878 ndigits++;-
1879 }
executed 7557 times by 3 tests: end of block
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
7557
1880 if (ndigits == 0)
ndigits == 0Description
TRUEnever evaluated
FALSEevaluated 21149 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
0-21149
1881 return npsMissingDigit;
never executed: return npsMissingDigit;
0
1882 if (sign == locale.negativeSign()) {
sign == locale.negativeSign()Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 21045 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
104-21045
1883 qlonglong ival = qlonglong(val);-
1884 if (ival > 0)
ival > 0Description
TRUEevaluated 98 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QTextStream
6-98
1885 ival = -ival;
executed 98 times by 1 test: ival = -ival;
Executed by:
  • tst_QTextStream
98
1886 val = qulonglong(ival);-
1887 }
executed 104 times by 1 test: end of block
Executed by:
  • tst_QTextStream
104
1888 break;
executed 21149 times by 3 tests: break;
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
21149
1889 }-
1890 case 16: {
executed 60 times by 1 test: case 16:
Executed by:
  • tst_QTextStream
60
1891 QChar pf1, pf2, dig;-
1892 // Parse prefix ' 0x'-
1893 if (!getChar(&pf1) || pf1 != QLatin1Char('0'))
!getChar(&pf1)Description
TRUEnever evaluated
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_QTextStream
pf1 != QLatin1Char('0')Description
TRUEnever evaluated
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_QTextStream
0-60
1894 return npsInvalidPrefix;
never executed: return npsInvalidPrefix;
0
1895 if (!getChar(&pf2) || pf2.toLower() != QLatin1Char('x'))
!getChar(&pf2)Description
TRUEnever evaluated
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_QTextStream
pf2.toLower() ...atin1Char('x')Description
TRUEnever evaluated
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_QTextStream
0-60
1896 return npsInvalidPrefix;
never executed: return npsInvalidPrefix;
0
1897 // Parse digits-
1898 int ndigits = 0;-
1899 while (getChar(&dig)) {
getChar(&dig)Description
TRUEevaluated 318 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_QTextStream
48-318
1900 int n = dig.toLower().unicode();-
1901 if (n >= '0' && n <= '9') {
n >= '0'Description
TRUEevaluated 318 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
n <= '9'Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 306 times by 1 test
Evaluated by:
  • tst_QTextStream
0-318
1902 val <<= 4;-
1903 val += n - '0';-
1904 } else if (n >= 'a' && n <= 'f') {
executed 12 times by 1 test: end of block
Executed by:
  • tst_QTextStream
n >= 'a'Description
TRUEevaluated 306 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEnever evaluated
n <= 'f'Description
TRUEevaluated 294 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QTextStream
0-306
1905 val <<= 4;-
1906 val += 10 + (n - 'a');-
1907 } else {
executed 294 times by 1 test: end of block
Executed by:
  • tst_QTextStream
294
1908 ungetChar(dig);-
1909 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_QTextStream
12
1910 }-
1911 ndigits++;-
1912 }
executed 306 times by 1 test: end of block
Executed by:
  • tst_QTextStream
306
1913 if (ndigits == 0) {
ndigits == 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_QTextStream
6-54
1914 return npsMissingDigit;
executed 6 times by 1 test: return npsMissingDigit;
Executed by:
  • tst_QTextStream
6
1915 }-
1916 break;
executed 54 times by 1 test: break;
Executed by:
  • tst_QTextStream
54
1917 }-
1918 default:
never executed: default:
0
1919 // Unsupported integerBase-
1920 return npsInvalidPrefix;
never executed: return npsInvalidPrefix;
0
1921 }-
1922-
1923 if (ret)
retDescription
TRUEevaluated 21269 times by 3 tests
Evaluated by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
FALSEnever evaluated
0-21269
1924 *ret = val;
executed 21269 times by 3 tests: *ret = val;
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
21269
1925 return npsOk;
executed 21269 times by 3 tests: return npsOk;
Executed by:
  • tst_QSplitter
  • tst_QString
  • tst_QTextStream
21269
1926}-
1927-
1928/*!-
1929 \internal-
1930 (hihi)-
1931*/-
1932bool QTextStreamPrivate::getReal(double *f)-
1933{-
1934 // We use a table-driven FSM to parse floating point numbers-
1935 // strtod() cannot be used directly since we may be reading from a-
1936 // QIODevice.-
1937 enum ParserState {-
1938 Init = 0,-
1939 Sign = 1,-
1940 Mantissa = 2,-
1941 Dot = 3,-
1942 Abscissa = 4,-
1943 ExpMark = 5,-
1944 ExpSign = 6,-
1945 Exponent = 7,-
1946 Nan1 = 8,-
1947 Nan2 = 9,-
1948 Inf1 = 10,-
1949 Inf2 = 11,-
1950 NanInf = 12,-
1951 Done = 13-
1952 };-
1953 enum InputToken {-
1954 None = 0,-
1955 InputSign = 1,-
1956 InputDigit = 2,-
1957 InputDot = 3,-
1958 InputExp = 4,-
1959 InputI = 5,-
1960 InputN = 6,-
1961 InputF = 7,-
1962 InputA = 8,-
1963 InputT = 9-
1964 };-
1965-
1966 static const uchar table[13][10] = {-
1967 // None InputSign InputDigit InputDot InputExp InputI InputN InputF InputA InputT-
1968 { 0, Sign, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, // 0 Init-
1969 { 0, 0, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, // 1 Sign-
1970 { Done, Done, Mantissa, Dot, ExpMark, 0, 0, 0, 0, 0 }, // 2 Mantissa-
1971 { 0, 0, Abscissa, 0, 0, 0, 0, 0, 0, 0 }, // 3 Dot-
1972 { Done, Done, Abscissa, Done, ExpMark, 0, 0, 0, 0, 0 }, // 4 Abscissa-
1973 { 0, ExpSign, Exponent, 0, 0, 0, 0, 0, 0, 0 }, // 5 ExpMark-
1974 { 0, 0, Exponent, 0, 0, 0, 0, 0, 0, 0 }, // 6 ExpSign-
1975 { Done, Done, Exponent, Done, Done, 0, 0, 0, 0, 0 }, // 7 Exponent-
1976 { 0, 0, 0, 0, 0, 0, 0, 0, Nan2, 0 }, // 8 Nan1-
1977 { 0, 0, 0, 0, 0, 0, NanInf, 0, 0, 0 }, // 9 Nan2-
1978 { 0, 0, 0, 0, 0, 0, Inf2, 0, 0, 0 }, // 10 Inf1-
1979 { 0, 0, 0, 0, 0, 0, 0, NanInf, 0, 0 }, // 11 Inf2-
1980 { Done, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 11 NanInf-
1981 };-
1982-
1983 ParserState state = Init;-
1984 InputToken input = None;-
1985-
1986 scan(0, 0, 0, NotSpace);-
1987 consumeLastToken();-
1988-
1989 const int BufferSize = 128;-
1990 char buf[BufferSize];-
1991 int i = 0;-
1992-
1993 QChar c;-
1994 while (getChar(&c)) {
getChar(&c)Description
TRUEevaluated 282 times by 1 test
Evaluated by:
  • tst_QTextStream
FALSEevaluated 29 times by 1 test
Evaluated by:
  • tst_QTextStream
29-282
1995 switch (c.unicode()) {-
1996 case '0': case '1': case '2': case '3': case '4':
executed 10 times by 1 test: case '0':
Executed by:
  • tst_QTextStream
executed 23 times by 1 test: case '1':
Executed by:
  • tst_QTextStream
executed 11 times by 1 test: case '2':
Executed by:
  • tst_QTextStream
executed 15 times by 1 test: case '3':
Executed by:
  • tst_QTextStream
executed 16 times by 1 test: case '4':
Executed by:
  • tst_QTextStream
10-23
1997 case '5': case '6': case '7': case '8': case '9':
executed 2 times by 1 test: case '5':
Executed by:
  • tst_QTextStream
never executed: case '6':
never executed: case '7':
never executed: case '8':
never executed: case '9':
0-2
1998 input = InputDigit;-
1999 break;
executed 77 times by 1 test: break;
Executed by:
  • tst_QTextStream
77
2000 case 'i': case 'I':
executed 12 times by 1 test: case 'i':
Executed by:
  • tst_QTextStream
executed 6 times by 1 test: case 'I':
Executed by:
  • tst_QTextStream
6-12
2001 input = InputI;-
2002 break;
executed 18 times by 1 test: break;
Executed by:
  • tst_QTextStream
18
2003 case 'n': case 'N':
executed 30 times by 1 test: case 'n':
Executed by:
  • tst_QTextStream
executed 24 times by 1 test: case 'N':
Executed by:
  • tst_QTextStream
24-30
2004 input = InputN;-
2005 break;
executed 54 times by 1 test: break;
Executed by:
  • tst_QTextStream
54
2006 case 'f': case 'F':
executed 12 times by 1 test: case 'f':
Executed by:
  • tst_QTextStream
executed 6 times by 1 test: case 'F':
Executed by:
  • tst_QTextStream
6-12
2007 input = InputF;-
2008 break;
executed 18 times by 1 test: break;
Executed by:
  • tst_QTextStream
18
2009 case 'a': case 'A':
executed 9 times by 1 test: case 'a':
Executed by:
  • tst_QTextStream
executed 12 times by 1 test: case 'A':
Executed by:
  • tst_QTextStream
9-12
2010 input = InputA;-
2011 break;
executed 21 times by 1 test: break;
Executed by:
  • tst_QTextStream
21
2012 case 't': case 'T':
never executed: case 't':
never executed: case 'T':
0
2013 input = InputT;-
2014 break;
never executed: break;
0
2015 default: {
executed 94 times by 1 test: default:
Executed by:
  • tst_QTextStream
94
2016 QChar lc = c.toLower();-
2017 if (lc == locale.decimalPoint().toLower())