Line | Source Code | Coverage |
---|
1 | static const int QTEXTSTREAM_BUFFERSIZE = 16384; | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | class QDeviceClosedNotifier : public QObject | - |
13 | { | - |
14 | public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; | - |
15 | public: | - |
16 | inline QDeviceClosedNotifier() | - |
17 | { } | - |
18 | | - |
19 | inline void setupDevice(QTextStream *stream, QIODevice *device) | - |
20 | { | - |
21 | disconnect(); | - |
22 | if (device) evaluated: device yes Evaluation Count:3398 | yes Evaluation Count:1 |
| 1-3398 |
23 | connect(device, "2""aboutToClose()", this, "1""flushStream()"); executed: connect(device, "2""aboutToClose()", this, "1""flushStream()"); Execution Count:3398 | 3398 |
24 | this->stream = stream; | - |
25 | } executed: } Execution Count:3399 | 3399 |
26 | | - |
27 | public : | - |
28 | inline void flushStream() { stream->flush(); } executed: } Execution Count:230 | 230 |
29 | | - |
30 | private: | - |
31 | QTextStream *stream; | - |
32 | }; | - |
33 | | - |
34 | | - |
35 | | - |
36 | class QTextStreamPrivate | - |
37 | { | - |
38 | inline QTextStream* q_func() { return static_cast<QTextStream *>(q_ptr); } inline const QTextStream* q_func() const { return static_cast<const QTextStream *>(q_ptr); } friend class QTextStream; | - |
39 | public: | - |
40 | QTextStreamPrivate(QTextStream *q_ptr); | - |
41 | ~QTextStreamPrivate(); | - |
42 | void reset(); | - |
43 | | - |
44 | | - |
45 | QIODevice *device; | - |
46 | | - |
47 | QDeviceClosedNotifier deviceClosedNotifier; | - |
48 | | - |
49 | bool deleteDevice; | - |
50 | | - |
51 | | - |
52 | QString *string; | - |
53 | int stringOffset; | - |
54 | QIODevice::OpenMode stringOpenMode; | - |
55 | | - |
56 | | - |
57 | | - |
58 | QTextCodec *codec; | - |
59 | QTextCodec::ConverterState readConverterState; | - |
60 | QTextCodec::ConverterState writeConverterState; | - |
61 | QTextCodec::ConverterState *readConverterSavedState; | - |
62 | bool autoDetectUnicode; | - |
63 | | - |
64 | | - |
65 | | - |
66 | enum TokenDelimiter { | - |
67 | Space, | - |
68 | NotSpace, | - |
69 | EndOfLine | - |
70 | }; | - |
71 | | - |
72 | QString read(int maxlen); | - |
73 | bool scan(const QChar **ptr, int *tokenLength, | - |
74 | int maxlen, TokenDelimiter delimiter); | - |
75 | inline const QChar *readPtr() const; | - |
76 | inline void consumeLastToken(); | - |
77 | inline void consume(int nchars); | - |
78 | void saveConverterState(qint64 newPos); | - |
79 | void restoreToSavedConverterState(); | - |
80 | int lastTokenSize; | - |
81 | | - |
82 | | - |
83 | enum NumberParsingStatus { | - |
84 | npsOk, | - |
85 | npsMissingDigit, | - |
86 | npsInvalidPrefix | - |
87 | }; | - |
88 | | - |
89 | inline bool getChar(QChar *ch); | - |
90 | inline void ungetChar(QChar ch); | - |
91 | NumberParsingStatus getNumber(qulonglong *l); | - |
92 | bool getReal(double *f); | - |
93 | | - |
94 | inline void write(const QString &data); | - |
95 | inline void putString(const QString &ch, bool number = false); | - |
96 | void putNumber(qulonglong number, bool negative); | - |
97 | | - |
98 | | - |
99 | bool fillReadBuffer(qint64 maxBytes = -1); | - |
100 | void resetReadBuffer(); | - |
101 | void flushWriteBuffer(); | - |
102 | QString writeBuffer; | - |
103 | QString readBuffer; | - |
104 | int readBufferOffset; | - |
105 | int readConverterSavedStateOffset; | - |
106 | qint64 readBufferStartDevicePos; | - |
107 | | - |
108 | | - |
109 | int realNumberPrecision; | - |
110 | int integerBase; | - |
111 | int fieldWidth; | - |
112 | QChar padChar; | - |
113 | QTextStream::FieldAlignment fieldAlignment; | - |
114 | QTextStream::RealNumberNotation realNumberNotation; | - |
115 | QTextStream::NumberFlags numberFlags; | - |
116 | | - |
117 | | - |
118 | QTextStream::Status status; | - |
119 | | - |
120 | QLocale locale; | - |
121 | | - |
122 | QTextStream *q_ptr; | - |
123 | }; | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr) | - |
129 | : | - |
130 | | - |
131 | readConverterSavedState(0), | - |
132 | | - |
133 | readConverterSavedStateOffset(0), | - |
134 | locale(QLocale::c()) | - |
135 | { | - |
136 | this->q_ptr = q_ptr; | - |
137 | reset(); | - |
138 | } executed: } Execution Count:5122 | 5122 |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | QTextStreamPrivate::~QTextStreamPrivate() | - |
144 | { | - |
145 | if (deleteDevice) { evaluated: deleteDevice yes Evaluation Count:577 | yes Evaluation Count:4545 |
| 577-4545 |
146 | | - |
147 | device->blockSignals(true); | - |
148 | | - |
149 | delete device; | - |
150 | } executed: } Execution Count:577 | 577 |
151 | | - |
152 | delete readConverterSavedState; | - |
153 | | - |
154 | } executed: } Execution Count:5122 | 5122 |
155 | | - |
156 | | - |
157 | static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state) | - |
158 | { | - |
159 | state->~ConverterState(); | - |
160 | new (state) QTextCodec::ConverterState; | - |
161 | } executed: } Execution Count:440993 | 440993 |
162 | | - |
163 | static void copyConverterStateHelper(QTextCodec::ConverterState *dest, | - |
164 | const QTextCodec::ConverterState *src) | - |
165 | { | - |
166 | | - |
167 | | - |
168 | qt_noop(); | - |
169 | dest->flags = src->flags; | - |
170 | dest->invalidChars = src->invalidChars; | - |
171 | dest->state_data[0] = src->state_data[0]; | - |
172 | dest->state_data[1] = src->state_data[1]; | - |
173 | dest->state_data[2] = src->state_data[2]; | - |
174 | } executed: } Execution Count:2623 | 2623 |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
179 | | - |
180 | void QTextStreamPrivate::reset() | - |
181 | { | - |
182 | realNumberPrecision = 6; | - |
183 | integerBase = 0; | - |
184 | fieldWidth = 0; | - |
185 | padChar = QLatin1Char(' '); | - |
186 | fieldAlignment = QTextStream::AlignRight; | - |
187 | realNumberNotation = QTextStream::SmartNotation; | - |
188 | numberFlags = 0; | - |
189 | | - |
190 | device = 0; | - |
191 | deleteDevice = false; | - |
192 | string = 0; | - |
193 | stringOffset = 0; | - |
194 | stringOpenMode = QIODevice::NotOpen; | - |
195 | | - |
196 | readBufferOffset = 0; | - |
197 | readBufferStartDevicePos = 0; | - |
198 | lastTokenSize = 0; | - |
199 | | - |
200 | | - |
201 | codec = QTextCodec::codecForLocale(); | - |
202 | resetCodecConverterStateHelper(&readConverterState); | - |
203 | resetCodecConverterStateHelper(&writeConverterState); | - |
204 | delete readConverterSavedState; | - |
205 | readConverterSavedState = 0; | - |
206 | writeConverterState.flags |= QTextCodec::IgnoreHeader; | - |
207 | autoDetectUnicode = true; | - |
208 | | - |
209 | } executed: } Execution Count:5138 | 5138 |
210 | | - |
211 | | - |
212 | | - |
213 | | - |
214 | bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) | - |
215 | { | - |
216 | | - |
217 | | - |
218 | qt_noop(); | - |
219 | qt_noop(); | - |
220 | | - |
221 | | - |
222 | bool textModeEnabled = device->isTextModeEnabled(); | - |
223 | if (textModeEnabled) evaluated: textModeEnabled yes Evaluation Count:41040032 | yes Evaluation Count:2424 |
| 2424-41040032 |
224 | device->setTextModeEnabled(false); executed: device->setTextModeEnabled(false); Execution Count:41040032 | 41040032 |
225 | | - |
226 | | - |
227 | char buf[QTEXTSTREAM_BUFFERSIZE]; | - |
228 | qint64 bytesRead = 0; | - |
229 | { | - |
230 | if (maxBytes != -1) evaluated: maxBytes != -1 yes Evaluation Count:41035294 | yes Evaluation Count:7162 |
| 7162-41035294 |
231 | bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes)); executed: bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes)); Execution Count:41035294 | 41035294 |
232 | else | - |
233 | bytesRead = device->read(buf, sizeof(buf)); executed: bytesRead = device->read(buf, sizeof(buf)); Execution Count:7162 | 7162 |
234 | } | - |
235 | | - |
236 | | - |
237 | | - |
238 | | - |
239 | if (!codec || autoDetectUnicode) { partially evaluated: !codec no Evaluation Count:0 | yes Evaluation Count:41042456 |
evaluated: autoDetectUnicode yes Evaluation Count:4493 | yes Evaluation Count:41037963 |
| 0-41042456 |
240 | autoDetectUnicode = false; | - |
241 | | - |
242 | codec = QTextCodec::codecForUtfText(QByteArray::fromRawData(buf, bytesRead), codec); | - |
243 | if (!codec) { partially evaluated: !codec no Evaluation Count:0 | yes Evaluation Count:4493 |
| 0-4493 |
244 | codec = QTextCodec::codecForLocale(); | - |
245 | writeConverterState.flags |= QTextCodec::IgnoreHeader; | - |
246 | } | 0 |
247 | } executed: } Execution Count:4493 | 4493 |
248 | if (bytesRead <= 0) evaluated: bytesRead <= 0 yes Evaluation Count:2512 | yes Evaluation Count:41039944 |
| 2512-41039944 |
249 | return false; executed: return false; Execution Count:2512 | 2512 |
250 | | - |
251 | int oldReadBufferSize = readBuffer.size(); | - |
252 | | - |
253 | | - |
254 | readBuffer += codec->toUnicode(buf, bytesRead, &readConverterState); | - |
255 | | - |
256 | | - |
257 | | - |
258 | | - |
259 | | - |
260 | if (textModeEnabled) evaluated: textModeEnabled yes Evaluation Count:41038132 | yes Evaluation Count:1812 |
| 1812-41038132 |
261 | device->setTextModeEnabled(true); executed: device->setTextModeEnabled(true); Execution Count:41038132 | 41038132 |
262 | | - |
263 | | - |
264 | if (readBuffer.size() > oldReadBufferSize && textModeEnabled) { evaluated: readBuffer.size() > oldReadBufferSize yes Evaluation Count:41039262 | yes Evaluation Count:682 |
evaluated: textModeEnabled yes Evaluation Count:41037806 | yes Evaluation Count:1456 |
| 682-41039262 |
265 | QChar CR = QLatin1Char('\r'); | - |
266 | QChar *writePtr = readBuffer.data() + oldReadBufferSize; | - |
267 | QChar *readPtr = readBuffer.data() + oldReadBufferSize; | - |
268 | QChar *endPtr = readBuffer.data() + readBuffer.size(); | - |
269 | | - |
270 | int n = oldReadBufferSize; | - |
271 | if (readPtr < endPtr) { partially evaluated: readPtr < endPtr yes Evaluation Count:41037806 | no Evaluation Count:0 |
| 0-41037806 |
272 | | - |
273 | while (*readPtr++ != CR) { evaluated: *readPtr++ != CR yes Evaluation Count:63891754 | yes Evaluation Count:110 |
| 110-63891754 |
274 | ++n; | - |
275 | if (++writePtr == endPtr) evaluated: ++writePtr == endPtr yes Evaluation Count:41037696 | yes Evaluation Count:22854058 |
| 22854058-41037696 |
276 | break; executed: break; Execution Count:41037696 | 41037696 |
277 | } executed: } Execution Count:22854058 | 22854058 |
278 | } executed: } Execution Count:41037806 | 41037806 |
279 | while (readPtr < endPtr) { evaluated: readPtr < endPtr yes Evaluation Count:146620 | yes Evaluation Count:41037806 |
| 146620-41037806 |
280 | QChar ch = *readPtr++; | - |
281 | if (ch != CR) { evaluated: ch != CR yes Evaluation Count:124415 | yes Evaluation Count:22205 |
| 22205-124415 |
282 | *writePtr++ = ch; | - |
283 | } else { executed: } Execution Count:124415 | 124415 |
284 | if (n < readBufferOffset) partially evaluated: n < readBufferOffset no Evaluation Count:0 | yes Evaluation Count:22205 |
| 0-22205 |
285 | --readBufferOffset; never executed: --readBufferOffset; | 0 |
286 | --bytesRead; | - |
287 | } executed: } Execution Count:22205 | 22205 |
288 | ++n; | - |
289 | } executed: } Execution Count:146620 | 146620 |
290 | readBuffer.resize(writePtr - readBuffer.data()); | - |
291 | } executed: } Execution Count:41037806 | 41037806 |
292 | | - |
293 | | - |
294 | | - |
295 | | - |
296 | | - |
297 | return true; executed: return true; Execution Count:41039944 | 41039944 |
298 | } | - |
299 | | - |
300 | | - |
301 | | - |
302 | | - |
303 | void QTextStreamPrivate::resetReadBuffer() | - |
304 | { | - |
305 | readBuffer.clear(); | - |
306 | readBufferOffset = 0; | - |
307 | readBufferStartDevicePos = (device ? device->pos() : 0); evaluated: device yes Evaluation Count:214479 | yes Evaluation Count:1 |
| 1-214479 |
308 | } executed: } Execution Count:214480 | 214480 |
309 | | - |
310 | | - |
311 | | - |
312 | | - |
313 | void QTextStreamPrivate::flushWriteBuffer() | - |
314 | { | - |
315 | | - |
316 | | - |
317 | if (string || !device) evaluated: string yes Evaluation Count:15360 | yes Evaluation Count:249715 |
evaluated: !device yes Evaluation Count:13 | yes Evaluation Count:249702 |
| 13-249715 |
318 | return; executed: return; Execution Count:15373 | 15373 |
319 | | - |
320 | | - |
321 | | - |
322 | if (status != QTextStream::Ok) evaluated: status != QTextStream::Ok yes Evaluation Count:3 | yes Evaluation Count:249699 |
| 3-249699 |
323 | return; executed: return; Execution Count:3 | 3 |
324 | | - |
325 | if (writeBuffer.isEmpty()) evaluated: writeBuffer.isEmpty() yes Evaluation Count:214758 | yes Evaluation Count:34941 |
| 34941-214758 |
326 | return; executed: return; Execution Count:214758 | 214758 |
327 | if (!codec) partially evaluated: !codec no Evaluation Count:0 | yes Evaluation Count:34941 |
| 0-34941 |
328 | codec = QTextCodec::codecForLocale(); never executed: codec = QTextCodec::codecForLocale(); | 0 |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | QByteArray data = codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState); | - |
336 | | - |
337 | | - |
338 | | - |
339 | writeBuffer.clear(); | - |
340 | | - |
341 | | - |
342 | qint64 bytesWritten = device->write(data); | - |
343 | | - |
344 | | - |
345 | | - |
346 | | - |
347 | if (bytesWritten <= 0) { evaluated: bytesWritten <= 0 yes Evaluation Count:2 | yes Evaluation Count:34939 |
| 2-34939 |
348 | status = QTextStream::WriteFailed; | - |
349 | return; executed: return; Execution Count:2 | 2 |
350 | } | - |
351 | QFileDevice *file = qobject_cast<QFileDevice *>(device); | - |
352 | bool flushed = !file || file->flush(); evaluated: !file yes Evaluation Count:20972 | yes Evaluation Count:13967 |
partially evaluated: file->flush() yes Evaluation Count:13967 | no Evaluation Count:0 |
| 0-20972 |
353 | if (!flushed || bytesWritten != qint64(data.size())) partially evaluated: !flushed no Evaluation Count:0 | yes Evaluation Count:34939 |
partially evaluated: bytesWritten != qint64(data.size()) no Evaluation Count:0 | yes Evaluation Count:34939 |
| 0-34939 |
354 | status = QTextStream::WriteFailed; never executed: status = QTextStream::WriteFailed; | 0 |
355 | } executed: } Execution Count:34939 | 34939 |
356 | | - |
357 | QString QTextStreamPrivate::read(int maxlen) | - |
358 | { | - |
359 | QString ret; | - |
360 | if (string) { evaluated: string yes Evaluation Count:5 | yes Evaluation Count:1866 |
| 5-1866 |
361 | lastTokenSize = qMin(maxlen, string->size() - stringOffset); | - |
362 | ret = string->mid(stringOffset, lastTokenSize); | - |
363 | } else { executed: } Execution Count:5 | 5 |
364 | while (readBuffer.size() - readBufferOffset < maxlen && fillReadBuffer()) ; executed: ; Execution Count:1862 evaluated: readBuffer.size() - readBufferOffset < maxlen yes Evaluation Count:3721 | yes Evaluation Count:7 |
evaluated: fillReadBuffer() yes Evaluation Count:1862 | yes Evaluation Count:1859 |
| 7-3721 |
365 | lastTokenSize = qMin(maxlen, readBuffer.size() - readBufferOffset); | - |
366 | ret = readBuffer.mid(readBufferOffset, lastTokenSize); | - |
367 | } executed: } Execution Count:1866 | 1866 |
368 | consumeLastToken(); | - |
369 | | - |
370 | | - |
371 | | - |
372 | | - |
373 | return ret; executed: return ret; Execution Count:1871 | 1871 |
374 | } | - |
375 | bool QTextStreamPrivate::scan(const QChar **ptr, int *length, int maxlen, TokenDelimiter delimiter) | - |
376 | { | - |
377 | int totalSize = 0; | - |
378 | int delimSize = 0; | - |
379 | bool consumeDelimiter = false; | - |
380 | bool foundToken = false; | - |
381 | int startOffset = device ? readBufferOffset : stringOffset; evaluated: device yes Evaluation Count:152301 | yes Evaluation Count:128 |
| 128-152301 |
382 | QChar lastChar; | - |
383 | | - |
384 | bool canStillReadFromDevice = true; | - |
385 | do { | - |
386 | int endOffset; | - |
387 | const QChar *chPtr; | - |
388 | if (device) { evaluated: device yes Evaluation Count:155088 | yes Evaluation Count:128 |
| 128-155088 |
389 | chPtr = readBuffer.constData(); | - |
390 | endOffset = readBuffer.size(); | - |
391 | } else { executed: } Execution Count:155088 | 155088 |
392 | chPtr = string->constData(); | - |
393 | endOffset = string->size(); | - |
394 | } executed: } Execution Count:128 | 128 |
395 | chPtr += startOffset; | - |
396 | | - |
397 | for (; !foundToken && startOffset < endOffset && (!maxlen || totalSize < maxlen); ++startOffset) { evaluated: !foundToken yes Evaluation Count:2588096 | yes Evaluation Count:152158 |
evaluated: startOffset < endOffset yes Evaluation Count:2585048 | yes Evaluation Count:3048 |
evaluated: !maxlen yes Evaluation Count:2533832 | yes Evaluation Count:51216 |
evaluated: totalSize < maxlen yes Evaluation Count:51206 | yes Evaluation Count:10 |
| 10-2588096 |
398 | const QChar ch = *chPtr++; | - |
399 | ++totalSize; | - |
400 | | - |
401 | switch (delimiter) { | - |
402 | case Space: | - |
403 | if (ch.isSpace()) { evaluated: ch.isSpace() yes Evaluation Count:424 | yes Evaluation Count:5558 |
| 424-5558 |
404 | foundToken = true; | - |
405 | delimSize = 1; | - |
406 | } executed: } Execution Count:424 | 424 |
407 | break; executed: break; Execution Count:5982 | 5982 |
408 | case NotSpace: | - |
409 | if (!ch.isSpace()) { evaluated: !ch.isSpace() yes Evaluation Count:22943 | yes Evaluation Count:40913 |
| 22943-40913 |
410 | foundToken = true; | - |
411 | delimSize = 1; | - |
412 | } executed: } Execution Count:22943 | 22943 |
413 | break; executed: break; Execution Count:63856 | 63856 |
414 | case EndOfLine: | - |
415 | if (ch == QLatin1Char('\n')) { evaluated: ch == QLatin1Char('\n') yes Evaluation Count:128791 | yes Evaluation Count:2386409 |
| 128791-2386409 |
416 | foundToken = true; | - |
417 | delimSize = (lastChar == QLatin1Char('\r')) ? 2 : 1; evaluated: (lastChar == QLatin1Char('\r')) yes Evaluation Count:45246 | yes Evaluation Count:83545 |
| 45246-83545 |
418 | consumeDelimiter = true; | - |
419 | } executed: } Execution Count:128791 | 128791 |
420 | lastChar = ch; | - |
421 | break; executed: break; Execution Count:2515200 | 2515200 |
422 | } | - |
423 | } executed: } Execution Count:2585038 | 2585038 |
424 | } while (!foundToken executed: } Execution Count:155216 evaluated: !foundToken yes Evaluation Count:3058 | yes Evaluation Count:152158 |
| 3058-155216 |
425 | && (!maxlen || totalSize < maxlen) evaluated: !maxlen yes Evaluation Count:3030 | yes Evaluation Count:28 |
evaluated: totalSize < maxlen yes Evaluation Count:16 | yes Evaluation Count:12 |
| 12-3030 |
426 | && (device && (canStillReadFromDevice = fillReadBuffer()))); evaluated: device yes Evaluation Count:3024 | yes Evaluation Count:22 |
evaluated: (canStillReadFromDevice = fillReadBuffer()) yes Evaluation Count:2787 | yes Evaluation Count:237 |
| 22-3024 |
427 | | - |
428 | | - |
429 | | - |
430 | | - |
431 | if (!foundToken && (!maxlen || totalSize < maxlen) evaluated: !foundToken yes Evaluation Count:271 | yes Evaluation Count:152158 |
evaluated: !maxlen yes Evaluation Count:253 | yes Evaluation Count:18 |
evaluated: totalSize < maxlen yes Evaluation Count:6 | yes Evaluation Count:12 |
| 6-152158 |
432 | && (totalSize == 0 evaluated: totalSize == 0 yes Evaluation Count:74 | yes Evaluation Count:185 |
| 74-185 |
433 | || (string && stringOffset + totalSize < string->size()) evaluated: string yes Evaluation Count:20 | yes Evaluation Count:165 |
partially evaluated: stringOffset + totalSize < string->size() no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-165 |
434 | || (device && !device->atEnd() && canStillReadFromDevice))) { evaluated: device yes Evaluation Count:165 | yes Evaluation Count:20 |
partially evaluated: !device->atEnd() no Evaluation Count:0 | yes Evaluation Count:165 |
never evaluated: canStillReadFromDevice | 0-165 |
435 | | - |
436 | | - |
437 | | - |
438 | return false; executed: return false; Execution Count:74 | 74 |
439 | } | - |
440 | | - |
441 | | - |
442 | | - |
443 | if (delimiter == EndOfLine && totalSize > 0 && !foundToken) { evaluated: delimiter == EndOfLine yes Evaluation Count:128860 | yes Evaluation Count:23495 |
partially evaluated: totalSize > 0 yes Evaluation Count:128860 | no Evaluation Count:0 |
evaluated: !foundToken yes Evaluation Count:69 | yes Evaluation Count:128791 |
| 0-128860 |
444 | if (((string && stringOffset + totalSize == string->size()) || (device && device->atEnd())) evaluated: string yes Evaluation Count:15 | yes Evaluation Count:54 |
evaluated: stringOffset + totalSize == string->size() yes Evaluation Count:10 | yes Evaluation Count:5 |
evaluated: device yes Evaluation Count:54 | yes Evaluation Count:5 |
evaluated: device->atEnd() yes Evaluation Count:52 | yes Evaluation Count:2 |
| 2-54 |
445 | && lastChar == QLatin1Char('\r')) { evaluated: lastChar == QLatin1Char('\r') yes Evaluation Count:11 | yes Evaluation Count:51 |
| 11-51 |
446 | consumeDelimiter = true; | - |
447 | ++delimSize; | - |
448 | } executed: } Execution Count:11 | 11 |
449 | } executed: } Execution Count:69 | 69 |
450 | | - |
451 | | - |
452 | if (length) evaluated: length yes Evaluation Count:129313 | yes Evaluation Count:23042 |
| 23042-129313 |
453 | *length = totalSize - delimSize; executed: *length = totalSize - delimSize; Execution Count:129313 | 129313 |
454 | if (ptr) evaluated: ptr yes Evaluation Count:129313 | yes Evaluation Count:23042 |
| 23042-129313 |
455 | *ptr = readPtr(); executed: *ptr = readPtr(); Execution Count:129313 | 129313 |
456 | | - |
457 | | - |
458 | | - |
459 | lastTokenSize = totalSize; | - |
460 | if (!consumeDelimiter) evaluated: !consumeDelimiter yes Evaluation Count:23553 | yes Evaluation Count:128802 |
| 23553-128802 |
461 | lastTokenSize -= delimSize; executed: lastTokenSize -= delimSize; Execution Count:23553 | 23553 |
462 | | - |
463 | | - |
464 | | - |
465 | | - |
466 | | - |
467 | return true; executed: return true; Execution Count:152355 | 152355 |
468 | } | - |
469 | | - |
470 | | - |
471 | | - |
472 | | - |
473 | inline const QChar *QTextStreamPrivate::readPtr() const | - |
474 | { | - |
475 | qt_noop(); | - |
476 | if (string) evaluated: string yes Evaluation Count:289 | yes Evaluation Count:198649 |
| 289-198649 |
477 | return string->constData() + stringOffset; executed: return string->constData() + stringOffset; Execution Count:289 | 289 |
478 | return readBuffer.constData() + readBufferOffset; executed: return readBuffer.constData() + readBufferOffset; Execution Count:198649 | 198649 |
479 | } | - |
480 | | - |
481 | | - |
482 | | - |
483 | | - |
484 | inline void QTextStreamPrivate::consumeLastToken() | - |
485 | { | - |
486 | if (lastTokenSize) evaluated: lastTokenSize yes Evaluation Count:152574 | yes Evaluation Count:868 |
| 868-152574 |
487 | consume(lastTokenSize); executed: consume(lastTokenSize); Execution Count:152574 | 152574 |
488 | lastTokenSize = 0; | - |
489 | } executed: } Execution Count:153442 | 153442 |
490 | | - |
491 | | - |
492 | | - |
493 | | - |
494 | inline void QTextStreamPrivate::consume(int size) | - |
495 | { | - |
496 | | - |
497 | | - |
498 | | - |
499 | if (string) { evaluated: string yes Evaluation Count:333 | yes Evaluation Count:221866 |
| 333-221866 |
500 | stringOffset += size; | - |
501 | if (stringOffset > string->size()) partially evaluated: stringOffset > string->size() no Evaluation Count:0 | yes Evaluation Count:333 |
| 0-333 |
502 | stringOffset = string->size(); never executed: stringOffset = string->size(); | 0 |
503 | } else { executed: } Execution Count:333 | 333 |
504 | readBufferOffset += size; | - |
505 | if (readBufferOffset >= readBuffer.size()) { evaluated: readBufferOffset >= readBuffer.size() yes Evaluation Count:2623 | yes Evaluation Count:219243 |
| 2623-219243 |
506 | readBufferOffset = 0; | - |
507 | readBuffer.clear(); | - |
508 | saveConverterState(device->pos()); | - |
509 | } else if (readBufferOffset > QTEXTSTREAM_BUFFERSIZE) { evaluated: readBufferOffset > QTEXTSTREAM_BUFFERSIZE yes Evaluation Count:1221 | yes Evaluation Count:218022 |
executed: } Execution Count:2623 | 1221-218022 |
510 | readBuffer = readBuffer.remove(0,readBufferOffset); | - |
511 | readConverterSavedStateOffset += readBufferOffset; | - |
512 | readBufferOffset = 0; | - |
513 | } executed: } Execution Count:1221 | 1221 |
514 | } | - |
515 | } | - |
516 | | - |
517 | | - |
518 | | - |
519 | | - |
520 | inline void QTextStreamPrivate::saveConverterState(qint64 newPos) | - |
521 | { | - |
522 | | - |
523 | if (readConverterState.d) { partially evaluated: readConverterState.d no Evaluation Count:0 | yes Evaluation Count:2623 |
| 0-2623 |
524 | | - |
525 | | - |
526 | return; | 0 |
527 | } | - |
528 | | - |
529 | if (!readConverterSavedState) evaluated: !readConverterSavedState yes Evaluation Count:2593 | yes Evaluation Count:30 |
| 30-2593 |
530 | readConverterSavedState = new QTextCodec::ConverterState; executed: readConverterSavedState = new QTextCodec::ConverterState; Execution Count:2593 | 2593 |
531 | copyConverterStateHelper(readConverterSavedState, &readConverterState); | - |
532 | | - |
533 | | - |
534 | readBufferStartDevicePos = newPos; | - |
535 | readConverterSavedStateOffset = 0; | - |
536 | } executed: } Execution Count:2623 | 2623 |
537 | | - |
538 | | - |
539 | | - |
540 | | - |
541 | inline void QTextStreamPrivate::restoreToSavedConverterState() | - |
542 | { | - |
543 | | - |
544 | if (readConverterSavedState) { partially evaluated: readConverterSavedState no Evaluation Count:0 | yes Evaluation Count:1775 |
| 0-1775 |
545 | | - |
546 | | - |
547 | copyConverterStateHelper(&readConverterState, readConverterSavedState); | - |
548 | } else { | 0 |
549 | | - |
550 | | - |
551 | resetCodecConverterStateHelper(&readConverterState); | - |
552 | } executed: } Execution Count:1775 | 1775 |
553 | | - |
554 | } | - |
555 | | - |
556 | | - |
557 | | - |
558 | | - |
559 | inline void QTextStreamPrivate::write(const QString &data) | - |
560 | { | - |
561 | if (string) { evaluated: string yes Evaluation Count:191914 | yes Evaluation Count:302604 |
| 191914-302604 |
562 | | - |
563 | string->append(data); | - |
564 | } else { executed: } Execution Count:191914 | 191914 |
565 | writeBuffer += data; | - |
566 | if (writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE) evaluated: writeBuffer.size() > QTEXTSTREAM_BUFFERSIZE yes Evaluation Count:6 | yes Evaluation Count:302598 |
| 6-302598 |
567 | flushWriteBuffer(); executed: flushWriteBuffer(); Execution Count:6 | 6 |
568 | } executed: } Execution Count:302604 | 302604 |
569 | } | - |
570 | | - |
571 | | - |
572 | | - |
573 | | - |
574 | inline bool QTextStreamPrivate::getChar(QChar *ch) | - |
575 | { | - |
576 | if ((string && stringOffset == string->size()) evaluated: string yes Evaluation Count:250 | yes Evaluation Count:69802 |
evaluated: stringOffset == string->size() yes Evaluation Count:11 | yes Evaluation Count:239 |
| 11-69802 |
577 | || (device && readBuffer.isEmpty() && !fillReadBuffer())) { evaluated: device yes Evaluation Count:69802 | yes Evaluation Count:239 |
evaluated: readBuffer.isEmpty() yes Evaluation Count:417 | yes Evaluation Count:69385 |
evaluated: !fillReadBuffer() yes Evaluation Count:416 | yes Evaluation Count:1 |
| 1-69802 |
578 | if (ch) partially evaluated: ch yes Evaluation Count:427 | no Evaluation Count:0 |
| 0-427 |
579 | *ch = 0; executed: *ch = 0; Execution Count:427 | 427 |
580 | return false; executed: return false; Execution Count:427 | 427 |
581 | } | - |
582 | if (ch) partially evaluated: ch yes Evaluation Count:69625 | no Evaluation Count:0 |
| 0-69625 |
583 | *ch = *readPtr(); executed: *ch = *readPtr(); Execution Count:69625 | 69625 |
584 | consume(1); | - |
585 | return true; executed: return true; Execution Count:69625 | 69625 |
586 | } | - |
587 | | - |
588 | | - |
589 | | - |
590 | | - |
591 | inline void QTextStreamPrivate::ungetChar(QChar ch) | - |
592 | { | - |
593 | if (string) { evaluated: string yes Evaluation Count:51 | yes Evaluation Count:39055 |
| 51-39055 |
594 | if (stringOffset == 0) partially evaluated: stringOffset == 0 no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
595 | string->prepend(ch); never executed: string->prepend(ch); | 0 |
596 | else | - |
597 | (*string)[--stringOffset] = ch; executed: (*string)[--stringOffset] = ch; Execution Count:51 | 51 |
598 | return; executed: return; Execution Count:51 | 51 |
599 | } | - |
600 | | - |
601 | if (readBufferOffset == 0) { evaluated: readBufferOffset == 0 yes Evaluation Count:46 | yes Evaluation Count:39009 |
| 46-39009 |
602 | readBuffer.prepend(ch); | - |
603 | return; executed: return; Execution Count:46 | 46 |
604 | } | - |
605 | | - |
606 | readBuffer[--readBufferOffset] = ch; | - |
607 | } executed: } Execution Count:39009 | 39009 |
608 | | - |
609 | | - |
610 | | - |
611 | | - |
612 | inline void QTextStreamPrivate::putString(const QString &s, bool number) | - |
613 | { | - |
614 | QString tmp = s; | - |
615 | | - |
616 | | - |
617 | int padSize = fieldWidth - s.size(); | - |
618 | if (padSize > 0) { evaluated: padSize > 0 yes Evaluation Count:2235 | yes Evaluation Count:492283 |
| 2235-492283 |
619 | QString pad(padSize, padChar); | - |
620 | if (fieldAlignment == QTextStream::AlignLeft) { partially evaluated: fieldAlignment == QTextStream::AlignLeft no Evaluation Count:0 | yes Evaluation Count:2235 |
| 0-2235 |
621 | tmp.append(QString(padSize, padChar)); | - |
622 | } else if (fieldAlignment == QTextStream::AlignRight evaluated: fieldAlignment == QTextStream::AlignRight yes Evaluation Count:2231 | yes Evaluation Count:4 |
| 0-2231 |
623 | || fieldAlignment == QTextStream::AlignAccountingStyle) { partially evaluated: fieldAlignment == QTextStream::AlignAccountingStyle yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
624 | tmp.prepend(QString(padSize, padChar)); | - |
625 | if (fieldAlignment == QTextStream::AlignAccountingStyle && number) { evaluated: fieldAlignment == QTextStream::AlignAccountingStyle yes Evaluation Count:4 | yes Evaluation Count:2231 |
evaluated: number yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2-2231 |
626 | const QChar sign = s.size() > 0 ? s.at(0) : QChar(); partially evaluated: s.size() > 0 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
627 | if (sign == locale.negativeSign() || sign == locale.positiveSign()) { partially evaluated: sign == locale.negativeSign() yes Evaluation Count:2 | no Evaluation Count:0 |
never evaluated: sign == locale.positiveSign() | 0-2 |
628 | QChar *data = tmp.data(); | - |
629 | data[padSize] = tmp.at(0); | - |
630 | data[0] = sign; | - |
631 | } executed: } Execution Count:2 | 2 |
632 | } executed: } Execution Count:2 | 2 |
633 | } else if (fieldAlignment == QTextStream::AlignCenter) { never evaluated: fieldAlignment == QTextStream::AlignCenter executed: } Execution Count:2235 | 0-2235 |
634 | tmp.prepend(QString(padSize/2, padChar)); | - |
635 | tmp.append(QString(padSize - padSize/2, padChar)); | - |
636 | } | 0 |
637 | } | - |
638 | write(tmp); | - |
639 | } executed: } Execution Count:494518 | 494518 |
640 | | - |
641 | | - |
642 | | - |
643 | | - |
644 | | - |
645 | | - |
646 | | - |
647 | QTextStream::QTextStream() | - |
648 | : d_ptr(new QTextStreamPrivate(this)) | - |
649 | { | - |
650 | | - |
651 | | - |
652 | | - |
653 | QTextStreamPrivate * const d = d_func(); | - |
654 | d->status = Ok; | - |
655 | } executed: } Execution Count:15 | 15 |
656 | | - |
657 | | - |
658 | | - |
659 | | - |
660 | QTextStream::QTextStream(QIODevice *device) | - |
661 | : d_ptr(new QTextStreamPrivate(this)) | - |
662 | { | - |
663 | | - |
664 | | - |
665 | | - |
666 | | - |
667 | QTextStreamPrivate * const d = d_func(); | - |
668 | d->device = device; | - |
669 | | - |
670 | d->deviceClosedNotifier.setupDevice(this, d->device); | - |
671 | | - |
672 | d->status = Ok; | - |
673 | } executed: } Execution Count:2813 | 2813 |
674 | | - |
675 | | - |
676 | | - |
677 | | - |
678 | | - |
679 | QTextStream::QTextStream(QString *string, QIODevice::OpenMode openMode) | - |
680 | : d_ptr(new QTextStreamPrivate(this)) | - |
681 | { | - |
682 | | - |
683 | | - |
684 | | - |
685 | | - |
686 | QTextStreamPrivate * const d = d_func(); | - |
687 | d->string = string; | - |
688 | d->stringOpenMode = openMode; | - |
689 | d->status = Ok; | - |
690 | } executed: } Execution Count:1717 | 1717 |
691 | | - |
692 | | - |
693 | | - |
694 | | - |
695 | | - |
696 | | - |
697 | QTextStream::QTextStream(QByteArray *array, QIODevice::OpenMode openMode) | - |
698 | : d_ptr(new QTextStreamPrivate(this)) | - |
699 | { | - |
700 | | - |
701 | | - |
702 | | - |
703 | | - |
704 | QTextStreamPrivate * const d = d_func(); | - |
705 | d->device = new QBuffer(array); | - |
706 | d->device->open(openMode); | - |
707 | d->deleteDevice = true; | - |
708 | | - |
709 | d->deviceClosedNotifier.setupDevice(this, d->device); | - |
710 | | - |
711 | d->status = Ok; | - |
712 | } executed: } Execution Count:564 | 564 |
713 | QTextStream::QTextStream(const QByteArray &array, QIODevice::OpenMode openMode) | - |
714 | : d_ptr(new QTextStreamPrivate(this)) | - |
715 | { | - |
716 | | - |
717 | | - |
718 | | - |
719 | | - |
720 | QBuffer *buffer = new QBuffer; | - |
721 | buffer->setData(array); | - |
722 | buffer->open(openMode); | - |
723 | | - |
724 | QTextStreamPrivate * const d = d_func(); | - |
725 | d->device = buffer; | - |
726 | d->deleteDevice = true; | - |
727 | | - |
728 | d->deviceClosedNotifier.setupDevice(this, d->device); | - |
729 | | - |
730 | d->status = Ok; | - |
731 | } executed: } Execution Count:13 | 13 |
732 | QTextStream::QTextStream(FILE *fileHandle, QIODevice::OpenMode openMode) | - |
733 | : d_ptr(new QTextStreamPrivate(this)) | - |
734 | { | - |
735 | | - |
736 | | - |
737 | | - |
738 | | - |
739 | QFile *file = new QFile; | - |
740 | file->open(fileHandle, openMode); | - |
741 | | - |
742 | QTextStreamPrivate * const d = d_func(); | - |
743 | d->device = file; | - |
744 | d->deleteDevice = true; | - |
745 | | - |
746 | d->deviceClosedNotifier.setupDevice(this, d->device); | - |
747 | | - |
748 | d->status = Ok; | - |
749 | } | 0 |
750 | | - |
751 | | - |
752 | | - |
753 | | - |
754 | | - |
755 | | - |
756 | | - |
757 | QTextStream::~QTextStream() | - |
758 | { | - |
759 | QTextStreamPrivate * const d = d_func(); | - |
760 | | - |
761 | | - |
762 | | - |
763 | if (!d->writeBuffer.isEmpty()) evaluated: !d->writeBuffer.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:5116 |
| 6-5116 |
764 | d->flushWriteBuffer(); executed: d->flushWriteBuffer(); Execution Count:6 | 6 |
765 | } executed: } Execution Count:5122 | 5122 |
766 | | - |
767 | | - |
768 | | - |
769 | | - |
770 | | - |
771 | | - |
772 | void QTextStream::reset() | - |
773 | { | - |
774 | QTextStreamPrivate * const d = d_func(); | - |
775 | | - |
776 | d->realNumberPrecision = 6; | - |
777 | d->integerBase = 0; | - |
778 | d->fieldWidth = 0; | - |
779 | d->padChar = QLatin1Char(' '); | - |
780 | d->fieldAlignment = QTextStream::AlignRight; | - |
781 | d->realNumberNotation = QTextStream::SmartNotation; | - |
782 | d->numberFlags = 0; | - |
783 | } | 0 |
784 | | - |
785 | | - |
786 | | - |
787 | | - |
788 | | - |
789 | | - |
790 | void QTextStream::flush() | - |
791 | { | - |
792 | QTextStreamPrivate * const d = d_func(); | - |
793 | d->flushWriteBuffer(); | - |
794 | } executed: } Execution Count:50592 | 50592 |
795 | | - |
796 | | - |
797 | | - |
798 | | - |
799 | | - |
800 | bool QTextStream::seek(qint64 pos) | - |
801 | { | - |
802 | QTextStreamPrivate * const d = d_func(); | - |
803 | d->lastTokenSize = 0; | - |
804 | | - |
805 | if (d->device) { evaluated: d->device yes Evaluation Count:214471 | yes Evaluation Count:47 |
| 47-214471 |
806 | | - |
807 | d->flushWriteBuffer(); | - |
808 | if (!d->device->seek(pos)) partially evaluated: !d->device->seek(pos) no Evaluation Count:0 | yes Evaluation Count:214471 |
| 0-214471 |
809 | return false; never executed: return false; | 0 |
810 | d->resetReadBuffer(); | - |
811 | | - |
812 | | - |
813 | | - |
814 | resetCodecConverterStateHelper(&d->readConverterState); | - |
815 | resetCodecConverterStateHelper(&d->writeConverterState); | - |
816 | delete d->readConverterSavedState; | - |
817 | d->readConverterSavedState = 0; | - |
818 | d->writeConverterState.flags |= QTextCodec::IgnoreHeader; | - |
819 | | - |
820 | return true; executed: return true; Execution Count:214471 | 214471 |
821 | } | - |
822 | | - |
823 | | - |
824 | if (d->string && pos <= d->string->size()) { partially evaluated: d->string yes Evaluation Count:47 | no Evaluation Count:0 |
partially evaluated: pos <= d->string->size() yes Evaluation Count:47 | no Evaluation Count:0 |
| 0-47 |
825 | d->stringOffset = int(pos); | - |
826 | return true; executed: return true; Execution Count:47 | 47 |
827 | } | - |
828 | return false; never executed: return false; | 0 |
829 | } | - |
830 | qint64 QTextStream::pos() const | - |
831 | { | - |
832 | const QTextStreamPrivate * const d = d_func(); | - |
833 | if (d->device) { evaluated: d->device yes Evaluation Count:216444 | yes Evaluation Count:36 |
| 36-216444 |
834 | | - |
835 | if (d->readBuffer.isEmpty()) evaluated: d->readBuffer.isEmpty() yes Evaluation Count:214669 | yes Evaluation Count:1775 |
| 1775-214669 |
836 | return d->device->pos(); executed: return d->device->pos(); Execution Count:214669 | 214669 |
837 | if (d->device->isSequential()) partially evaluated: d->device->isSequential() no Evaluation Count:0 | yes Evaluation Count:1775 |
| 0-1775 |
838 | return 0; never executed: return 0; | 0 |
839 | | - |
840 | | - |
841 | if (!d->device->seek(d->readBufferStartDevicePos)) partially evaluated: !d->device->seek(d->readBufferStartDevicePos) no Evaluation Count:0 | yes Evaluation Count:1775 |
| 0-1775 |
842 | return qint64(-1); never executed: return qint64(-1); | 0 |
843 | | - |
844 | | - |
845 | QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d); | - |
846 | thatd->readBuffer.clear(); | - |
847 | | - |
848 | | - |
849 | thatd->restoreToSavedConverterState(); | - |
850 | if (d->readBufferStartDevicePos == 0) evaluated: d->readBufferStartDevicePos == 0 yes Evaluation Count:1760 | yes Evaluation Count:15 |
| 15-1760 |
851 | thatd->autoDetectUnicode = true; executed: thatd->autoDetectUnicode = true; Execution Count:1760 | 1760 |
852 | | - |
853 | | - |
854 | | - |
855 | | - |
856 | int oldReadBufferOffset = d->readBufferOffset + d->readConverterSavedStateOffset; | - |
857 | while (d->readBuffer.size() < oldReadBufferOffset) { evaluated: d->readBuffer.size() < oldReadBufferOffset yes Evaluation Count:41035294 | yes Evaluation Count:1775 |
| 1775-41035294 |
858 | if (!thatd->fillReadBuffer(1)) partially evaluated: !thatd->fillReadBuffer(1) no Evaluation Count:0 | yes Evaluation Count:41035294 |
| 0-41035294 |
859 | return qint64(-1); never executed: return qint64(-1); | 0 |
860 | } executed: } Execution Count:41035294 | 41035294 |
861 | thatd->readBufferOffset = oldReadBufferOffset; | - |
862 | thatd->readConverterSavedStateOffset = 0; | - |
863 | | - |
864 | | - |
865 | return d->device->pos(); executed: return d->device->pos(); Execution Count:1775 | 1775 |
866 | } | - |
867 | | - |
868 | if (d->string) partially evaluated: d->string yes Evaluation Count:36 | no Evaluation Count:0 |
| 0-36 |
869 | return d->stringOffset; executed: return d->stringOffset; Execution Count:36 | 36 |
870 | | - |
871 | QMessageLogger("io/qtextstream.cpp", 1288, __PRETTY_FUNCTION__).warning("QTextStream::pos: no device"); | - |
872 | return qint64(-1); never executed: return qint64(-1); | 0 |
873 | } | - |
874 | void QTextStream::skipWhiteSpace() | - |
875 | { | - |
876 | QTextStreamPrivate * const d = d_func(); | - |
877 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 1306, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return ; } } while (0); executed: } Execution Count:408 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:408 |
evaluated: !d->string yes Evaluation Count:405 | yes Evaluation Count:3 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:405 |
| 0-408 |
878 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - |
879 | d->consumeLastToken(); | - |
880 | } executed: } Execution Count:408 | 408 |
881 | void QTextStream::setDevice(QIODevice *device) | - |
882 | { | - |
883 | QTextStreamPrivate * const d = d_func(); | - |
884 | flush(); | - |
885 | if (d->deleteDevice) { partially evaluated: d->deleteDevice no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
886 | | - |
887 | d->deviceClosedNotifier.disconnect(); | - |
888 | | - |
889 | delete d->device; | - |
890 | d->deleteDevice = false; | - |
891 | } | 0 |
892 | | - |
893 | d->reset(); | - |
894 | d->status = Ok; | - |
895 | d->device = device; | - |
896 | d->resetReadBuffer(); | - |
897 | | - |
898 | d->deviceClosedNotifier.setupDevice(this, d->device); | - |
899 | | - |
900 | } executed: } Execution Count:9 | 9 |
901 | | - |
902 | | - |
903 | | - |
904 | | - |
905 | | - |
906 | | - |
907 | | - |
908 | QIODevice *QTextStream::device() const | - |
909 | { | - |
910 | const QTextStreamPrivate * const d = d_func(); | - |
911 | return d->device; executed: return d->device; Execution Count:3 | 3 |
912 | } | - |
913 | void QTextStream::setString(QString *string, QIODevice::OpenMode openMode) | - |
914 | { | - |
915 | QTextStreamPrivate * const d = d_func(); | - |
916 | flush(); | - |
917 | if (d->deleteDevice) { partially evaluated: d->deleteDevice no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
918 | | - |
919 | d->deviceClosedNotifier.disconnect(); | - |
920 | d->device->blockSignals(true); | - |
921 | | - |
922 | delete d->device; | - |
923 | d->deleteDevice = false; | - |
924 | } | 0 |
925 | | - |
926 | d->reset(); | - |
927 | d->status = Ok; | - |
928 | d->string = string; | - |
929 | d->stringOpenMode = openMode; | - |
930 | } executed: } Execution Count:7 | 7 |
931 | | - |
932 | | - |
933 | | - |
934 | | - |
935 | | - |
936 | | - |
937 | | - |
938 | QString *QTextStream::string() const | - |
939 | { | - |
940 | const QTextStreamPrivate * const d = d_func(); | - |
941 | return d->string; executed: return d->string; Execution Count:1 | 1 |
942 | } | - |
943 | void QTextStream::setFieldAlignment(FieldAlignment mode) | - |
944 | { | - |
945 | QTextStreamPrivate * const d = d_func(); | - |
946 | d->fieldAlignment = mode; | - |
947 | } executed: } Execution Count:8 | 8 |
948 | | - |
949 | | - |
950 | | - |
951 | | - |
952 | | - |
953 | | - |
954 | QTextStream::FieldAlignment QTextStream::fieldAlignment() const | - |
955 | { | - |
956 | const QTextStreamPrivate * const d = d_func(); | - |
957 | return d->fieldAlignment; executed: return d->fieldAlignment; Execution Count:4 | 4 |
958 | } | - |
959 | void QTextStream::setPadChar(QChar ch) | - |
960 | { | - |
961 | QTextStreamPrivate * const d = d_func(); | - |
962 | d->padChar = ch; | - |
963 | } executed: } Execution Count:6 | 6 |
964 | | - |
965 | | - |
966 | | - |
967 | | - |
968 | | - |
969 | | - |
970 | QChar QTextStream::padChar() const | - |
971 | { | - |
972 | const QTextStreamPrivate * const d = d_func(); | - |
973 | return d->padChar; executed: return d->padChar; Execution Count:2 | 2 |
974 | } | - |
975 | void QTextStream::setFieldWidth(int width) | - |
976 | { | - |
977 | QTextStreamPrivate * const d = d_func(); | - |
978 | d->fieldWidth = width; | - |
979 | } executed: } Execution Count:29 | 29 |
980 | | - |
981 | | - |
982 | | - |
983 | | - |
984 | | - |
985 | | - |
986 | int QTextStream::fieldWidth() const | - |
987 | { | - |
988 | const QTextStreamPrivate * const d = d_func(); | - |
989 | return d->fieldWidth; executed: return d->fieldWidth; Execution Count:3 | 3 |
990 | } | - |
991 | void QTextStream::setNumberFlags(NumberFlags flags) | - |
992 | { | - |
993 | QTextStreamPrivate * const d = d_func(); | - |
994 | d->numberFlags = flags; | - |
995 | } executed: } Execution Count:88 | 88 |
996 | | - |
997 | | - |
998 | | - |
999 | | - |
1000 | | - |
1001 | | - |
1002 | QTextStream::NumberFlags QTextStream::numberFlags() const | - |
1003 | { | - |
1004 | const QTextStreamPrivate * const d = d_func(); | - |
1005 | return d->numberFlags; executed: return d->numberFlags; Execution Count:699 | 699 |
1006 | } | - |
1007 | void QTextStream::setIntegerBase(int base) | - |
1008 | { | - |
1009 | QTextStreamPrivate * const d = d_func(); | - |
1010 | d->integerBase = base; | - |
1011 | } executed: } Execution Count:56 | 56 |
1012 | | - |
1013 | | - |
1014 | | - |
1015 | | - |
1016 | | - |
1017 | | - |
1018 | | - |
1019 | int QTextStream::integerBase() const | - |
1020 | { | - |
1021 | const QTextStreamPrivate * const d = d_func(); | - |
1022 | return d->integerBase; executed: return d->integerBase; Execution Count:3 | 3 |
1023 | } | - |
1024 | void QTextStream::setRealNumberNotation(RealNumberNotation notation) | - |
1025 | { | - |
1026 | QTextStreamPrivate * const d = d_func(); | - |
1027 | d->realNumberNotation = notation; | - |
1028 | } executed: } Execution Count:9 | 9 |
1029 | | - |
1030 | | - |
1031 | | - |
1032 | | - |
1033 | | - |
1034 | | - |
1035 | QTextStream::RealNumberNotation QTextStream::realNumberNotation() const | - |
1036 | { | - |
1037 | const QTextStreamPrivate * const d = d_func(); | - |
1038 | return d->realNumberNotation; executed: return d->realNumberNotation; Execution Count:127 | 127 |
1039 | } | - |
1040 | void QTextStream::setRealNumberPrecision(int precision) | - |
1041 | { | - |
1042 | QTextStreamPrivate * const d = d_func(); | - |
1043 | if (precision < 0) { evaluated: precision < 0 yes Evaluation Count:2 | yes Evaluation Count:10 |
| 2-10 |
1044 | QMessageLogger("io/qtextstream.cpp", 1569, __PRETTY_FUNCTION__).warning("QTextStream::setRealNumberPrecision: Invalid precision (%d)", precision); | - |
1045 | d->realNumberPrecision = 6; | - |
1046 | return; executed: return; Execution Count:2 | 2 |
1047 | } | - |
1048 | d->realNumberPrecision = precision; | - |
1049 | } executed: } Execution Count:10 | 10 |
1050 | | - |
1051 | | - |
1052 | | - |
1053 | | - |
1054 | | - |
1055 | | - |
1056 | | - |
1057 | int QTextStream::realNumberPrecision() const | - |
1058 | { | - |
1059 | const QTextStreamPrivate * const d = d_func(); | - |
1060 | return d->realNumberPrecision; executed: return d->realNumberPrecision; Execution Count:3 | 3 |
1061 | } | - |
1062 | | - |
1063 | | - |
1064 | | - |
1065 | | - |
1066 | | - |
1067 | | - |
1068 | | - |
1069 | QTextStream::Status QTextStream::status() const | - |
1070 | { | - |
1071 | const QTextStreamPrivate * const d = d_func(); | - |
1072 | return d->status; executed: return d->status; Execution Count:17098 | 17098 |
1073 | } | - |
1074 | void QTextStream::resetStatus() | - |
1075 | { | - |
1076 | QTextStreamPrivate * const d = d_func(); | - |
1077 | d->status = Ok; | - |
1078 | } executed: } Execution Count:3 | 3 |
1079 | void QTextStream::setStatus(Status status) | - |
1080 | { | - |
1081 | QTextStreamPrivate * const d = d_func(); | - |
1082 | if (d->status == Ok) partially evaluated: d->status == Ok yes Evaluation Count:79 | no Evaluation Count:0 |
| 0-79 |
1083 | d->status = status; executed: d->status = status; Execution Count:79 | 79 |
1084 | } executed: } Execution Count:79 | 79 |
1085 | | - |
1086 | | - |
1087 | | - |
1088 | | - |
1089 | | - |
1090 | | - |
1091 | | - |
1092 | bool QTextStream::atEnd() const | - |
1093 | { | - |
1094 | const QTextStreamPrivate * const d = d_func(); | - |
1095 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 1639, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return true; } } while (0); executed: return true; Execution Count:1 executed: } Execution Count:112534 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:112534 |
evaluated: !d->string yes Evaluation Count:112490 | yes Evaluation Count:45 |
evaluated: !d->device yes Evaluation Count:1 | yes Evaluation Count:112489 |
| 0-112534 |
1096 | | - |
1097 | if (d->string) evaluated: d->string yes Evaluation Count:45 | yes Evaluation Count:112489 |
| 45-112489 |
1098 | return d->string->size() == d->stringOffset; executed: return d->string->size() == d->stringOffset; Execution Count:45 | 45 |
1099 | return d->readBuffer.isEmpty() && d->device->atEnd(); executed: return d->readBuffer.isEmpty() && d->device->atEnd(); Execution Count:112489 | 112489 |
1100 | } | - |
1101 | QString QTextStream::readAll() | - |
1102 | { | - |
1103 | QTextStreamPrivate * const d = d_func(); | - |
1104 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 1659, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return QString(); } } while (0); executed: return QString(); Execution Count:1 executed: } Execution Count:1864 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1864 |
evaluated: !d->string yes Evaluation Count:1860 | yes Evaluation Count:5 |
evaluated: !d->device yes Evaluation Count:1 | yes Evaluation Count:1859 |
| 0-1864 |
1105 | | - |
1106 | return d->read(2147483647); executed: return d->read(2147483647); Execution Count:1864 | 1864 |
1107 | } | - |
1108 | QString QTextStream::readLine(qint64 maxlen) | - |
1109 | { | - |
1110 | QTextStreamPrivate * const d = d_func(); | - |
1111 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 1685, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return QString(); } } while (0); never executed: return QString(); executed: } Execution Count:128869 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:128869 |
evaluated: !d->string yes Evaluation Count:128829 | yes Evaluation Count:40 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:128829 |
| 0-128869 |
1112 | | - |
1113 | const QChar *readPtr; | - |
1114 | int length; | - |
1115 | if (!d->scan(&readPtr, &length, int(maxlen), QTextStreamPrivate::EndOfLine)) evaluated: !d->scan(&readPtr, &length, int(maxlen), QTextStreamPrivate::EndOfLine) yes Evaluation Count:9 | yes Evaluation Count:128860 |
| 9-128860 |
1116 | return QString(); executed: return QString(); Execution Count:9 | 9 |
1117 | | - |
1118 | QString tmp = QString(readPtr, length); | - |
1119 | d->consumeLastToken(); | - |
1120 | return tmp; executed: return tmp; Execution Count:128860 | 128860 |
1121 | } | - |
1122 | QString QTextStream::read(qint64 maxlen) | - |
1123 | { | - |
1124 | QTextStreamPrivate * const d = d_func(); | - |
1125 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 1708, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return QString(); } } while (0); never executed: return QString(); executed: } Execution Count:8 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:8 |
partially evaluated: !d->string yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1126 | | - |
1127 | if (maxlen <= 0) evaluated: maxlen <= 0 yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
1128 | return QString::fromLatin1(""); executed: return QString::fromLatin1(""); Execution Count:1 | 1 |
1129 | | - |
1130 | return d->read(int(maxlen)); executed: return d->read(int(maxlen)); Execution Count:7 | 7 |
1131 | } | - |
1132 | | - |
1133 | | - |
1134 | | - |
1135 | | - |
1136 | QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong *ret) | - |
1137 | { | - |
1138 | scan(0, 0, 0, NotSpace); | - |
1139 | consumeLastToken(); | - |
1140 | | - |
1141 | | - |
1142 | int base = integerBase; | - |
1143 | if (base == 0) { evaluated: base == 0 yes Evaluation Count:16443 | yes Evaluation Count:4875 |
| 4875-16443 |
1144 | QChar ch; | - |
1145 | if (!getChar(&ch)) evaluated: !getChar(&ch) yes Evaluation Count:26 | yes Evaluation Count:16417 |
| 26-16417 |
1146 | return npsInvalidPrefix; executed: return npsInvalidPrefix; Execution Count:26 | 26 |
1147 | if (ch == QLatin1Char('0')) { evaluated: ch == QLatin1Char('0') yes Evaluation Count:1733 | yes Evaluation Count:14684 |
| 1733-14684 |
1148 | QChar ch2; | - |
1149 | if (!getChar(&ch2)) { evaluated: !getChar(&ch2) yes Evaluation Count:6 | yes Evaluation Count:1727 |
| 6-1727 |
1150 | | - |
1151 | *ret = 0; | - |
1152 | return npsOk; executed: return npsOk; Execution Count:6 | 6 |
1153 | } | - |
1154 | ch2 = ch2.toLower(); | - |
1155 | | - |
1156 | if (ch2 == QLatin1Char('x')) { evaluated: ch2 == QLatin1Char('x') yes Evaluation Count:60 | yes Evaluation Count:1667 |
| 60-1667 |
1157 | base = 16; | - |
1158 | } else if (ch2 == QLatin1Char('b')) { executed: } Execution Count:60 evaluated: ch2 == QLatin1Char('b') yes Evaluation Count:42 | yes Evaluation Count:1625 |
| 42-1625 |
1159 | base = 2; | - |
1160 | } else if (ch2.isDigit() && ch2.digitValue() >= 0 && ch2.digitValue() <= 7) { executed: } Execution Count:42 evaluated: ch2.isDigit() yes Evaluation Count:24 | yes Evaluation Count:1601 |
partially evaluated: ch2.digitValue() >= 0 yes Evaluation Count:24 | no Evaluation Count:0 |
partially evaluated: ch2.digitValue() <= 7 yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-1601 |
1161 | base = 8; | - |
1162 | } else { executed: } Execution Count:24 | 24 |
1163 | base = 10; | - |
1164 | } executed: } Execution Count:1601 | 1601 |
1165 | ungetChar(ch2); | - |
1166 | } else if (ch == locale.negativeSign() || ch == locale.positiveSign() || ch.isDigit()) { executed: } Execution Count:1727 evaluated: ch == locale.negativeSign() yes Evaluation Count:104 | yes Evaluation Count:14580 |
evaluated: ch == locale.positiveSign() yes Evaluation Count:2 | yes Evaluation Count:14578 |
evaluated: ch.isDigit() yes Evaluation Count:14570 | yes Evaluation Count:8 |
| 2-14580 |
1167 | base = 10; | - |
1168 | } else { executed: } Execution Count:14676 | 14676 |
1169 | ungetChar(ch); | - |
1170 | return npsInvalidPrefix; executed: return npsInvalidPrefix; Execution Count:8 | 8 |
1171 | } | - |
1172 | ungetChar(ch); | - |
1173 | | - |
1174 | | - |
1175 | | - |
1176 | } executed: } Execution Count:16403 | 16403 |
1177 | | - |
1178 | qulonglong val=0; | - |
1179 | switch (base) { | - |
1180 | case 2: { | - |
1181 | QChar pf1, pf2, dig; | - |
1182 | | - |
1183 | if (!getChar(&pf1) || pf1 != QLatin1Char('0')) partially evaluated: !getChar(&pf1) no Evaluation Count:0 | yes Evaluation Count:42 |
partially evaluated: pf1 != QLatin1Char('0') no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
1184 | return npsInvalidPrefix; never executed: return npsInvalidPrefix; | 0 |
1185 | if (!getChar(&pf2) || pf2.toLower() != QLatin1Char('b')) partially evaluated: !getChar(&pf2) no Evaluation Count:0 | yes Evaluation Count:42 |
partially evaluated: pf2.toLower() != QLatin1Char('b') no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
1186 | return npsInvalidPrefix; never executed: return npsInvalidPrefix; | 0 |
1187 | | - |
1188 | int ndigits = 0; | - |
1189 | while (getChar(&dig)) { evaluated: getChar(&dig) yes Evaluation Count:156 | yes Evaluation Count:30 |
| 30-156 |
1190 | int n = dig.toLower().unicode(); | - |
1191 | if (n == '0' || n == '1') { evaluated: n == '0' yes Evaluation Count:72 | yes Evaluation Count:84 |
evaluated: n == '1' yes Evaluation Count:72 | yes Evaluation Count:12 |
| 12-84 |
1192 | val <<= 1; | - |
1193 | val += n - '0'; | - |
1194 | } else { executed: } Execution Count:144 | 144 |
1195 | ungetChar(dig); | - |
1196 | break; executed: break; Execution Count:12 | 12 |
1197 | } | - |
1198 | ndigits++; | - |
1199 | } executed: } Execution Count:144 | 144 |
1200 | if (ndigits == 0) { partially evaluated: ndigits == 0 no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
1201 | | - |
1202 | ungetChar(pf2); | - |
1203 | ungetChar(pf1); | - |
1204 | return npsMissingDigit; never executed: return npsMissingDigit; | 0 |
1205 | } | - |
1206 | break; executed: break; Execution Count:42 | 42 |
1207 | } | - |
1208 | case 8: { | - |
1209 | QChar pf, dig; | - |
1210 | | - |
1211 | if (!getChar(&pf) || pf != QLatin1Char('0')) partially evaluated: !getChar(&pf) no Evaluation Count:0 | yes Evaluation Count:24 |
partially evaluated: pf != QLatin1Char('0') no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
1212 | return npsInvalidPrefix; never executed: return npsInvalidPrefix; | 0 |
1213 | | - |
1214 | int ndigits = 0; | - |
1215 | while (getChar(&dig)) { evaluated: getChar(&dig) yes Evaluation Count:72 | yes Evaluation Count:12 |
| 12-72 |
1216 | int n = dig.toLower().unicode(); | - |
1217 | if (n >= '0' && n <= '7') { partially evaluated: n >= '0' yes Evaluation Count:72 | no Evaluation Count:0 |
evaluated: n <= '7' yes Evaluation Count:60 | yes Evaluation Count:12 |
| 0-72 |
1218 | val *= 8; | - |
1219 | val += n - '0'; | - |
1220 | } else { executed: } Execution Count:60 | 60 |
1221 | ungetChar(dig); | - |
1222 | break; executed: break; Execution Count:12 | 12 |
1223 | } | - |
1224 | ndigits++; | - |
1225 | } executed: } Execution Count:60 | 60 |
1226 | if (ndigits == 0) { partially evaluated: ndigits == 0 no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
1227 | | - |
1228 | ungetChar(pf); | - |
1229 | return npsMissingDigit; never executed: return npsMissingDigit; | 0 |
1230 | } | - |
1231 | break; executed: break; Execution Count:24 | 24 |
1232 | } | - |
1233 | case 10: { | - |
1234 | | - |
1235 | QChar sign; | - |
1236 | int ndigits = 0; | - |
1237 | if (!getChar(&sign)) partially evaluated: !getChar(&sign) no Evaluation Count:0 | yes Evaluation Count:21152 |
| 0-21152 |
1238 | return npsMissingDigit; never executed: return npsMissingDigit; | 0 |
1239 | if (sign != locale.negativeSign() && sign != locale.positiveSign()) { evaluated: sign != locale.negativeSign() yes Evaluation Count:21048 | yes Evaluation Count:104 |
evaluated: sign != locale.positiveSign() yes Evaluation Count:21046 | yes Evaluation Count:2 |
| 2-21048 |
1240 | if (!sign.isDigit()) { partially evaluated: !sign.isDigit() no Evaluation Count:0 | yes Evaluation Count:21046 |
| 0-21046 |
1241 | ungetChar(sign); | - |
1242 | return npsMissingDigit; never executed: return npsMissingDigit; | 0 |
1243 | } | - |
1244 | val += sign.digitValue(); | - |
1245 | ndigits++; | - |
1246 | } executed: } Execution Count:21046 | 21046 |
1247 | | - |
1248 | QChar ch; | - |
1249 | while (getChar(&ch)) { evaluated: getChar(&ch) yes Evaluation Count:28450 | yes Evaluation Count:260 |
| 260-28450 |
1250 | if (ch.isDigit()) { evaluated: ch.isDigit() yes Evaluation Count:7557 | yes Evaluation Count:20893 |
| 7557-20893 |
1251 | val *= 10; | - |
1252 | val += ch.digitValue(); | - |
1253 | } else if (locale != QLocale::c() && ch == locale.groupSeparator()) { executed: } Execution Count:7557 evaluated: locale != QLocale::c() yes Evaluation Count:1 | yes Evaluation Count:20892 |
partially evaluated: ch == locale.groupSeparator() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-20892 |
1254 | continue; executed: continue; Execution Count:1 | 1 |
1255 | } else { | - |
1256 | ungetChar(ch); | - |
1257 | break; executed: break; Execution Count:20892 | 20892 |
1258 | } | - |
1259 | ndigits++; | - |
1260 | } executed: } Execution Count:7557 | 7557 |
1261 | if (ndigits == 0) partially evaluated: ndigits == 0 no Evaluation Count:0 | yes Evaluation Count:21152 |
| 0-21152 |
1262 | return npsMissingDigit; never executed: return npsMissingDigit; | 0 |
1263 | if (sign == locale.negativeSign()) { evaluated: sign == locale.negativeSign() yes Evaluation Count:104 | yes Evaluation Count:21048 |
| 104-21048 |
1264 | qlonglong ival = qlonglong(val); | - |
1265 | if (ival > 0) evaluated: ival > 0 yes Evaluation Count:98 | yes Evaluation Count:6 |
| 6-98 |
1266 | ival = -ival; executed: ival = -ival; Execution Count:98 | 98 |
1267 | val = qulonglong(ival); | - |
1268 | } executed: } Execution Count:104 | 104 |
1269 | break; executed: break; Execution Count:21152 | 21152 |
1270 | } | - |
1271 | case 16: { | - |
1272 | QChar pf1, pf2, dig; | - |
1273 | | - |
1274 | if (!getChar(&pf1) || pf1 != QLatin1Char('0')) partially evaluated: !getChar(&pf1) no Evaluation Count:0 | yes Evaluation Count:60 |
partially evaluated: pf1 != QLatin1Char('0') no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-60 |
1275 | return npsInvalidPrefix; never executed: return npsInvalidPrefix; | 0 |
1276 | if (!getChar(&pf2) || pf2.toLower() != QLatin1Char('x')) partially evaluated: !getChar(&pf2) no Evaluation Count:0 | yes Evaluation Count:60 |
partially evaluated: pf2.toLower() != QLatin1Char('x') no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-60 |
1277 | return npsInvalidPrefix; never executed: return npsInvalidPrefix; | 0 |
1278 | | - |
1279 | int ndigits = 0; | - |
1280 | while (getChar(&dig)) { evaluated: getChar(&dig) yes Evaluation Count:318 | yes Evaluation Count:48 |
| 48-318 |
1281 | int n = dig.toLower().unicode(); | - |
1282 | if (n >= '0' && n <= '9') { partially evaluated: n >= '0' yes Evaluation Count:318 | no Evaluation Count:0 |
evaluated: n <= '9' yes Evaluation Count:12 | yes Evaluation Count:306 |
| 0-318 |
1283 | val <<= 4; | - |
1284 | val += n - '0'; | - |
1285 | } else if (n >= 'a' && n <= 'f') { executed: } Execution Count:12 partially evaluated: n >= 'a' yes Evaluation Count:306 | no Evaluation Count:0 |
evaluated: n <= 'f' yes Evaluation Count:294 | yes Evaluation Count:12 |
| 0-306 |
1286 | val <<= 4; | - |
1287 | val += 10 + (n - 'a'); | - |
1288 | } else { executed: } Execution Count:294 | 294 |
1289 | ungetChar(dig); | - |
1290 | break; executed: break; Execution Count:12 | 12 |
1291 | } | - |
1292 | ndigits++; | - |
1293 | } executed: } Execution Count:306 | 306 |
1294 | if (ndigits == 0) { evaluated: ndigits == 0 yes Evaluation Count:6 | yes Evaluation Count:54 |
| 6-54 |
1295 | return npsMissingDigit; executed: return npsMissingDigit; Execution Count:6 | 6 |
1296 | } | - |
1297 | break; executed: break; Execution Count:54 | 54 |
1298 | } | - |
1299 | default: | - |
1300 | | - |
1301 | return npsInvalidPrefix; never executed: return npsInvalidPrefix; | 0 |
1302 | } | - |
1303 | | - |
1304 | if (ret) partially evaluated: ret yes Evaluation Count:21272 | no Evaluation Count:0 |
| 0-21272 |
1305 | *ret = val; executed: *ret = val; Execution Count:21272 | 21272 |
1306 | return npsOk; executed: return npsOk; Execution Count:21272 | 21272 |
1307 | } | - |
1308 | | - |
1309 | | - |
1310 | | - |
1311 | | - |
1312 | | - |
1313 | bool QTextStreamPrivate::getReal(double *f) | - |
1314 | { | - |
1315 | | - |
1316 | | - |
1317 | | - |
1318 | enum ParserState { | - |
1319 | Init = 0, | - |
1320 | Sign = 1, | - |
1321 | Mantissa = 2, | - |
1322 | Dot = 3, | - |
1323 | Abscissa = 4, | - |
1324 | ExpMark = 5, | - |
1325 | ExpSign = 6, | - |
1326 | Exponent = 7, | - |
1327 | Nan1 = 8, | - |
1328 | Nan2 = 9, | - |
1329 | Inf1 = 10, | - |
1330 | Inf2 = 11, | - |
1331 | NanInf = 12, | - |
1332 | Done = 13 | - |
1333 | }; | - |
1334 | enum InputToken { | - |
1335 | None = 0, | - |
1336 | InputSign = 1, | - |
1337 | InputDigit = 2, | - |
1338 | InputDot = 3, | - |
1339 | InputExp = 4, | - |
1340 | InputI = 5, | - |
1341 | InputN = 6, | - |
1342 | InputF = 7, | - |
1343 | InputA = 8, | - |
1344 | InputT = 9 | - |
1345 | }; | - |
1346 | | - |
1347 | static const uchar table[13][10] = { | - |
1348 | | - |
1349 | { 0, Sign, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, | - |
1350 | { 0, 0, Mantissa, Dot, 0, Inf1, Nan1, 0, 0, 0 }, | - |
1351 | { Done, Done, Mantissa, Dot, ExpMark, 0, 0, 0, 0, 0 }, | - |
1352 | { 0, 0, Abscissa, 0, 0, 0, 0, 0, 0, 0 }, | - |
1353 | { Done, Done, Abscissa, Done, ExpMark, 0, 0, 0, 0, 0 }, | - |
1354 | { 0, ExpSign, Exponent, 0, 0, 0, 0, 0, 0, 0 }, | - |
1355 | { 0, 0, Exponent, 0, 0, 0, 0, 0, 0, 0 }, | - |
1356 | { Done, Done, Exponent, Done, Done, 0, 0, 0, 0, 0 }, | - |
1357 | { 0, 0, 0, 0, 0, 0, 0, 0, Nan2, 0 }, | - |
1358 | { 0, 0, 0, 0, 0, 0, NanInf, 0, 0, 0 }, | - |
1359 | { 0, 0, 0, 0, 0, 0, Inf2, 0, 0, 0 }, | - |
1360 | { 0, 0, 0, 0, 0, 0, 0, NanInf, 0, 0 }, | - |
1361 | { Done, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, | - |
1362 | }; | - |
1363 | | - |
1364 | ParserState state = Init; | - |
1365 | InputToken input = None; | - |
1366 | | - |
1367 | scan(0, 0, 0, NotSpace); | - |
1368 | consumeLastToken(); | - |
1369 | | - |
1370 | const int BufferSize = 128; | - |
1371 | char buf[BufferSize]; | - |
1372 | int i = 0; | - |
1373 | | - |
1374 | QChar c; | - |
1375 | while (getChar(&c)) { evaluated: getChar(&c) yes Evaluation Count:282 | yes Evaluation Count:29 |
| 29-282 |
1376 | switch (c.unicode()) { | - |
1377 | case '0': case '1': case '2': case '3': case '4': | - |
1378 | case '5': case '6': case '7': case '8': case '9': | - |
1379 | input = InputDigit; | - |
1380 | break; executed: break; Execution Count:77 | 77 |
1381 | case 'i': case 'I': | - |
1382 | input = InputI; | - |
1383 | break; executed: break; Execution Count:18 | 18 |
1384 | case 'n': case 'N': | - |
1385 | input = InputN; | - |
1386 | break; executed: break; Execution Count:54 | 54 |
1387 | case 'f': case 'F': | - |
1388 | input = InputF; | - |
1389 | break; executed: break; Execution Count:18 | 18 |
1390 | case 'a': case 'A': | - |
1391 | input = InputA; | - |
1392 | break; executed: break; Execution Count:21 | 21 |
1393 | case 't': case 'T': | - |
1394 | input = InputT; | - |
1395 | break; | 0 |
1396 | default: { | - |
1397 | QChar lc = c.toLower(); | - |
1398 | if (lc == locale.decimalPoint().toLower()) evaluated: lc == locale.decimalPoint().toLower() yes Evaluation Count:13 | yes Evaluation Count:81 |
| 13-81 |
1399 | input = InputDot; executed: input = InputDot; Execution Count:13 | 13 |
1400 | else if (lc == locale.exponential().toLower()) evaluated: lc == locale.exponential().toLower() yes Evaluation Count:8 | yes Evaluation Count:73 |
| 8-73 |
1401 | input = InputExp; executed: input = InputExp; Execution Count:8 | 8 |
1402 | else if (lc == locale.negativeSign().toLower() evaluated: lc == locale.negativeSign().toLower() yes Evaluation Count:20 | yes Evaluation Count:53 |
| 20-53 |
1403 | || lc == locale.positiveSign().toLower()) evaluated: lc == locale.positiveSign().toLower() yes Evaluation Count:16 | yes Evaluation Count:37 |
| 16-37 |
1404 | input = InputSign; executed: input = InputSign; Execution Count:36 | 36 |
1405 | else if (locale != QLocale::c() partially evaluated: locale != QLocale::c() no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
1406 | && lc == locale.groupSeparator().toLower()) never evaluated: lc == locale.groupSeparator().toLower() | 0 |
1407 | input = InputDigit; never executed: input = InputDigit; | 0 |
1408 | else | - |
1409 | input = None; executed: input = None; Execution Count:37 | 37 |
1410 | } | - |
1411 | break; executed: break; Execution Count:94 | 94 |
1412 | } | - |
1413 | | - |
1414 | state = ParserState(table[state][input]); | - |
1415 | | - |
1416 | if (state == Init || state == Done || i > (BufferSize - 5)) { evaluated: state == Init yes Evaluation Count:3 | yes Evaluation Count:279 |
evaluated: state == Done yes Evaluation Count:37 | yes Evaluation Count:242 |
partially evaluated: i > (BufferSize - 5) no Evaluation Count:0 | yes Evaluation Count:242 |
| 0-279 |
1417 | ungetChar(c); | - |
1418 | if (i > (BufferSize - 5)) { partially evaluated: i > (BufferSize - 5) no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-40 |
1419 | while (getChar(&c)) { never evaluated: getChar(&c) | 0 |
1420 | if (!c.isDigit()) { never evaluated: !c.isDigit() | 0 |
1421 | ungetChar(c); | - |
1422 | break; | 0 |
1423 | } | - |
1424 | } | 0 |
1425 | } | 0 |
1426 | break; executed: break; Execution Count:40 | 40 |
1427 | } | - |
1428 | | - |
1429 | buf[i++] = c.toLatin1(); | - |
1430 | } executed: } Execution Count:242 | 242 |
1431 | | - |
1432 | if (i == 0) evaluated: i == 0 yes Evaluation Count:10 | yes Evaluation Count:59 |
| 10-59 |
1433 | return false; executed: return false; Execution Count:10 | 10 |
1434 | if (!f) partially evaluated: !f no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
1435 | return true; never executed: return true; | 0 |
1436 | buf[i] = '\0'; | - |
1437 | | - |
1438 | | - |
1439 | | - |
1440 | | - |
1441 | | - |
1442 | if (!qstricmp(buf, "nan") || !qstricmp(buf, "+nan") || !qstricmp(buf, "-nan")) { evaluated: !qstricmp(buf, "nan") yes Evaluation Count:6 | yes Evaluation Count:53 |
evaluated: !qstricmp(buf, "+nan") yes Evaluation Count:6 | yes Evaluation Count:47 |
evaluated: !qstricmp(buf, "-nan") yes Evaluation Count:6 | yes Evaluation Count:41 |
| 6-53 |
1443 | *f = qSNaN(); | - |
1444 | return true; executed: return true; Execution Count:18 | 18 |
1445 | } else if (!qstricmp(buf, "+inf") || !qstricmp(buf, "inf")) { evaluated: !qstricmp(buf, "+inf") yes Evaluation Count:6 | yes Evaluation Count:35 |
evaluated: !qstricmp(buf, "inf") yes Evaluation Count:6 | yes Evaluation Count:29 |
| 6-35 |
1446 | *f = qInf(); | - |
1447 | return true; executed: return true; Execution Count:12 | 12 |
1448 | } else if (!qstricmp(buf, "-inf")) { evaluated: !qstricmp(buf, "-inf") yes Evaluation Count:6 | yes Evaluation Count:23 |
| 6-23 |
1449 | *f = -qInf(); | - |
1450 | return true; executed: return true; Execution Count:6 | 6 |
1451 | } | - |
1452 | bool ok; | - |
1453 | *f = locale.toDouble(QString::fromLatin1(buf), &ok); | - |
1454 | return ok; executed: return ok; Execution Count:23 | 23 |
1455 | } | - |
1456 | QTextStream &QTextStream::operator>>(QChar &c) | - |
1457 | { | - |
1458 | QTextStreamPrivate * const d = d_func(); | - |
1459 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2053, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); executed: return *this; Execution Count:1 executed: } Execution Count:839 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:839 |
evaluated: !d->string yes Evaluation Count:830 | yes Evaluation Count:10 |
evaluated: !d->device yes Evaluation Count:1 | yes Evaluation Count:829 |
| 0-839 |
1460 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - |
1461 | if (!d->getChar(&c)) evaluated: !d->getChar(&c) yes Evaluation Count:16 | yes Evaluation Count:823 |
| 16-823 |
1462 | setStatus(ReadPastEnd); executed: setStatus(ReadPastEnd); Execution Count:16 | 16 |
1463 | return *this; executed: return *this; Execution Count:839 | 839 |
1464 | } | - |
1465 | QTextStream &QTextStream::operator>>(char &c) | - |
1466 | { | - |
1467 | QChar ch; | - |
1468 | *this >> ch; | - |
1469 | c = ch.toLatin1(); | - |
1470 | return *this; executed: return *this; Execution Count:19 | 19 |
1471 | } | - |
1472 | QTextStream &QTextStream::operator>>(signed short &i) | - |
1473 | { | - |
1474 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2103, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (signed short)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (signed short)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; executed: } Execution Count:69 executed: break; Execution Count:63 executed: break; Execution Count:6 executed: return *this; Execution Count:69 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:69 |
partially evaluated: !d->string yes Evaluation Count:69 | no Evaluation Count:0 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
1475 | } | 0 |
1476 | | - |
1477 | | - |
1478 | | - |
1479 | | - |
1480 | | - |
1481 | | - |
1482 | QTextStream &QTextStream::operator>>(unsigned short &i) | - |
1483 | { | - |
1484 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2113, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (unsigned short)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (unsigned short)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; executed: } Execution Count:69 executed: break; Execution Count:63 executed: break; Execution Count:6 executed: return *this; Execution Count:69 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:69 |
partially evaluated: !d->string yes Evaluation Count:69 | no Evaluation Count:0 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
1485 | } | 0 |
1486 | | - |
1487 | | - |
1488 | | - |
1489 | | - |
1490 | | - |
1491 | | - |
1492 | QTextStream &QTextStream::operator>>(signed int &i) | - |
1493 | { | - |
1494 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2123, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (signed int)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (signed int)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; executed: } Execution Count:20973 executed: break; Execution Count:20963 executed: break; Execution Count:10 executed: return *this; Execution Count:20973 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:20973 |
evaluated: !d->string yes Evaluation Count:20961 | yes Evaluation Count:12 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:20961 |
| 0-20973 |
1495 | } | 0 |
1496 | | - |
1497 | | - |
1498 | | - |
1499 | | - |
1500 | | - |
1501 | | - |
1502 | QTextStream &QTextStream::operator>>(unsigned int &i) | - |
1503 | { | - |
1504 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2133, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (unsigned int)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (unsigned int)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; executed: } Execution Count:69 executed: break; Execution Count:63 executed: break; Execution Count:6 executed: return *this; Execution Count:69 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:69 |
partially evaluated: !d->string yes Evaluation Count:69 | no Evaluation Count:0 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
1505 | } | 0 |
1506 | | - |
1507 | | - |
1508 | | - |
1509 | | - |
1510 | | - |
1511 | | - |
1512 | QTextStream &QTextStream::operator>>(signed long &i) | - |
1513 | { | - |
1514 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2143, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (signed long)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (signed long)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; never executed: return *this; never evaluated: !d->string never evaluated: !d->device | 0 |
1515 | } | 0 |
1516 | | - |
1517 | | - |
1518 | | - |
1519 | | - |
1520 | | - |
1521 | | - |
1522 | QTextStream &QTextStream::operator>>(unsigned long &i) | - |
1523 | { | - |
1524 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2153, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (unsigned long)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (unsigned long)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; never executed: return *this; never evaluated: !d->string never evaluated: !d->device | 0 |
1525 | } | 0 |
1526 | | - |
1527 | | - |
1528 | | - |
1529 | | - |
1530 | | - |
1531 | | - |
1532 | QTextStream &QTextStream::operator>>(qlonglong &i) | - |
1533 | { | - |
1534 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2163, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (qlonglong)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (qlonglong)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; executed: } Execution Count:69 executed: break; Execution Count:63 executed: break; Execution Count:6 executed: return *this; Execution Count:69 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:69 |
partially evaluated: !d->string yes Evaluation Count:69 | no Evaluation Count:0 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
1535 | } | 0 |
1536 | | - |
1537 | | - |
1538 | | - |
1539 | | - |
1540 | | - |
1541 | | - |
1542 | QTextStream &QTextStream::operator>>(qulonglong &i) | - |
1543 | { | - |
1544 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2173, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); qulonglong tmp; switch (d->getNumber(&tmp)) { case QTextStreamPrivate::npsOk: i = (qulonglong)tmp; break; case QTextStreamPrivate::npsMissingDigit: case QTextStreamPrivate::npsInvalidPrefix: i = (qulonglong)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); break; } return *this; } while (0); never executed: return *this; executed: } Execution Count:69 executed: break; Execution Count:63 executed: break; Execution Count:6 executed: return *this; Execution Count:69 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:69 |
partially evaluated: !d->string yes Evaluation Count:69 | no Evaluation Count:0 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
1545 | } | 0 |
1546 | QTextStream &QTextStream::operator>>(float &f) | - |
1547 | { | - |
1548 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2189, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); double tmp; if (d->getReal(&tmp)) { f = (float)tmp; } else { f = (float)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); } return *this; } while (0); never executed: return *this; executed: } Execution Count:32 executed: } Execution Count:28 executed: } Execution Count:4 executed: return *this; Execution Count:32 evaluated: d->getReal(&tmp) yes Evaluation Count:28 | yes Evaluation Count:4 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:32 |
evaluated: !d->string yes Evaluation Count:14 | yes Evaluation Count:18 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-32 |
1549 | } | 0 |
1550 | | - |
1551 | | - |
1552 | | - |
1553 | | - |
1554 | | - |
1555 | | - |
1556 | QTextStream &QTextStream::operator>>(double &f) | - |
1557 | { | - |
1558 | do { QTextStreamPrivate * const d = d_func(); do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2199, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); double tmp; if (d->getReal(&tmp)) { f = (double)tmp; } else { f = (double)0; setStatus(atEnd() ? QTextStream::ReadPastEnd : QTextStream::ReadCorruptData); } return *this; } while (0); never executed: return *this; executed: } Execution Count:37 executed: } Execution Count:31 executed: } Execution Count:6 executed: return *this; Execution Count:37 evaluated: d->getReal(&tmp) yes Evaluation Count:31 | yes Evaluation Count:6 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:37 |
evaluated: !d->string yes Evaluation Count:16 | yes Evaluation Count:21 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-37 |
1559 | } | 0 |
1560 | QTextStream &QTextStream::operator>>(QString &str) | - |
1561 | { | - |
1562 | QTextStreamPrivate * const d = d_func(); | - |
1563 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2212, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:437 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:437 |
evaluated: !d->string yes Evaluation Count:425 | yes Evaluation Count:12 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:425 |
| 0-437 |
1564 | | - |
1565 | str.clear(); | - |
1566 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - |
1567 | d->consumeLastToken(); | - |
1568 | | - |
1569 | const QChar *ptr; | - |
1570 | int length; | - |
1571 | if (!d->scan(&ptr, &length, 0, QTextStreamPrivate::Space)) { evaluated: !d->scan(&ptr, &length, 0, QTextStreamPrivate::Space) yes Evaluation Count:4 | yes Evaluation Count:433 |
| 4-433 |
1572 | setStatus(ReadPastEnd); | - |
1573 | return *this; executed: return *this; Execution Count:4 | 4 |
1574 | } | - |
1575 | | - |
1576 | str = QString(ptr, length); | - |
1577 | d->consumeLastToken(); | - |
1578 | return *this; executed: return *this; Execution Count:433 | 433 |
1579 | } | - |
1580 | QTextStream &QTextStream::operator>>(QByteArray &array) | - |
1581 | { | - |
1582 | QTextStreamPrivate * const d = d_func(); | - |
1583 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2240, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:14 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:14 |
partially evaluated: !d->string yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
1584 | | - |
1585 | array.clear(); | - |
1586 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - |
1587 | d->consumeLastToken(); | - |
1588 | | - |
1589 | const QChar *ptr; | - |
1590 | int length; | - |
1591 | if (!d->scan(&ptr, &length, 0, QTextStreamPrivate::Space)) { evaluated: !d->scan(&ptr, &length, 0, QTextStreamPrivate::Space) yes Evaluation Count:3 | yes Evaluation Count:11 |
| 3-11 |
1592 | setStatus(ReadPastEnd); | - |
1593 | return *this; executed: return *this; Execution Count:3 | 3 |
1594 | } | - |
1595 | | - |
1596 | for (int i = 0; i < length; ++i) evaluated: i < length yes Evaluation Count:20 | yes Evaluation Count:11 |
| 11-20 |
1597 | array += ptr[i].toLatin1(); executed: array += ptr[i].toLatin1(); Execution Count:20 | 20 |
1598 | | - |
1599 | d->consumeLastToken(); | - |
1600 | return *this; executed: return *this; Execution Count:11 | 11 |
1601 | } | - |
1602 | QTextStream &QTextStream::operator>>(char *c) | - |
1603 | { | - |
1604 | QTextStreamPrivate * const d = d_func(); | - |
1605 | *c = 0; | - |
1606 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2277, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); executed: return *this; Execution Count:1 executed: } Execution Count:12 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: !d->string yes Evaluation Count:13 | no Evaluation Count:0 |
evaluated: !d->device yes Evaluation Count:1 | yes Evaluation Count:12 |
| 0-13 |
1607 | d->scan(0, 0, 0, QTextStreamPrivate::NotSpace); | - |
1608 | d->consumeLastToken(); | - |
1609 | | - |
1610 | const QChar *ptr; | - |
1611 | int length; | - |
1612 | if (!d->scan(&ptr, &length, 0, QTextStreamPrivate::Space)) { evaluated: !d->scan(&ptr, &length, 0, QTextStreamPrivate::Space) yes Evaluation Count:3 | yes Evaluation Count:9 |
| 3-9 |
1613 | setStatus(ReadPastEnd); | - |
1614 | return *this; executed: return *this; Execution Count:3 | 3 |
1615 | } | - |
1616 | | - |
1617 | for (int i = 0; i < length; ++i) evaluated: i < length yes Evaluation Count:14 | yes Evaluation Count:9 |
| 9-14 |
1618 | *c++ = ptr[i].toLatin1(); executed: *c++ = ptr[i].toLatin1(); Execution Count:14 | 14 |
1619 | *c = '\0'; | - |
1620 | d->consumeLastToken(); | - |
1621 | return *this; executed: return *this; Execution Count:9 | 9 |
1622 | } | - |
1623 | | - |
1624 | | - |
1625 | | - |
1626 | | - |
1627 | void QTextStreamPrivate::putNumber(qulonglong number, bool negative) | - |
1628 | { | - |
1629 | QString result; | - |
1630 | | - |
1631 | unsigned flags = 0; | - |
1632 | if (numberFlags & QTextStream::ShowBase) evaluated: numberFlags & QTextStream::ShowBase yes Evaluation Count:94 | yes Evaluation Count:4999 |
| 94-4999 |
1633 | flags |= QLocalePrivate::ShowBase; executed: flags |= QLocalePrivate::ShowBase; Execution Count:94 | 94 |
1634 | if (numberFlags & QTextStream::ForceSign) evaluated: numberFlags & QTextStream::ForceSign yes Evaluation Count:3 | yes Evaluation Count:5090 |
| 3-5090 |
1635 | flags |= QLocalePrivate::AlwaysShowSign; executed: flags |= QLocalePrivate::AlwaysShowSign; Execution Count:3 | 3 |
1636 | if (numberFlags & QTextStream::UppercaseBase) evaluated: numberFlags & QTextStream::UppercaseBase yes Evaluation Count:7 | yes Evaluation Count:5086 |
| 7-5086 |
1637 | flags |= QLocalePrivate::UppercaseBase; executed: flags |= QLocalePrivate::UppercaseBase; Execution Count:7 | 7 |
1638 | if (numberFlags & QTextStream::UppercaseDigits) evaluated: numberFlags & QTextStream::UppercaseDigits yes Evaluation Count:9 | yes Evaluation Count:5084 |
| 9-5084 |
1639 | flags |= QLocalePrivate::CapitalEorX; executed: flags |= QLocalePrivate::CapitalEorX; Execution Count:9 | 9 |
1640 | | - |
1641 | | - |
1642 | | - |
1643 | if (locale != QLocale::c()) evaluated: locale != QLocale::c() yes Evaluation Count:3 | yes Evaluation Count:5090 |
| 3-5090 |
1644 | flags |= QLocalePrivate::ThousandsGroup; executed: flags |= QLocalePrivate::ThousandsGroup; Execution Count:3 | 3 |
1645 | | - |
1646 | const QLocalePrivate *dd = locale.d; | - |
1647 | int base = integerBase ? integerBase : 10; evaluated: integerBase yes Evaluation Count:101 | yes Evaluation Count:4992 |
| 101-4992 |
1648 | if (negative && base == 10) { evaluated: negative yes Evaluation Count:51 | yes Evaluation Count:5042 |
evaluated: base == 10 yes Evaluation Count:47 | yes Evaluation Count:4 |
| 4-5042 |
1649 | result = dd->longLongToString(-static_cast<qlonglong>(number), -1, | - |
1650 | base, -1, flags); | - |
1651 | } else if (negative) { executed: } Execution Count:47 evaluated: negative yes Evaluation Count:4 | yes Evaluation Count:5042 |
| 4-5042 |
1652 | | - |
1653 | | - |
1654 | | - |
1655 | | - |
1656 | result = dd->unsLongLongToString(number, -1, base, -1, flags); | - |
1657 | result.prepend(locale.negativeSign()); | - |
1658 | } else { executed: } Execution Count:4 | 4 |
1659 | result = dd->unsLongLongToString(number, -1, base, -1, flags); | - |
1660 | | - |
1661 | | - |
1662 | if (number == 0 && base == 8 && numberFlags & QTextStream::ShowBase evaluated: number == 0 yes Evaluation Count:264 | yes Evaluation Count:4778 |
evaluated: base == 8 yes Evaluation Count:1 | yes Evaluation Count:263 |
partially evaluated: numberFlags & QTextStream::ShowBase yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-4778 |
1663 | && result == QLatin1String("0")) { partially evaluated: result == QLatin1String("0") yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1664 | result.prepend(QLatin1Char('0')); | - |
1665 | } executed: } Execution Count:1 | 1 |
1666 | } executed: } Execution Count:5042 | 5042 |
1667 | putString(result, true); | - |
1668 | } executed: } Execution Count:5093 | 5093 |
1669 | | - |
1670 | | - |
1671 | | - |
1672 | | - |
1673 | | - |
1674 | | - |
1675 | | - |
1676 | QTextStream &QTextStream::operator<<(QChar c) | - |
1677 | { | - |
1678 | QTextStreamPrivate * const d = d_func(); | - |
1679 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2350, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:50129 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:50129 |
evaluated: !d->string yes Evaluation Count:34770 | yes Evaluation Count:15359 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:34770 |
| 0-50129 |
1680 | d->putString(QString(c)); | - |
1681 | return *this; executed: return *this; Execution Count:50129 | 50129 |
1682 | } | - |
1683 | | - |
1684 | | - |
1685 | | - |
1686 | | - |
1687 | | - |
1688 | | - |
1689 | QTextStream &QTextStream::operator<<(char c) | - |
1690 | { | - |
1691 | QTextStreamPrivate * const d = d_func(); | - |
1692 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2363, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:159310 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:159310 |
evaluated: !d->string yes Evaluation Count:97726 | yes Evaluation Count:61584 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:97726 |
| 0-159310 |
1693 | d->putString(QString(QChar::fromLatin1(c))); | - |
1694 | return *this; executed: return *this; Execution Count:159310 | 159310 |
1695 | } | - |
1696 | QTextStream &QTextStream::operator<<(signed short i) | - |
1697 | { | - |
1698 | QTextStreamPrivate * const d = d_func(); | - |
1699 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2379, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:10 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:10 |
evaluated: !d->string yes Evaluation Count:9 | yes Evaluation Count:1 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-10 |
1700 | d->putNumber((qulonglong)qAbs(qlonglong(i)), i < 0); | - |
1701 | return *this; executed: return *this; Execution Count:10 | 10 |
1702 | } | - |
1703 | | - |
1704 | | - |
1705 | | - |
1706 | | - |
1707 | | - |
1708 | | - |
1709 | QTextStream &QTextStream::operator<<(unsigned short i) | - |
1710 | { | - |
1711 | QTextStreamPrivate * const d = d_func(); | - |
1712 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2392, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:35 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:35 |
evaluated: !d->string yes Evaluation Count:9 | yes Evaluation Count:26 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-35 |
1713 | d->putNumber((qulonglong)i, false); | - |
1714 | return *this; executed: return *this; Execution Count:35 | 35 |
1715 | } | - |
1716 | | - |
1717 | | - |
1718 | | - |
1719 | | - |
1720 | | - |
1721 | | - |
1722 | QTextStream &QTextStream::operator<<(signed int i) | - |
1723 | { | - |
1724 | QTextStreamPrivate * const d = d_func(); | - |
1725 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2405, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:4816 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:4816 |
evaluated: !d->string yes Evaluation Count:3191 | yes Evaluation Count:1625 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:3191 |
| 0-4816 |
1726 | d->putNumber((qulonglong)qAbs(qlonglong(i)), i < 0); | - |
1727 | return *this; executed: return *this; Execution Count:4816 | 4816 |
1728 | } | - |
1729 | | - |
1730 | | - |
1731 | | - |
1732 | | - |
1733 | | - |
1734 | | - |
1735 | QTextStream &QTextStream::operator<<(unsigned int i) | - |
1736 | { | - |
1737 | QTextStreamPrivate * const d = d_func(); | - |
1738 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2418, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:16 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:16 |
evaluated: !d->string yes Evaluation Count:15 | yes Evaluation Count:1 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-16 |
1739 | d->putNumber((qulonglong)i, false); | - |
1740 | return *this; executed: return *this; Execution Count:16 | 16 |
1741 | } | - |
1742 | | - |
1743 | | - |
1744 | | - |
1745 | | - |
1746 | | - |
1747 | | - |
1748 | QTextStream &QTextStream::operator<<(signed long i) | - |
1749 | { | - |
1750 | QTextStreamPrivate * const d = d_func(); | - |
1751 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2431, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:1 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: !d->string no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !d->device | 0-1 |
1752 | d->putNumber((qulonglong)qAbs(qlonglong(i)), i < 0); | - |
1753 | return *this; executed: return *this; Execution Count:1 | 1 |
1754 | } | - |
1755 | | - |
1756 | | - |
1757 | | - |
1758 | | - |
1759 | | - |
1760 | | - |
1761 | QTextStream &QTextStream::operator<<(unsigned long i) | - |
1762 | { | - |
1763 | QTextStreamPrivate * const d = d_func(); | - |
1764 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2444, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:1 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: !d->string no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !d->device | 0-1 |
1765 | d->putNumber((qulonglong)i, false); | - |
1766 | return *this; executed: return *this; Execution Count:1 | 1 |
1767 | } | - |
1768 | | - |
1769 | | - |
1770 | | - |
1771 | | - |
1772 | | - |
1773 | | - |
1774 | QTextStream &QTextStream::operator<<(qlonglong i) | - |
1775 | { | - |
1776 | QTextStreamPrivate * const d = d_func(); | - |
1777 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2457, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:136 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:136 |
evaluated: !d->string yes Evaluation Count:40 | yes Evaluation Count:96 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-136 |
1778 | d->putNumber((qulonglong)qAbs(i), i < 0); | - |
1779 | return *this; executed: return *this; Execution Count:136 | 136 |
1780 | } | - |
1781 | | - |
1782 | | - |
1783 | | - |
1784 | | - |
1785 | | - |
1786 | | - |
1787 | QTextStream &QTextStream::operator<<(qulonglong i) | - |
1788 | { | - |
1789 | QTextStreamPrivate * const d = d_func(); | - |
1790 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2470, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:29 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:29 |
evaluated: !d->string yes Evaluation Count:19 | yes Evaluation Count:10 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-29 |
1791 | d->putNumber(i, false); | - |
1792 | return *this; executed: return *this; Execution Count:29 | 29 |
1793 | } | - |
1794 | QTextStream &QTextStream::operator<<(float f) | - |
1795 | { | - |
1796 | return *this << double(f); executed: return *this << double(f); Execution Count:40 | 40 |
1797 | } | - |
1798 | | - |
1799 | | - |
1800 | | - |
1801 | | - |
1802 | | - |
1803 | | - |
1804 | QTextStream &QTextStream::operator<<(double f) | - |
1805 | { | - |
1806 | QTextStreamPrivate * const d = d_func(); | - |
1807 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2499, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:124 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:124 |
evaluated: !d->string yes Evaluation Count:14 | yes Evaluation Count:110 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-124 |
1808 | | - |
1809 | QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; | - |
1810 | switch (realNumberNotation()) { | - |
1811 | case FixedNotation: | - |
1812 | form = QLocalePrivate::DFDecimal; | - |
1813 | break; executed: break; Execution Count:2 | 2 |
1814 | case ScientificNotation: | - |
1815 | form = QLocalePrivate::DFExponent; | - |
1816 | break; executed: break; Execution Count:5 | 5 |
1817 | case SmartNotation: | - |
1818 | form = QLocalePrivate::DFSignificantDigits; | - |
1819 | break; executed: break; Execution Count:117 | 117 |
1820 | } | - |
1821 | | - |
1822 | uint flags = 0; | - |
1823 | if (numberFlags() & ShowBase) partially evaluated: numberFlags() & ShowBase no Evaluation Count:0 | yes Evaluation Count:124 |
| 0-124 |
1824 | flags |= QLocalePrivate::ShowBase; never executed: flags |= QLocalePrivate::ShowBase; | 0 |
1825 | if (numberFlags() & ForceSign) evaluated: numberFlags() & ForceSign yes Evaluation Count:4 | yes Evaluation Count:120 |
| 4-120 |
1826 | flags |= QLocalePrivate::AlwaysShowSign; executed: flags |= QLocalePrivate::AlwaysShowSign; Execution Count:4 | 4 |
1827 | if (numberFlags() & UppercaseBase) evaluated: numberFlags() & UppercaseBase yes Evaluation Count:1 | yes Evaluation Count:123 |
| 1-123 |
1828 | flags |= QLocalePrivate::UppercaseBase; executed: flags |= QLocalePrivate::UppercaseBase; Execution Count:1 | 1 |
1829 | if (numberFlags() & UppercaseDigits) evaluated: numberFlags() & UppercaseDigits yes Evaluation Count:7 | yes Evaluation Count:117 |
| 7-117 |
1830 | flags |= QLocalePrivate::CapitalEorX; executed: flags |= QLocalePrivate::CapitalEorX; Execution Count:7 | 7 |
1831 | if (numberFlags() & ForcePoint) evaluated: numberFlags() & ForcePoint yes Evaluation Count:6 | yes Evaluation Count:118 |
| 6-118 |
1832 | flags |= QLocalePrivate::Alternate; executed: flags |= QLocalePrivate::Alternate; Execution Count:6 | 6 |
1833 | | - |
1834 | const QLocalePrivate *dd = d->locale.d; | - |
1835 | QString num = dd->doubleToString(f, d->realNumberPrecision, form, -1, flags); | - |
1836 | d->putString(num, true); | - |
1837 | return *this; executed: return *this; Execution Count:124 | 124 |
1838 | } | - |
1839 | QTextStream &QTextStream::operator<<(const QString &string) | - |
1840 | { | - |
1841 | QTextStreamPrivate * const d = d_func(); | - |
1842 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2543, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:211832 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:211832 |
evaluated: !d->string yes Evaluation Count:122439 | yes Evaluation Count:89393 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:122439 |
| 0-211832 |
1843 | d->putString(string); | - |
1844 | return *this; executed: return *this; Execution Count:211832 | 211832 |
1845 | } | - |
1846 | QTextStream &QTextStream::operator<<(QLatin1String string) | - |
1847 | { | - |
1848 | QTextStreamPrivate * const d = d_func(); | - |
1849 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2558, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:6 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: !d->string yes Evaluation Count:3 | yes Evaluation Count:3 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-6 |
1850 | d->putString(QString(string)); | - |
1851 | return *this; executed: return *this; Execution Count:6 | 6 |
1852 | } | - |
1853 | | - |
1854 | | - |
1855 | | - |
1856 | | - |
1857 | | - |
1858 | | - |
1859 | | - |
1860 | QTextStream &QTextStream::operator<<(const QByteArray &array) | - |
1861 | { | - |
1862 | QTextStreamPrivate * const d = d_func(); | - |
1863 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2572, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:69 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:69 |
evaluated: !d->string yes Evaluation Count:65 | yes Evaluation Count:4 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:65 |
| 0-69 |
1864 | d->putString(QString::fromUtf8(array.constData(), array.length())); | - |
1865 | return *this; executed: return *this; Execution Count:69 | 69 |
1866 | } | - |
1867 | QTextStream &QTextStream::operator<<(const char *string) | - |
1868 | { | - |
1869 | QTextStreamPrivate * const d = d_func(); | - |
1870 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2593, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:67955 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:67955 |
evaluated: !d->string yes Evaluation Count:44304 | yes Evaluation Count:23651 |
partially evaluated: !d->device no Evaluation Count:0 | yes Evaluation Count:44304 |
| 0-67955 |
1871 | d->putString(QLatin1String(string)); | - |
1872 | return *this; executed: return *this; Execution Count:67955 | 67955 |
1873 | } | - |
1874 | | - |
1875 | | - |
1876 | | - |
1877 | | - |
1878 | | - |
1879 | | - |
1880 | | - |
1881 | QTextStream &QTextStream::operator<<(const void *ptr) | - |
1882 | { | - |
1883 | QTextStreamPrivate * const d = d_func(); | - |
1884 | do { if (!d->string && !d->device) { QMessageLogger("io/qtextstream.cpp", 2607, __PRETTY_FUNCTION__).warning("QTextStream: No device"); return *this; } } while (0); never executed: return *this; executed: } Execution Count:49 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:49 |
partially evaluated: !d->string no Evaluation Count:0 | yes Evaluation Count:49 |
never evaluated: !d->device | 0-49 |
1885 | int oldBase = d->integerBase; | - |
1886 | NumberFlags oldFlags = d->numberFlags; | - |
1887 | d->integerBase = 16; | - |
1888 | d->numberFlags |= ShowBase; | - |
1889 | d->putNumber(reinterpret_cast<quintptr>(ptr), false); | - |
1890 | d->integerBase = oldBase; | - |
1891 | d->numberFlags = oldFlags; | - |
1892 | return *this; executed: return *this; Execution Count:49 | 49 |
1893 | } | - |
1894 | QTextStream &bin(QTextStream &stream) | - |
1895 | { | - |
1896 | stream.setIntegerBase(2); | - |
1897 | return stream; executed: return stream; Execution Count:15 | 15 |
1898 | } | - |
1899 | QTextStream &oct(QTextStream &stream) | - |
1900 | { | - |
1901 | stream.setIntegerBase(8); | - |
1902 | return stream; executed: return stream; Execution Count:3 | 3 |
1903 | } | - |
1904 | QTextStream &dec(QTextStream &stream) | - |
1905 | { | - |
1906 | stream.setIntegerBase(10); | - |
1907 | return stream; never executed: return stream; | 0 |
1908 | } | - |
1909 | QTextStream &hex(QTextStream &stream) | - |
1910 | { | - |
1911 | stream.setIntegerBase(16); | - |
1912 | return stream; executed: return stream; Execution Count:34 | 34 |
1913 | } | - |
1914 | QTextStream &showbase(QTextStream &stream) | - |
1915 | { | - |
1916 | stream.setNumberFlags(stream.numberFlags() | QTextStream::ShowBase); | - |
1917 | return stream; executed: return stream; Execution Count:45 | 45 |
1918 | } | - |
1919 | QTextStream &forcesign(QTextStream &stream) | - |
1920 | { | - |
1921 | stream.setNumberFlags(stream.numberFlags() | QTextStream::ForceSign); | - |
1922 | return stream; executed: return stream; Execution Count:1 | 1 |
1923 | } | - |
1924 | QTextStream &forcepoint(QTextStream &stream) | - |
1925 | { | - |
1926 | stream.setNumberFlags(stream.numberFlags() | QTextStream::ForcePoint); | - |
1927 | return stream; executed: return stream; Execution Count:3 | 3 |
1928 | } | - |
1929 | QTextStream &noshowbase(QTextStream &stream) | - |
1930 | { | - |
1931 | stream.setNumberFlags(stream.numberFlags() &= ~QTextStream::ShowBase); | - |
1932 | return stream; never executed: return stream; | 0 |
1933 | } | - |
1934 | QTextStream &noforcesign(QTextStream &stream) | - |
1935 | { | - |
1936 | stream.setNumberFlags(stream.numberFlags() &= ~QTextStream::ForceSign); | - |
1937 | return stream; never executed: return stream; | 0 |
1938 | } | - |
1939 | QTextStream &noforcepoint(QTextStream &stream) | - |
1940 | { | - |
1941 | stream.setNumberFlags(stream.numberFlags() &= ~QTextStream::ForcePoint); | - |
1942 | return stream; never executed: return stream; | 0 |
1943 | } | - |
1944 | QTextStream &uppercasebase(QTextStream &stream) | - |
1945 | { | - |
1946 | stream.setNumberFlags(stream.numberFlags() | QTextStream::UppercaseBase); | - |
1947 | return stream; executed: return stream; Execution Count:7 | 7 |
1948 | } | - |
1949 | QTextStream &uppercasedigits(QTextStream &stream) | - |
1950 | { | - |
1951 | stream.setNumberFlags(stream.numberFlags() | QTextStream::UppercaseDigits); | - |
1952 | return stream; executed: return stream; Execution Count:10 | 10 |
1953 | } | - |
1954 | QTextStream &lowercasebase(QTextStream &stream) | - |
1955 | { | - |
1956 | stream.setNumberFlags(stream.numberFlags() & ~QTextStream::UppercaseBase); | - |
1957 | return stream; executed: return stream; Execution Count:5 | 5 |
1958 | } | - |
1959 | QTextStream &lowercasedigits(QTextStream &stream) | - |
1960 | { | - |
1961 | stream.setNumberFlags(stream.numberFlags() & ~QTextStream::UppercaseDigits); | - |
1962 | return stream; executed: return stream; Execution Count:3 | 3 |
1963 | } | - |
1964 | QTextStream &fixed(QTextStream &stream) | - |
1965 | { | - |
1966 | stream.setRealNumberNotation(QTextStream::FixedNotation); | - |
1967 | return stream; executed: return stream; Execution Count:1 | 1 |
1968 | } | - |
1969 | QTextStream &scientific(QTextStream &stream) | - |
1970 | { | - |
1971 | stream.setRealNumberNotation(QTextStream::ScientificNotation); | - |
1972 | return stream; executed: return stream; Execution Count:1 | 1 |
1973 | } | - |
1974 | QTextStream &left(QTextStream &stream) | - |
1975 | { | - |
1976 | stream.setFieldAlignment(QTextStream::AlignLeft); | - |
1977 | return stream; never executed: return stream; | 0 |
1978 | } | - |
1979 | QTextStream &right(QTextStream &stream) | - |
1980 | { | - |
1981 | stream.setFieldAlignment(QTextStream::AlignRight); | - |
1982 | return stream; never executed: return stream; | 0 |
1983 | } | - |
1984 | QTextStream ¢er(QTextStream &stream) | - |
1985 | { | - |
1986 | stream.setFieldAlignment(QTextStream::AlignCenter); | - |
1987 | return stream; never executed: return stream; | 0 |
1988 | } | - |
1989 | QTextStream &endl(QTextStream &stream) | - |
1990 | { | - |
1991 | return stream << QLatin1Char('\n') << flush; executed: return stream << QLatin1Char('\n') << flush; Execution Count:50118 | 50118 |
1992 | } | - |
1993 | QTextStream &flush(QTextStream &stream) | - |
1994 | { | - |
1995 | stream.flush(); | - |
1996 | return stream; executed: return stream; Execution Count:50120 | 50120 |
1997 | } | - |
1998 | QTextStream &reset(QTextStream &stream) | - |
1999 | { | - |
2000 | stream.reset(); | - |
2001 | return stream; never executed: return stream; | 0 |
2002 | } | - |
2003 | QTextStream &ws(QTextStream &stream) | - |
2004 | { | - |
2005 | stream.skipWhiteSpace(); | - |
2006 | return stream; executed: return stream; Execution Count:3 | 3 |
2007 | } | - |
2008 | QTextStream &bom(QTextStream &stream) | - |
2009 | { | - |
2010 | stream.setGenerateByteOrderMark(true); | - |
2011 | return stream; executed: return stream; Execution Count:1 | 1 |
2012 | } | - |
2013 | void QTextStream::setCodec(QTextCodec *codec) | - |
2014 | { | - |
2015 | QTextStreamPrivate * const d = d_func(); | - |
2016 | qint64 seekPos = -1; | - |
2017 | if (!d->readBuffer.isEmpty()) { evaluated: !d->readBuffer.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:2255 |
| 1-2255 |
2018 | if (!d->device->isSequential()) { partially evaluated: !d->device->isSequential() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2019 | seekPos = pos(); | - |
2020 | } executed: } Execution Count:1 | 1 |
2021 | } executed: } Execution Count:1 | 1 |
2022 | d->codec = codec; | - |
2023 | if (seekPos >=0 && !d->readBuffer.isEmpty()) evaluated: seekPos >=0 yes Evaluation Count:1 | yes Evaluation Count:2255 |
partially evaluated: !d->readBuffer.isEmpty() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-2255 |
2024 | seek(seekPos); executed: seek(seekPos); Execution Count:1 | 1 |
2025 | } executed: } Execution Count:2256 | 2256 |
2026 | void QTextStream::setCodec(const char *codecName) | - |
2027 | { | - |
2028 | QTextCodec *codec = QTextCodec::codecForName(codecName); | - |
2029 | if (codec) partially evaluated: codec yes Evaluation Count:1928 | no Evaluation Count:0 |
| 0-1928 |
2030 | setCodec(codec); executed: setCodec(codec); Execution Count:1928 | 1928 |
2031 | } executed: } Execution Count:1928 | 1928 |
2032 | | - |
2033 | | - |
2034 | | - |
2035 | | - |
2036 | | - |
2037 | | - |
2038 | QTextCodec *QTextStream::codec() const | - |
2039 | { | - |
2040 | const QTextStreamPrivate * const d = d_func(); | - |
2041 | return d->codec; executed: return d->codec; Execution Count:44508 | 44508 |
2042 | } | - |
2043 | void QTextStream::setAutoDetectUnicode(bool enabled) | - |
2044 | { | - |
2045 | QTextStreamPrivate * const d = d_func(); | - |
2046 | d->autoDetectUnicode = enabled; | - |
2047 | } executed: } Execution Count:54 | 54 |
2048 | | - |
2049 | | - |
2050 | | - |
2051 | | - |
2052 | | - |
2053 | | - |
2054 | | - |
2055 | bool QTextStream::autoDetectUnicode() const | - |
2056 | { | - |
2057 | const QTextStreamPrivate * const d = d_func(); | - |
2058 | return d->autoDetectUnicode; executed: return d->autoDetectUnicode; Execution Count:2 | 2 |
2059 | } | - |
2060 | void QTextStream::setGenerateByteOrderMark(bool generate) | - |
2061 | { | - |
2062 | QTextStreamPrivate * const d = d_func(); | - |
2063 | if (d->writeBuffer.isEmpty()) { partially evaluated: d->writeBuffer.isEmpty() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
2064 | if (generate) evaluated: generate yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
2065 | d->writeConverterState.flags &= ~QTextCodec::IgnoreHeader; executed: d->writeConverterState.flags &= ~QTextCodec::IgnoreHeader; Execution Count:2 | 2 |
2066 | else | - |
2067 | d->writeConverterState.flags |= QTextCodec::IgnoreHeader; executed: d->writeConverterState.flags |= QTextCodec::IgnoreHeader; Execution Count:1 | 1 |
2068 | } | - |
2069 | } executed: } Execution Count:3 | 3 |
2070 | bool QTextStream::generateByteOrderMark() const | - |
2071 | { | - |
2072 | const QTextStreamPrivate * const d = d_func(); | - |
2073 | return (d->writeConverterState.flags & QTextCodec::IgnoreHeader) == 0; executed: return (d->writeConverterState.flags & QTextCodec::IgnoreHeader) == 0; Execution Count:2 | 2 |
2074 | } | - |
2075 | void QTextStream::setLocale(const QLocale &locale) | - |
2076 | { | - |
2077 | QTextStreamPrivate * const d = d_func(); | - |
2078 | d->locale = locale; | - |
2079 | } executed: } Execution Count:16 | 16 |
2080 | QLocale QTextStream::locale() const | - |
2081 | { | - |
2082 | const QTextStreamPrivate * const d = d_func(); | - |
2083 | return d->locale; never executed: return d->locale; | 0 |
2084 | } | - |
2085 | | - |
2086 | | - |
2087 | | - |
2088 | | - |
2089 | | - |
| | |