qdatastream.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qdatastream.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qdatastream.h"-
35#include "qdatastream_p.h"-
36-
37#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)-
38#include "qbuffer.h"-
39#include "qstring.h"-
40#include <stdio.h>-
41#include <ctype.h>-
42#include <stdlib.h>-
43#include "qendian.h"-
44-
45QT_BEGIN_NAMESPACE-
46-
47/*!-
48 \class QDataStream-
49 \inmodule QtCore-
50 \reentrant-
51 \brief The QDataStream class provides serialization of binary data-
52 to a QIODevice.-
53-
54 \ingroup io-
55-
56-
57 A data stream is a binary stream of encoded information which is-
58 100% independent of the host computer's operating system, CPU or-
59 byte order. For example, a data stream that is written by a PC-
60 under Windows can be read by a Sun SPARC running Solaris.-
61-
62 You can also use a data stream to read/write \l{raw}{raw-
63 unencoded binary data}. If you want a "parsing" input stream, see-
64 QTextStream.-
65-
66 The QDataStream class implements the serialization of C++'s basic-
67 data types, like \c char, \c short, \c int, \c{char *}, etc.-
68 Serialization of more complex data is accomplished by breaking up-
69 the data into primitive units.-
70-
71 A data stream cooperates closely with a QIODevice. A QIODevice-
72 represents an input/output medium one can read data from and write-
73 data to. The QFile class is an example of an I/O device.-
74-
75 Example (write binary data to a stream):-
76-
77 \snippet code/src_corelib_io_qdatastream.cpp 0-
78-
79 Example (read binary data from a stream):-
80-
81 \snippet code/src_corelib_io_qdatastream.cpp 1-
82-
83 Each item written to the stream is written in a predefined binary-
84 format that varies depending on the item's type. Supported Qt-
85 types include QBrush, QColor, QDateTime, QFont, QPixmap, QString,-
86 QVariant and many others. For the complete list of all Qt types-
87 supporting data streaming see \l{Serializing Qt Data Types}.-
88-
89 For integers it is best to always cast to a Qt integer type for-
90 writing, and to read back into the same Qt integer type. This-
91 ensures that you get integers of the size you want and insulates-
92 you from compiler and platform differences.-
93-
94 To take one example, a \c{char *} string is written as a 32-bit-
95 integer equal to the length of the string including the '\\0' byte,-
96 followed by all the characters of the string including the-
97 '\\0' byte. When reading a \c{char *} string, 4 bytes are read to-
98 create the 32-bit length value, then that many characters for the-
99 \c {char *} string including the '\\0' terminator are read.-
100-
101 The initial I/O device is usually set in the constructor, but can be-
102 changed with setDevice(). If you've reached the end of the data-
103 (or if there is no I/O device set) atEnd() will return true.-
104-
105 \section1 Versioning-
106-
107 QDataStream's binary format has evolved since Qt 1.0, and is-
108 likely to continue evolving to reflect changes done in Qt. When-
109 inputting or outputting complex types, it's very important to-
110 make sure that the same version of the stream (version()) is used-
111 for reading and writing. If you need both forward and backward-
112 compatibility, you can hardcode the version number in the-
113 application:-
114-
115 \snippet code/src_corelib_io_qdatastream.cpp 2-
116-
117 If you are producing a new binary data format, such as a file-
118 format for documents created by your application, you could use a-
119 QDataStream to write the data in a portable format. Typically, you-
120 would write a brief header containing a magic string and a version-
121 number to give yourself room for future expansion. For example:-
122-
123 \snippet code/src_corelib_io_qdatastream.cpp 3-
124-
125 Then read it in with:-
126-
127 \snippet code/src_corelib_io_qdatastream.cpp 4-
128-
129 You can select which byte order to use when serializing data. The-
130 default setting is big endian (MSB first). Changing it to little-
131 endian breaks the portability (unless the reader also changes to-
132 little endian). We recommend keeping this setting unless you have-
133 special requirements.-
134-
135 \target raw-
136 \section1 Reading and Writing Raw Binary Data-
137-
138 You may wish to read/write your own raw binary data to/from the-
139 data stream directly. Data may be read from the stream into a-
140 preallocated \c{char *} using readRawData(). Similarly data can be-
141 written to the stream using writeRawData(). Note that any-
142 encoding/decoding of the data must be done by you.-
143-
144 A similar pair of functions is readBytes() and writeBytes(). These-
145 differ from their \e raw counterparts as follows: readBytes()-
146 reads a quint32 which is taken to be the length of the data to be-
147 read, then that number of bytes is read into the preallocated-
148 \c{char *}; writeBytes() writes a quint32 containing the length of the-
149 data, followed by the data. Note that any encoding/decoding of-
150 the data (apart from the length quint32) must be done by you.-
151-
152 \section1 Reading and Writing Qt Collection Classes-
153-
154 The Qt container classes can also be serialized to a QDataStream.-
155 These include QList, QLinkedList, QVector, QSet, QHash, and QMap.-
156 The stream operators are declared as non-members of the classes.-
157-
158 \target Serializing Qt Classes-
159 \section1 Reading and Writing Other Qt Classes-
160-
161 In addition to the overloaded stream operators documented here,-
162 any Qt classes that you might want to serialize to a QDataStream-
163 will have appropriate stream operators declared as non-member of-
164 the class:-
165-
166 \code-
167 QDataStream &operator<<(QDataStream &, const QXxx &);-
168 QDataStream &operator>>(QDataStream &, QXxx &);-
169 \endcode-
170-
171 For example, here are the stream operators declared as non-members-
172 of the QImage class:-
173-
174 \code-
175 QDataStream & operator<< (QDataStream& stream, const QImage& image);-
176 QDataStream & operator>> (QDataStream& stream, QImage& image);-
177 \endcode-
178-
179 To see if your favorite Qt class has similar stream operators-
180 defined, check the \b {Related Non-Members} section of the-
181 class's documentation page.-
182-
183 \sa QTextStream, QVariant-
184*/-
185-
186/*!-
187 \enum QDataStream::ByteOrder-
188-
189 The byte order used for reading/writing the data.-
190-
191 \value BigEndian Most significant byte first (the default)-
192 \value LittleEndian Least significant byte first-
193*/-
194-
195/*!-
196 \enum QDataStream::FloatingPointPrecision-
197-
198 The precision of floating point numbers used for reading/writing the data. This will only have-
199 an effect if the version of the data stream is Qt_4_6 or higher.-
200-
201 \warning The floating point precision must be set to the same value on the object that writes-
202 and the object that reads the data stream.-
203-
204 \value SinglePrecision All floating point numbers in the data stream have 32-bit precision.-
205 \value DoublePrecision All floating point numbers in the data stream have 64-bit precision.-
206-
207 \sa setFloatingPointPrecision(), floatingPointPrecision()-
208*/-
209-
210/*!-
211 \enum QDataStream::Status-
212-
213 This enum describes the current status of the data stream.-
214-
215 \value Ok The data stream is operating normally.-
216 \value ReadPastEnd The data stream has read past the end of the-
217 data in the underlying device.-
218 \value ReadCorruptData The data stream has read corrupt data.-
219 \value WriteFailed The data stream cannot write to the underlying device.-
220*/-
221-
222/*****************************************************************************-
223 QDataStream member functions-
224 *****************************************************************************/-
225-
226#undef CHECK_STREAM_PRECOND-
227#ifndef QT_NO_DEBUG-
228#define CHECK_STREAM_PRECOND(retVal) \-
229 if (!dev) { \-
230 qWarning("QDataStream: No device"); \-
231 return retVal; \-
232 }-
233#else-
234#define CHECK_STREAM_PRECOND(retVal) \-
235 if (!dev) { \-
236 return retVal; \-
237 }-
238#endif-
239-
240#define CHECK_STREAM_WRITE_PRECOND(retVal) \-
241 CHECK_STREAM_PRECOND(retVal) \-
242 if (q_status != Ok) \-
243 return retVal;-
244-
245/*!-
246 Constructs a data stream that has no I/O device.-
247-
248 \sa setDevice()-
249*/-
250-
251QDataStream::QDataStream()-
252{-
253 dev = 0;-
254 owndev = false;-
255 byteorder = BigEndian;-
256 ver = Qt_DefaultCompiledVersion;-
257 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
258 q_status = Ok;-
259}
executed 292 times by 8 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFont
  • tst_QNetworkDiskCache
  • tst_QPdfWriter
  • tst_QPicture
  • tst_QPrinter
292
260-
261/*!-
262 Constructs a data stream that uses the I/O device \a d.-
263-
264 \sa setDevice(), device()-
265*/-
266-
267QDataStream::QDataStream(QIODevice *d)-
268{-
269 dev = d; // set device-
270 owndev = false;-
271 byteorder = BigEndian; // default byte order-
272 ver = Qt_DefaultCompiledVersion;-
273 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
274 q_status = Ok;-
275}
executed 6879 times by 22 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFile
  • tst_QGuiVariant
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLocalSocket
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainterPath
  • tst_QPixmap
  • tst_QPoint
  • tst_QPointF
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
6879
276-
277/*!-
278 \fn QDataStream::QDataStream(QByteArray *a, QIODevice::OpenMode mode)-
279-
280 Constructs a data stream that operates on a byte array, \a a. The-
281 \a mode describes how the device is to be used.-
282-
283 Alternatively, you can use QDataStream(const QByteArray &) if you-
284 just want to read from a byte array.-
285-
286 Since QByteArray is not a QIODevice subclass, internally a QBuffer-
287 is created to wrap the byte array.-
288*/-
289-
290QDataStream::QDataStream(QByteArray *a, QIODevice::OpenMode flags)-
291{-
292 QBuffer *buf = new QBuffer(a);-
293#ifndef QT_NO_QOBJECT-
294 buf->blockSignals(true);-
295#endif-
296 buf->open(flags);-
297 dev = buf;-
298 owndev = true;-
299 byteorder = BigEndian;-
300 ver = Qt_DefaultCompiledVersion;-
301 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
302 q_status = Ok;-
303}
executed 6033 times by 46 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QObject
  • tst_QPen
  • tst_QPixmap
  • ...
6033
304-
305/*!-
306 Constructs a read-only data stream that operates on byte array \a a.-
307 Use QDataStream(QByteArray*, int) if you want to write to a byte-
308 array.-
309-
310 Since QByteArray is not a QIODevice subclass, internally a QBuffer-
311 is created to wrap the byte array.-
312*/-
313QDataStream::QDataStream(const QByteArray &a)-
314{-
315 QBuffer *buf = new QBuffer;-
316#ifndef QT_NO_QOBJECT-
317 buf->blockSignals(true);-
318#endif-
319 buf->setData(a);-
320 buf->open(QIODevice::ReadOnly);-
321 dev = buf;-
322 owndev = true;-
323 byteorder = BigEndian;-
324 ver = Qt_DefaultCompiledVersion;-
325 noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian;-
326 q_status = Ok;-
327}
executed 138 times by 13 tests: end of block
Executed by:
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGuiVariant
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QSizePolicy
  • tst_QTranslator
  • tst_QUrl
  • tst_QVariant
  • tst_QVersionNumber
  • tst_QWidget
138
328-
329/*!-
330 Destroys the data stream.-
331-
332 The destructor will not affect the current I/O device, unless it is-
333 an internal I/O device (e.g. a QBuffer) processing a QByteArray-
334 passed in the \e constructor, in which case the internal I/O device-
335 is destroyed.-
336*/-
337-
338QDataStream::~QDataStream()-
339{-
340 if (owndev)
owndevDescription
TRUEevaluated 6171 times by 47 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QObject
  • tst_QPen
  • tst_QPixmap
  • ...
FALSEevaluated 7171 times by 27 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QBitArray
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLocalSocket
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPainterPath
  • tst_QPdfWriter
  • tst_QPicture
  • tst_QPixmap
  • tst_QPoint
  • tst_QPointF
  • tst_QPrinter
  • tst_QSettings
  • ...
6171-7171
341 delete dev;
executed 6171 times by 47 tests: delete dev;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QObject
  • tst_QPen
  • tst_QPixmap
  • ...
6171
342}
executed 13342 times by 64 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • ...
13342
343-
344-
345/*!-
346 \fn QIODevice *QDataStream::device() const-
347-
348 Returns the I/O device currently set, or 0 if no-
349 device is currently set.-
350-
351 \sa setDevice()-
352*/-
353-
354/*!-
355 void QDataStream::setDevice(QIODevice *d)-
356-
357 Sets the I/O device to \a d, which can be 0-
358 to unset to current I/O device.-
359-
360 \sa device()-
361*/-
362-
363void QDataStream::setDevice(QIODevice *d)-
364{-
365 if (owndev) {
owndevDescription
TRUEnever evaluated
FALSEevaluated 332 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QFont
  • tst_QPicture
  • tst_QPrinter
0-332
366 delete dev;-
367 owndev = false;-
368 }
never executed: end of block
0
369 dev = d;-
370}
executed 332 times by 4 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QFont
  • tst_QPicture
  • tst_QPrinter
332
371-
372/*!-
373 \obsolete-
374 Unsets the I/O device.-
375 Use setDevice(0) instead.-
376*/-
377-
378void QDataStream::unsetDevice()-
379{-
380 setDevice(0);-
381}
executed 20 times by 1 test: end of block
Executed by:
  • tst_QPrinter
20
382-
383-
384/*!-
385 \fn bool QDataStream::atEnd() const-
386-
387 Returns \c true if the I/O device has reached the end position (end of-
388 the stream or file) or if there is no I/O device set; otherwise-
389 returns \c false.-
390-
391 \sa QIODevice::atEnd()-
392*/-
393-
394bool QDataStream::atEnd() const-
395{-
396 return dev ? dev->atEnd() : true;
executed 1525 times by 23 tests: return dev ? dev->atEnd() : true;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGuiVariant
  • tst_QIcon
  • tst_QKeySequence
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QSplitter
  • tst_QStandardItemModel
  • tst_QTranslator
  • tst_QTreeWidget
  • tst_QVariant
devDescription
TRUEevaluated 1525 times by 23 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGuiVariant
  • tst_QIcon
  • tst_QKeySequence
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QSplitter
  • tst_QStandardItemModel
  • tst_QTranslator
  • tst_QTreeWidget
  • tst_QVariant
FALSEnever evaluated
0-1525
397}-
398-
399/*!-
400 Returns the floating point precision of the data stream.-
401-
402 \since 4.6-
403-
404 \sa FloatingPointPrecision, setFloatingPointPrecision()-
405*/-
406QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const-
407{-
408 return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision;
executed 38359 times by 14 tests: return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision;
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
d == 0Description
TRUEevaluated 38295 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_QDataStream
64-38359
409}-
410-
411/*!-
412 Sets the floating point precision of the data stream to \a precision. If the floating point precision is-
413 DoublePrecision and the version of the data stream is Qt_4_6 or higher, all floating point-
414 numbers will be written and read with 64-bit precision. If the floating point precision is-
415 SinglePrecision and the version is Qt_4_6 or higher, all floating point numbers will be written-
416 and read with 32-bit precision.-
417-
418 For versions prior to Qt_4_6, the precision of floating point numbers in the data stream depends-
419 on the stream operator called.-
420-
421 The default is DoublePrecision.-
422-
423 \warning This property must be set to the same value on the object that writes and the object-
424 that reads the data stream.-
425-
426 \since 4.6-
427*/-
428void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision)-
429{-
430 if (d == 0)
d == 0Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEnever evaluated
0-58
431 d.reset(new QDataStreamPrivate());
executed 58 times by 1 test: d.reset(new QDataStreamPrivate());
Executed by:
  • tst_QDataStream
58
432 d->floatingPointPrecision = precision;-
433}
executed 58 times by 1 test: end of block
Executed by:
  • tst_QDataStream
58
434-
435/*!-
436 Returns the status of the data stream.-
437-
438 \sa Status, setStatus(), resetStatus()-
439*/-
440-
441QDataStream::Status QDataStream::status() const-
442{-
443 return q_status;
executed 354545 times by 26 tests: return q_status;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPixmap
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
  • ...
354545
444}-
445-
446/*!-
447 Resets the status of the data stream.-
448-
449 \sa Status, status(), setStatus()-
450*/-
451void QDataStream::resetStatus()-
452{-
453 q_status = Ok;-
454}
executed 709 times by 14 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
  • tst_languageChange
709
455-
456/*!-
457 Sets the status of the data stream to the \a status given.-
458-
459 Subsequent calls to setStatus() are ignored until resetStatus()-
460 is called.-
461-
462 \sa Status, status(), resetStatus()-
463*/-
464void QDataStream::setStatus(Status status)-
465{-
466 if (q_status == Ok)
q_status == OkDescription
TRUEevaluated 344 times by 10 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_QVariant
FALSEevaluated 135 times by 7 tests
Evaluated by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
135-344
467 q_status = status;
executed 344 times by 10 tests: q_status = status;
Executed by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_QVariant
344
468}
executed 479 times by 10 tests: end of block
Executed by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
  • tst_QVariant
479
469-
470/*!-
471 \fn int QDataStream::byteOrder() const-
472-
473 Returns the current byte order setting -- either BigEndian or-
474 LittleEndian.-
475-
476 \sa setByteOrder()-
477*/-
478-
479/*!-
480 Sets the serialization byte order to \a bo.-
481-
482 The \a bo parameter can be QDataStream::BigEndian or-
483 QDataStream::LittleEndian.-
484-
485 The default setting is big endian. We recommend leaving this-
486 setting unless you have special requirements.-
487-
488 \sa byteOrder()-
489*/-
490-
491void QDataStream::setByteOrder(ByteOrder bo)-
492{-
493 byteorder = bo;-
494 if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
QSysInfo::Byte...nfo::BigEndianDescription
TRUEnever evaluated
FALSEevaluated 950 times by 9 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
  • tst_QPrinter
  • tst_QUuid
0-950
495 noswap = (byteorder == BigEndian);
never executed: noswap = (byteorder == BigEndian);
0
496 else-
497 noswap = (byteorder == LittleEndian);
executed 950 times by 9 tests: noswap = (byteorder == LittleEndian);
Executed by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
  • tst_QPrinter
  • tst_QUuid
950
498}-
499-
500-
501/*!-
502 \enum QDataStream::Version-
503-
504 This enum provides symbolic synonyms for the data serialization-
505 format version numbers.-
506-
507 \value Qt_1_0 Version 1 (Qt 1.x)-
508 \value Qt_2_0 Version 2 (Qt 2.0)-
509 \value Qt_2_1 Version 3 (Qt 2.1, 2.2, 2.3)-
510 \value Qt_3_0 Version 4 (Qt 3.0)-
511 \value Qt_3_1 Version 5 (Qt 3.1, 3.2)-
512 \value Qt_3_3 Version 6 (Qt 3.3)-
513 \value Qt_4_0 Version 7 (Qt 4.0, Qt 4.1)-
514 \value Qt_4_1 Version 7 (Qt 4.0, Qt 4.1)-
515 \value Qt_4_2 Version 8 (Qt 4.2)-
516 \value Qt_4_3 Version 9 (Qt 4.3)-
517 \value Qt_4_4 Version 10 (Qt 4.4)-
518 \value Qt_4_5 Version 11 (Qt 4.5)-
519 \value Qt_4_6 Version 12 (Qt 4.6, Qt 4.7, Qt 4.8)-
520 \value Qt_4_7 Same as Qt_4_6.-
521 \value Qt_4_8 Same as Qt_4_6.-
522 \value Qt_4_9 Same as Qt_4_6.-
523 \value Qt_5_0 Version 13 (Qt 5.0)-
524 \value Qt_5_1 Version 14 (Qt 5.1)-
525 \value Qt_5_2 Version 15 (Qt 5.2)-
526 \value Qt_5_3 Same as Qt_5_2-
527 \value Qt_5_4 Version 16 (Qt 5.4)-
528 \value Qt_5_5 Same as Qt_5_4-
529 \value Qt_5_6 Version 17 (Qt 5.6)-
530 \omitvalue Qt_DefaultCompiledVersion-
531-
532 \sa setVersion(), version()-
533*/-
534-
535/*!-
536 \fn int QDataStream::version() const-
537-
538 Returns the version number of the data serialization format.-
539-
540 \sa setVersion(), Version-
541*/-
542-
543/*!-
544 \fn void QDataStream::setVersion(int v)-
545-
546 Sets the version number of the data serialization format to \a v,-
547 a value of the \l Version enum.-
548-
549 You don't \e have to set a version if you are using the current-
550 version of Qt, but for your own custom binary formats we-
551 recommend that you do; see \l{Versioning} in the Detailed-
552 Description.-
553-
554 To accommodate new functionality, the datastream serialization-
555 format of some Qt classes has changed in some versions of Qt. If-
556 you want to read data that was created by an earlier version of-
557 Qt, or write data that can be read by a program that was compiled-
558 with an earlier version of Qt, use this function to modify the-
559 serialization format used by QDataStream.-
560-
561 The \l Version enum provides symbolic constants for the different-
562 versions of Qt. For example:-
563-
564 \snippet code/src_corelib_io_qdatastream.cpp 5-
565-
566 \sa version(), Version-
567*/-
568-
569/*****************************************************************************-
570 QDataStream read functions-
571 *****************************************************************************/-
572-
573/*!-
574 \fn QDataStream &QDataStream::operator>>(quint8 &i)-
575 \overload-
576-
577 Reads an unsigned byte from the stream into \a i, and returns a-
578 reference to the stream.-
579*/-
580-
581/*!-
582 Reads a signed byte from the stream into \a i, and returns a-
583 reference to the stream.-
584*/-
585-
586QDataStream &QDataStream::operator>>(qint8 &i)-
587{-
588 i = 0;-
589 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 131187 times by 38 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • ...
0-131187
590 char c;-
591 if (!dev->getChar(&c))
!dev->getChar(&c)Description
TRUEevaluated 30 times by 4 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QMetaType
FALSEevaluated 131157 times by 38 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • ...
30-131157
592 setStatus(ReadPastEnd);
executed 30 times by 4 tests: setStatus(ReadPastEnd);
Executed by:
  • tst_QAsn1Element
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QMetaType
30
593 else-
594 i = qint8(c);
executed 131157 times by 38 tests: i = qint8(c);
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • ...
131157
595 return *this;
executed 131187 times by 38 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QBrush
  • tst_QBuffer
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • ...
131187
596}-
597-
598-
599/*!-
600 \fn QDataStream &QDataStream::operator>>(quint16 &i)-
601 \overload-
602-
603 Reads an unsigned 16-bit integer from the stream into \a i, and-
604 returns a reference to the stream.-
605*/-
606-
607/*!-
608 \overload-
609-
610 Reads a signed 16-bit integer from the stream into \a i, and-
611 returns a reference to the stream.-
612*/-
613-
614QDataStream &QDataStream::operator>>(qint16 &i)-
615{-
616 i = 0;-
617 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 10378 times by 18 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
0-10378
618 if (dev->read((char *)&i, 2) != 2) {
dev->read((char *)&i, 2) != 2Description
TRUEevaluated 60 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QImage
  • tst_QImageReader
  • tst_QMetaType
FALSEevaluated 10318 times by 18 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
60-10318
619 i = 0;-
620 setStatus(ReadPastEnd);-
621 } else {
executed 60 times by 4 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QImage
  • tst_QImageReader
  • tst_QMetaType
60
622 if (!noswap) {
!noswapDescription
TRUEevaluated 8800 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
FALSEevaluated 1518 times by 6 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
1518-8800
623 i = qbswap(i);-
624 }
executed 8800 times by 14 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
8800
625 }
executed 10318 times by 18 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
10318
626 return *this;
executed 10378 times by 18 tests: return *this;
Executed by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QVariant
  • tst_QWidget
10378
627}-
628-
629-
630/*!-
631 \fn QDataStream &QDataStream::operator>>(quint32 &i)-
632 \overload-
633-
634 Reads an unsigned 32-bit integer from the stream into \a i, and-
635 returns a reference to the stream.-
636*/-
637-
638/*!-
639 \overload-
640-
641 Reads a signed 32-bit integer from the stream into \a i, and-
642 returns a reference to the stream.-
643*/-
644-
645QDataStream &QDataStream::operator>>(qint32 &i)-
646{-
647 i = 0;-
648 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 120753 times by 56 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
0-120753
649 if (dev->read((char *)&i, 4) != 4) {
dev->read((char *)&i, 4) != 4Description
TRUEevaluated 199 times by 8 tests
Evaluated by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
FALSEevaluated 120554 times by 56 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
199-120554
650 i = 0;-
651 setStatus(ReadPastEnd);-
652 } else {
executed 199 times by 8 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkDiskCache
  • tst_QPixmap
199
653 if (!noswap) {
!noswapDescription
TRUEevaluated 116818 times by 53 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • ...
FALSEevaluated 3736 times by 6 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
3736-116818
654 i = qbswap(i);-
655 }
executed 116818 times by 53 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • ...
116818
656 }
executed 120554 times by 56 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
120554
657 return *this;
executed 120753 times by 56 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
120753
658}-
659-
660/*!-
661 \fn QDataStream &QDataStream::operator>>(quint64 &i)-
662 \overload-
663-
664 Reads an unsigned 64-bit integer from the stream, into \a i, and-
665 returns a reference to the stream.-
666*/-
667-
668/*!-
669 \overload-
670-
671 Reads a signed 64-bit integer from the stream into \a i, and-
672 returns a reference to the stream.-
673*/-
674-
675QDataStream &QDataStream::operator>>(qint64 &i)-
676{-
677 i = qint64(0);-
678 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 34762 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
0-34762
679 if (version() < 6) {
version() < 6Description
TRUEnever evaluated
FALSEevaluated 34762 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
0-34762
680 quint32 i1, i2;-
681 *this >> i2 >> i1;-
682 i = ((quint64)i1 << 32) + i2;-
683 } else {
never executed: end of block
0
684 if (dev->read((char *)&i, 8) != 8) {
dev->read((char *)&i, 8) != 8Description
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
FALSEevaluated 34712 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
50-34712
685 i = qint64(0);-
686 setStatus(ReadPastEnd);-
687 } else {
executed 50 times by 2 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QMetaType
50
688 if (!noswap) {
!noswapDescription
TRUEevaluated 34700 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QDataStream
12-34700
689 i = qbswap(i);-
690 }
executed 34700 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
34700
691 }
executed 34712 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
34712
692 }-
693 return *this;
executed 34762 times by 12 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QTimeZone
  • tst_QVariant
34762
694}-
695-
696/*!-
697 Reads a boolean value from the stream into \a i. Returns a-
698 reference to the stream.-
699*/-
700QDataStream &QDataStream::operator>>(bool &i)-
701{-
702 qint8 v;-
703 *this >> v;-
704 i = !!v;-
705 return *this;
executed 17617 times by 18 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPrinter
  • tst_QSplitter
  • tst_QTimeZone
  • tst_languageChange
17617
706}-
707-
708/*!-
709 \overload-
710-
711 Reads a floating point number from the stream into \a f,-
712 using the standard IEEE 754 format. Returns a reference to the-
713 stream.-
714-
715 \sa setFloatingPointPrecision()-
716*/-
717-
718QDataStream &QDataStream::operator>>(float &f)-
719{-
720 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 38 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
  • tst_QVariant
FALSEnever evaluated
0-38
721 && floatingPointPrecision() == QDataStream::DoublePrecision) {
floatingPointP...oublePrecisionDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
  • tst_QVariant
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QDataStream
12-26
722 double d;-
723 *this >> d;-
724 f = d;-
725 return *this;
executed 12 times by 3 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QMetaType
  • tst_QVariant
12
726 }-
727-
728 f = 0.0f;-
729 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QDataStream
0-26
730 if (dev->read((char *)&f, 4) != 4) {
dev->read((char *)&f, 4) != 4Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QDataStream
10-16
731 f = 0.0f;-
732 setStatus(ReadPastEnd);-
733 } else {
executed 10 times by 1 test: end of block
Executed by:
  • tst_QDataStream
10
734 if (!noswap) {
!noswapDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDataStream
6-10
735 union {-
736 float val1;-
737 quint32 val2;-
738 } x;-
739 x.val2 = qbswap(*reinterpret_cast<quint32 *>(&f));-
740 f = x.val1;-
741 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QDataStream
10
742 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_QDataStream
16
743 return *this;
executed 26 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
26
744}-
745-
746/*!-
747 \overload-
748-
749 Reads a floating point number from the stream into \a f,-
750 using the standard IEEE 754 format. Returns a reference to the-
751 stream.-
752-
753 \sa setFloatingPointPrecision()-
754*/-
755-
756QDataStream &QDataStream::operator>>(double &f)-
757{-
758 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 9326 times by 13 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
FALSEevaluated 3248 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QFont
3248-9326
759 && floatingPointPrecision() == QDataStream::SinglePrecision) {
floatingPointP...inglePrecisionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 9325 times by 13 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
1-9325
760 float d;-
761 *this >> d;-
762 f = d;-
763 return *this;
executed 1 time by 1 test: return *this;
Executed by:
  • tst_QDataStream
1
764 }-
765-
766 f = 0.0;-
767 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 12573 times by 13 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
0-12573
768 if (dev->read((char *)&f, 8) != 8) {
dev->read((char *)&f, 8) != 8Description
TRUEevaluated 46 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
FALSEevaluated 12527 times by 13 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
46-12527
769 f = 0.0;-
770 setStatus(ReadPastEnd);-
771 } else {
executed 46 times by 2 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QMetaType
46
772 if (!noswap) {
!noswapDescription
TRUEevaluated 12520 times by 13 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QDataStream
7-12520
773 union {-
774 double val1;-
775 quint64 val2;-
776 } x;-
777 x.val2 = qbswap(*reinterpret_cast<quint64 *>(&f));-
778 f = x.val1;-
779 }
executed 12520 times by 13 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
12520
780 }
executed 12527 times by 13 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
12527
781 return *this;
executed 12573 times by 13 tests: return *this;
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QVariant
12573
782}-
783-
784-
785/*!-
786 \overload-
787-
788 Reads the '\\0'-terminated string \a s from the stream and returns-
789 a reference to the stream.-
790-
791 The string is deserialized using \c{readBytes()}.-
792-
793 Space for the string is allocated using \c{new []} -- the caller must-
794 destroy it with \c{delete []}.-
795-
796 \sa readBytes(), readRawData()-
797*/-
798-
799QDataStream &QDataStream::operator>>(char *&s)-
800{-
801 uint len = 0;-
802 return readBytes(s, len);
executed 28 times by 1 test: return readBytes(s, len);
Executed by:
  • tst_QDataStream
28
803}-
804-
805-
806/*!-
807 Reads the buffer \a s from the stream and returns a reference to-
808 the stream.-
809-
810 The buffer \a s is allocated using \c{new []}. Destroy it with the-
811 \c{delete []} operator.-
812-
813 The \a l parameter is set to the length of the buffer. If the-
814 string read is empty, \a l is set to 0 and \a s is set to-
815 a null pointer.-
816-
817 The serialization format is a quint32 length specifier first,-
818 then \a l bytes of data.-
819-
820 \sa readRawData(), writeBytes()-
821*/-
822-
823QDataStream &QDataStream::readBytes(char *&s, uint &l)-
824{-
825 s = 0;-
826 l = 0;-
827 CHECK_STREAM_PRECOND(*this)
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_QDataStream
0-56
828-
829 quint32 len;-
830 *this >> len;-
831 if (len == 0)
len == 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_QDataStream
10-46
832 return *this;
executed 10 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
10
833-
834 const quint32 Step = 1024 * 1024;-
835 quint32 allocated = 0;-
836 char *prevBuf = 0;-
837 char *curBuf = 0;-
838-
839 do {-
840 int blockSize = qMin(Step, len - allocated);-
841 prevBuf = curBuf;-
842 curBuf = new char[allocated + blockSize + 1];-
843 if (prevBuf) {
prevBufDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_QDataStream
28-46
844 memcpy(curBuf, prevBuf, allocated);-
845 delete [] prevBuf;-
846 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QDataStream
28
847 if (dev->read(curBuf + allocated, blockSize) != blockSize) {
dev->read(curB...) != blockSizeDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QDataStream
24-50
848 delete [] curBuf;-
849 setStatus(ReadPastEnd);-
850 return *this;
executed 24 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
24
851 }-
852 allocated += blockSize;-
853 } while (allocated < len);
executed 50 times by 1 test: end of block
Executed by:
  • tst_QDataStream
allocated < lenDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_QDataStream
22-50
854-
855 s = curBuf;-
856 s[len] = '\0';-
857 l = (uint)len;-
858 return *this;
executed 22 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
22
859}-
860-
861/*!-
862 Reads at most \a len bytes from the stream into \a s and returns the number of-
863 bytes read. If an error occurs, this function returns -1.-
864-
865 The buffer \a s must be preallocated. The data is \e not encoded.-
866-
867 \sa readBytes(), QIODevice::read(), writeRawData()-
868*/-
869-
870int QDataStream::readRawData(char *s, int len)-
871{-
872 CHECK_STREAM_PRECOND(-1)
never executed: return -1;
!devDescription
TRUEnever evaluated
FALSEevaluated 18453 times by 41 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
0-18453
873 return dev->read(s, len);
executed 18453 times by 41 tests: return dev->read(s, len);
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
18453
874}-
875-
876-
877/*****************************************************************************-
878 QDataStream write functions-
879 *****************************************************************************/-
880-
881-
882/*!-
883 \fn QDataStream &QDataStream::operator<<(quint8 i)-
884 \overload-
885-
886 Writes an unsigned byte, \a i, to the stream and returns a-
887 reference to the stream.-
888*/-
889-
890/*!-
891 Writes a signed byte, \a i, to the stream and returns a reference-
892 to the stream.-
893*/-
894-
895QDataStream &QDataStream::operator<<(qint8 i)-
896{-
897 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 27410 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 27408 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
0-27410
898 if (!dev->putChar(i))
!dev->putChar(i)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 27406 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
2-27406
899 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
900 return *this;
executed 27408 times by 31 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFile
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
27408
901}-
902-
903-
904/*!-
905 \fn QDataStream &QDataStream::operator<<(quint16 i)-
906 \overload-
907-
908 Writes an unsigned 16-bit integer, \a i, to the stream and returns-
909 a reference to the stream.-
910*/-
911-
912/*!-
913 \overload-
914-
915 Writes a signed 16-bit integer, \a i, to the stream and returns a-
916 reference to the stream.-
917*/-
918-
919QDataStream &QDataStream::operator<<(qint16 i)-
920{-
921 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 20192 times by 19 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 20190 times by 19 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
0-20192
922 if (!noswap) {
!noswapDescription
TRUEevaluated 19900 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
FALSEevaluated 290 times by 5 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
290-19900
923 i = qbswap(i);-
924 }
executed 19900 times by 14 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
19900
925 if (dev->write((char *)&i, sizeof(qint16)) != sizeof(qint16))
dev->write((ch...sizeof(qint16)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 20188 times by 19 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
2-20188
926 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
927 return *this;
executed 20190 times by 19 tests: return *this;
Executed by:
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QFont
  • tst_QGuiVariant
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaType
  • tst_QPen
  • tst_QPicture
  • tst_QPixmap
  • tst_QPrinter
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
  • tst_QWidget
20190
928}-
929-
930/*!-
931 \overload-
932-
933 Writes a signed 32-bit integer, \a i, to the stream and returns a-
934 reference to the stream.-
935*/-
936-
937QDataStream &QDataStream::operator<<(qint32 i)-
938{-
939 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 3 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 74296 times by 56 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
q_status != OkDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 74293 times by 56 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
0-74296
940 if (!noswap) {
!noswapDescription
TRUEevaluated 73794 times by 53 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • ...
FALSEevaluated 499 times by 5 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPixmap
499-73794
941 i = qbswap(i);-
942 }
executed 73794 times by 53 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • ...
73794
943 if (dev->write((char *)&i, sizeof(qint32)) != sizeof(qint32))
dev->write((ch...sizeof(qint32)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 74290 times by 56 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
3-74290
944 q_status = WriteFailed;
executed 3 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
3
945 return *this;
executed 74293 times by 56 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QKeySequence
  • tst_QListWidget
  • tst_QLocalSocket
  • tst_QMainWindow
  • tst_QMargins
  • ...
74293
946}-
947-
948/*!-
949 \fn QDataStream &QDataStream::operator<<(quint64 i)-
950 \overload-
951-
952 Writes an unsigned 64-bit integer, \a i, to the stream and returns a-
953 reference to the stream.-
954*/-
955-
956/*!-
957 \overload-
958-
959 Writes a signed 64-bit integer, \a i, to the stream and returns a-
960 reference to the stream.-
961*/-
962-
963QDataStream &QDataStream::operator<<(qint64 i)-
964{-
965 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 5666 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 5664 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
0-5666
966 if (version() < 6) {
version() < 6Description
TRUEnever evaluated
FALSEevaluated 5664 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
0-5664
967 quint32 i1 = i & 0xffffffff;-
968 quint32 i2 = i >> 32;-
969 *this << i2 << i1;-
970 } else {
never executed: end of block
0
971 if (!noswap) {
!noswapDescription
TRUEevaluated 5660 times by 11 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAuthenticator
4-5660
972 i = qbswap(i);-
973 }
executed 5660 times by 11 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
5660
974 if (dev->write((char *)&i, sizeof(qint64)) != sizeof(qint64))
dev->write((ch...sizeof(qint64)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 5662 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
2-5662
975 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
976 }
executed 5664 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
5664
977 return *this;
executed 5664 times by 12 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QLocalSocket
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QVariant
5664
978}-
979-
980/*!-
981 \fn QDataStream &QDataStream::operator<<(quint32 i)-
982 \overload-
983-
984 Writes an unsigned integer, \a i, to the stream as a 32-bit-
985 unsigned integer (quint32). Returns a reference to the stream.-
986*/-
987-
988/*!-
989 Writes a boolean value, \a i, to the stream. Returns a reference-
990 to the stream.-
991*/-
992-
993QDataStream &QDataStream::operator<<(bool i)-
994{-
995 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 1 time by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 2132 times by 17 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
q_status != OkDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 2131 times by 17 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
0-2132
996 if (!dev->putChar(qint8(i)))
!dev->putChar(qint8(i))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 2130 times by 17 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
1-2130
997 q_status = WriteFailed;
executed 1 time by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
1
998 return *this;
executed 2131 times by 17 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPen
  • tst_QPicture
  • tst_QPrinter
  • tst_QSplitter
  • tst_languageChange
2131
999}-
1000-
1001/*!-
1002 \overload-
1003-
1004 Writes a floating point number, \a f, to the stream using-
1005 the standard IEEE 754 format. Returns a reference to the stream.-
1006-
1007 \sa setFloatingPointPrecision()-
1008*/-
1009-
1010QDataStream &QDataStream::operator<<(float f)-
1011{-
1012 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 14 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
  • tst_QVariant
FALSEnever evaluated
0-14
1013 && floatingPointPrecision() == QDataStream::DoublePrecision) {
floatingPointP...oublePrecisionDescription
TRUEevaluated 10 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
  • tst_QVariant
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
4-10
1014 *this << double(f);-
1015 return *this;
executed 10 times by 3 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QMetaType
  • tst_QVariant
10
1016 }-
1017-
1018 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
q_status != OkDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
0-4
1019 float g = f; // fixes float-on-stack problem-
1020 if (!noswap) {
!noswapDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEnever evaluated
0-4
1021 union {-
1022 float val1;-
1023 quint32 val2;-
1024 } x;-
1025 x.val1 = g;-
1026 x.val2 = qbswap(x.val2);-
1027-
1028 if (dev->write((char *)&x.val2, sizeof(float)) != sizeof(float))
dev->write((ch... sizeof(float)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDataStream
0-4
1029 q_status = WriteFailed;
never executed: q_status = WriteFailed;
0
1030 return *this;
executed 4 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
4
1031 }-
1032-
1033 if (dev->write((char *)&g, sizeof(float)) != sizeof(float))
dev->write((ch... sizeof(float)Description
TRUEnever evaluated
FALSEnever evaluated
0
1034 q_status = WriteFailed;
never executed: q_status = WriteFailed;
0
1035 return *this;
never executed: return *this;
0
1036}-
1037-
1038-
1039/*!-
1040 \overload-
1041-
1042 Writes a floating point number, \a f, to the stream using-
1043 the standard IEEE 754 format. Returns a reference to the stream.-
1044-
1045 \sa setFloatingPointPrecision()-
1046*/-
1047-
1048QDataStream &QDataStream::operator<<(double f)-
1049{-
1050 if (version() >= QDataStream::Qt_4_6
version() >= Q...Stream::Qt_4_6Description
TRUEevaluated 28980 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
FALSEevaluated 3187 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QFont
3187-28980
1051 && floatingPointPrecision() == QDataStream::SinglePrecision) {
floatingPointP...inglePrecisionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 28979 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
1-28979
1052 *this << float(f);-
1053 return *this;
executed 1 time by 1 test: return *this;
Executed by:
  • tst_QDataStream
1
1054 }-
1055-
1056 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 32166 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
q_status != OkDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 32164 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
0-32166
1057 if (noswap) {
noswapDescription
TRUEnever evaluated
FALSEevaluated 32164 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
0-32164
1058 if (dev->write((char *)&f, sizeof(double)) != sizeof(double))
dev->write((ch...sizeof(double)Description
TRUEnever evaluated
FALSEnever evaluated
0
1059 q_status = WriteFailed;
never executed: q_status = WriteFailed;
0
1060 } else {
never executed: end of block
0
1061 union {-
1062 double val1;-
1063 quint64 val2;-
1064 } x;-
1065 x.val1 = f;-
1066 x.val2 = qbswap(x.val2);-
1067 if (dev->write((char *)&x.val2, sizeof(double)) != sizeof(double))
dev->write((ch...sizeof(double)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 32162 times by 14 tests
Evaluated by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
2-32162
1068 q_status = WriteFailed;
executed 2 times by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
2
1069 }
executed 32164 times by 14 tests: end of block
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
32164
1070 return *this;
executed 32164 times by 14 tests: return *this;
Executed by:
  • tst_QBrush
  • tst_QDataStream
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMargins
  • tst_QMetaType
  • tst_QPainterPath
  • tst_QPen
  • tst_QPicture
  • tst_QPointF
  • tst_QPrinter
  • tst_QStandardItem
  • tst_QStyleSheetStyle
  • tst_QVariant
32164
1071}-
1072-
1073-
1074/*!-
1075 \overload-
1076-
1077 Writes the '\\0'-terminated string \a s to the stream and returns a-
1078 reference to the stream.-
1079-
1080 The string is serialized using \c{writeBytes()}.-
1081-
1082 \sa writeBytes(), writeRawData()-
1083*/-
1084-
1085QDataStream &QDataStream::operator<<(const char *s)-
1086{-
1087 if (!s) {
!sDescription
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QVariant
0-4
1088 *this << (quint32)0;-
1089 return *this;
never executed: return *this;
0
1090 }-
1091 uint len = qstrlen(s) + 1; // also write null terminator-
1092 *this << (quint32)len; // write length specifier-
1093 writeRawData(s, len);-
1094 return *this;
executed 4 times by 2 tests: return *this;
Executed by:
  • tst_QDataStream
  • tst_QVariant
4
1095}-
1096-
1097-
1098/*!-
1099 Writes the length specifier \a len and the buffer \a s to the-
1100 stream and returns a reference to the stream.-
1101-
1102 The \a len is serialized as a quint32, followed by \a len bytes-
1103 from \a s. Note that the data is \e not encoded.-
1104-
1105 \sa writeRawData(), readBytes()-
1106*/-
1107-
1108QDataStream &QDataStream::writeBytes(const char *s, uint len)-
1109{-
1110 CHECK_STREAM_WRITE_PRECOND(*this)
never executed: return *this;
never executed: return *this;
!devDescription
TRUEnever evaluated
FALSEevaluated 15693 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
q_status != OkDescription
TRUEnever evaluated
FALSEevaluated 15693 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
0-15693
1111 *this << (quint32)len; // write length specifier-
1112 if (len)
lenDescription
TRUEevaluated 15469 times by 31 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
FALSEevaluated 224 times by 7 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaObjectBuilder
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QVariant
224-15469
1113 writeRawData(s, len);
executed 15469 times by 31 tests: writeRawData(s, len);
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
15469
1114 return *this;
executed 15693 times by 31 tests: return *this;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHostAddress
  • tst_QIcon
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSettings
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
15693
1115}-
1116-
1117-
1118/*!-
1119 Writes \a len bytes from \a s to the stream. Returns the-
1120 number of bytes actually written, or -1 on error.-
1121 The data is \e not encoded.-
1122-
1123 \sa writeBytes(), QIODevice::write(), readRawData()-
1124*/-
1125-
1126int QDataStream::writeRawData(const char *s, int len)-
1127{-
1128 CHECK_STREAM_WRITE_PRECOND(-1)
never executed: return -1;
executed 3 times by 1 test: return -1;
Executed by:
  • tst_QDataStream
!devDescription
TRUEnever evaluated
FALSEevaluated 16953 times by 40 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
q_status != OkDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 16950 times by 40 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
0-16953
1129 int ret = dev->write(s, len);-
1130 if (ret != len)
ret != lenDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 16949 times by 40 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
1-16949
1131 q_status = WriteFailed;
executed 1 time by 1 test: q_status = WriteFailed;
Executed by:
  • tst_QDataStream
1
1132 return ret;
executed 16950 times by 40 tests: return ret;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QHeaderView
  • tst_QHostAddress
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPicture
  • ...
16950
1133}-
1134-
1135/*!-
1136 \since 4.1-
1137-
1138 Skips \a len bytes from the device. Returns the number of bytes-
1139 actually skipped, or -1 on error.-
1140-
1141 This is equivalent to calling readRawData() on a buffer of length-
1142 \a len and ignoring the buffer.-
1143-
1144 \sa QIODevice::seek()-
1145*/-
1146int QDataStream::skipRawData(int len)-
1147{-
1148 CHECK_STREAM_PRECOND(-1)
never executed: return -1;
!devDescription
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
0-24
1149-
1150 if (dev->isSequential()) {
dev->isSequential()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
3-21
1151 char buf[4096];-
1152 int sumRead = 0;-
1153-
1154 while (len > 0) {
len > 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDataStream
3-9
1155 int blockSize = qMin(len, (int)sizeof(buf));-
1156 int n = dev->read(buf, blockSize);-
1157 if (n == -1)
n == -1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDataStream
0-9
1158 return -1;
never executed: return -1;
0
1159 if (n == 0)
n == 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDataStream
0-9
1160 return sumRead;
never executed: return sumRead;
0
1161-
1162 sumRead += n;-
1163 len -= blockSize;-
1164 }
executed 9 times by 1 test: end of block
Executed by:
  • tst_QDataStream
9
1165 return sumRead;
executed 3 times by 1 test: return sumRead;
Executed by:
  • tst_QDataStream
3
1166 } else {-
1167 qint64 pos = dev->pos();-
1168 qint64 size = dev->size();-
1169 if (pos + len > size)
pos + len > sizeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
1-20
1170 len = size - pos;
executed 1 time by 1 test: len = size - pos;
Executed by:
  • tst_QDataStream
1
1171 if (!dev->seek(pos + len))
!dev->seek(pos + len)Description
TRUEnever evaluated
FALSEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QDataStream
0-21
1172 return -1;
never executed: return -1;
0
1173 return len;
executed 21 times by 2 tests: return len;
Executed by:
  • tst_QAuthenticator
  • tst_QDataStream
21
1174 }-
1175}-
1176-
1177QT_END_NAMESPACE-
1178-
1179#endif // QT_NO_DATASTREAM-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9