xml/qxmlstream.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5QXmlStreamEntityResolver::~QXmlStreamEntityResolver() -
6{ -
7} -
8 -
9 -
10 -
11 -
12 -
13 -
14QString QXmlStreamEntityResolver::resolveEntity(const QString& , const QString& ) -
15{ -
16 return QString();
never executed: return QString();
0
17} -
18QString QXmlStreamEntityResolver::resolveUndeclaredEntity(const QString & ) -
19{ -
20 return QString();
never executed: return QString();
0
21} -
22 -
23 -
24 -
25QString QXmlStreamReaderPrivate::resolveUndeclaredEntity(const QString &name) -
26{ -
27 if (entityResolver)
partially evaluated: entityResolver
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
28 return entityResolver->resolveUndeclaredEntity(name);
executed: return entityResolver->resolveUndeclaredEntity(name);
Execution Count:2
2
29 return QString();
never executed: return QString();
0
30} -
31void QXmlStreamReader::setEntityResolver(QXmlStreamEntityResolver *resolver) -
32{ -
33 QXmlStreamReaderPrivate * const d = d_func(); -
34 d->entityResolver = resolver; -
35}
executed: }
Execution Count:1
1
36QXmlStreamEntityResolver *QXmlStreamReader::entityResolver() const -
37{ -
38 const QXmlStreamReaderPrivate * const d = d_func(); -
39 return d->entityResolver;
never executed: return d->entityResolver;
0
40} -
41QXmlStreamReader::QXmlStreamReader() -
42 : d_ptr(new QXmlStreamReaderPrivate(this)) -
43{ -
44}
executed: }
Execution Count:3165
3165
45 -
46 -
47 -
48 -
49 -
50QXmlStreamReader::QXmlStreamReader(QIODevice *device) -
51 : d_ptr(new QXmlStreamReaderPrivate(this)) -
52{ -
53 setDevice(device); -
54}
executed: }
Execution Count:472
472
55 -
56 -
57 -
58 -
59 -
60 -
61QXmlStreamReader::QXmlStreamReader(const QByteArray &data) -
62 : d_ptr(new QXmlStreamReaderPrivate(this)) -
63{ -
64 QXmlStreamReaderPrivate * const d = d_func(); -
65 d->dataBuffer = data; -
66}
executed: }
Execution Count:812
812
67 -
68 -
69 -
70 -
71 -
72 -
73QXmlStreamReader::QXmlStreamReader(const QString &data) -
74 : d_ptr(new QXmlStreamReaderPrivate(this)) -
75{ -
76 QXmlStreamReaderPrivate * const d = d_func(); -
77 -
78 -
79 -
80 d->dataBuffer = d->codec->fromUnicode(data); -
81 d->decoder = d->codec->makeDecoder(); -
82 -
83 d->lockEncoding = true; -
84 -
85}
executed: }
Execution Count:255
255
86 -
87 -
88 -
89 -
90 -
91 -
92QXmlStreamReader::QXmlStreamReader(const char *data) -
93 : d_ptr(new QXmlStreamReaderPrivate(this)) -
94{ -
95 QXmlStreamReaderPrivate * const d = d_func(); -
96 d->dataBuffer = QByteArray(data); -
97}
executed: }
Execution Count:6
6
98 -
99 -
100 -
101 -
102QXmlStreamReader::~QXmlStreamReader() -
103{ -
104 QXmlStreamReaderPrivate * const d = d_func(); -
105 if (d->deleteDevice)
partially evaluated: d->deleteDevice
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4710
0-4710
106 delete d->device;
never executed: delete d->device;
0
107}
executed: }
Execution Count:4710
4710
108void QXmlStreamReader::setDevice(QIODevice *device) -
109{ -
110 QXmlStreamReaderPrivate * const d = d_func(); -
111 if (d->deleteDevice) {
partially evaluated: d->deleteDevice
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2184
0-2184
112 delete d->device; -
113 d->deleteDevice = false; -
114 }
never executed: }
0
115 d->device = device; -
116 d->init(); -
117 -
118}
executed: }
Execution Count:2184
2184
119 -
120 -
121 -
122 -
123 -
124 -
125 -
126QIODevice *QXmlStreamReader::device() const -
127{ -
128 const QXmlStreamReaderPrivate * const d = d_func(); -
129 return d->device;
never executed: return d->device;
0
130} -
131void QXmlStreamReader::addData(const QByteArray &data) -
132{ -
133 QXmlStreamReaderPrivate * const d = d_func(); -
134 if (d->device) {
partially evaluated: d->device
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:57484
0-57484
135 QMessageLogger("xml/qxmlstream.cpp", 504, __PRETTY_FUNCTION__).warning("QXmlStreamReader: addData() with device()"); -
136 return;
never executed: return;
0
137 } -
138 d->dataBuffer += data; -
139}
executed: }
Execution Count:57484
57484
140 -
141 -
142 -
143 -
144 -
145 -
146 -
147void QXmlStreamReader::addData(const QString &data) -
148{ -
149 QXmlStreamReaderPrivate * const d = d_func(); -
150 d->lockEncoding = true; -
151 -
152 -
153 -
154 addData(d->codec->fromUnicode(data)); -
155 -
156}
executed: }
Execution Count:4
4
157 -
158 -
159 -
160 -
161 -
162 -
163 -
164void QXmlStreamReader::addData(const char *data) -
165{ -
166 addData(QByteArray(data)); -
167}
executed: }
Execution Count:2
2
168 -
169 -
170 -
171 -
172 -
173 -
174 -
175void QXmlStreamReader::clear() -
176{ -
177 QXmlStreamReaderPrivate * const d = d_func(); -
178 d->init(); -
179 if (d->device) {
partially evaluated: d->device
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
180 if (d->deleteDevice)
never evaluated: d->deleteDevice
0
181 delete d->device;
never executed: delete d->device;
0
182 d->device = 0; -
183 }
never executed: }
0
184}
executed: }
Execution Count:3
3
185bool QXmlStreamReader::atEnd() const -
186{ -
187 const QXmlStreamReaderPrivate * const d = d_func(); -
188 if (d->atEnd
evaluated: d->atEnd
TRUEFALSE
yes
Evaluation Count:118390
yes
Evaluation Count:338231
118390-338231
189 && ((d->type == QXmlStreamReader::Invalid && d->error == PrematureEndOfDocumentError)
evaluated: d->type == QXmlStreamReader::Invalid
TRUEFALSE
yes
Evaluation Count:115545
yes
Evaluation Count:2845
partially evaluated: d->error == PrematureEndOfDocumentError
TRUEFALSE
yes
Evaluation Count:115545
no
Evaluation Count:0
0-115545
190 || (d->type == QXmlStreamReader::EndDocument))) {
partially evaluated: (d->type == QXmlStreamReader::EndDocument)
TRUEFALSE
yes
Evaluation Count:2845
no
Evaluation Count:0
0-2845
191 if (d->device)
evaluated: d->device
TRUEFALSE
yes
Evaluation Count:527
yes
Evaluation Count:117863
527-117863
192 return d->device->atEnd();
executed: return d->device->atEnd();
Execution Count:527
527
193 else -
194 return !d->dataBuffer.size();
executed: return !d->dataBuffer.size();
Execution Count:117863
117863
195 } -
196 return (d->atEnd || d->type == QXmlStreamReader::Invalid);
executed: return (d->atEnd || d->type == QXmlStreamReader::Invalid);
Execution Count:338231
338231
197} -
198QXmlStreamReader::TokenType QXmlStreamReader::readNext() -
199{ -
200 QXmlStreamReaderPrivate * const d = d_func(); -
201 if (d->type != Invalid) {
evaluated: d->type != Invalid
TRUEFALSE
yes
Evaluation Count:411630
yes
Evaluation Count:57494
57494-411630
202 if (!d->hasCheckedStartDocument)
evaluated: !d->hasCheckedStartDocument
TRUEFALSE
yes
Evaluation Count:5742
yes
Evaluation Count:405888
5742-405888
203 if (!d->checkStartDocument())
evaluated: !d->checkStartDocument()
TRUEFALSE
yes
Evaluation Count:4651
yes
Evaluation Count:1091
1091-4651
204 return d->type;
executed: return d->type;
Execution Count:4651
4651
205 d->parse(); -
206 if (d->atEnd && d->type != EndDocument && d->type != Invalid)
evaluated: d->atEnd
TRUEFALSE
yes
Evaluation Count:58231
yes
Evaluation Count:348748
evaluated: d->type != EndDocument
TRUEFALSE
yes
Evaluation Count:56038
yes
Evaluation Count:2193
evaluated: d->type != Invalid
TRUEFALSE
yes
Evaluation Count:45171
yes
Evaluation Count:10867
2193-348748
207 d->raiseError(PrematureEndOfDocumentError);
executed: d->raiseError(PrematureEndOfDocumentError);
Execution Count:45171
45171
208 else if (!d->atEnd && d->type == EndDocument)
evaluated: !d->atEnd
TRUEFALSE
yes
Evaluation Count:348748
yes
Evaluation Count:13060
evaluated: d->type == EndDocument
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:348743
5-348748
209 d->raiseWellFormedError(QXmlStream::tr("Extra content at end of document."));
executed: d->raiseWellFormedError(QXmlStream::tr("Extra content at end of document."));
Execution Count:5
5
210 } else if (d->error == PrematureEndOfDocumentError) {
evaluated: d->error == PrematureEndOfDocumentError
TRUEFALSE
yes
Evaluation Count:57482
yes
Evaluation Count:12
12-57482
211 -
212 d->type = NoToken; -
213 d->atEnd = false; -
214 d->token = -1; -
215 return readNext();
executed: return readNext();
Execution Count:57482
57482
216 } -
217 return d->type;
executed: return d->type;
Execution Count:406991
406991
218} -
219QXmlStreamReader::TokenType QXmlStreamReader::tokenType() const -
220{ -
221 const QXmlStreamReaderPrivate * const d = d_func(); -
222 return d->type;
executed: return d->type;
Execution Count:461403
461403
223} -
224bool QXmlStreamReader::readNextStartElement() -
225{ -
226 while (readNext() != Invalid) {
evaluated: readNext() != Invalid
TRUEFALSE
yes
Evaluation Count:13186
yes
Evaluation Count:12
12-13186
227 if (isEndElement())
evaluated: isEndElement()
TRUEFALSE
yes
Evaluation Count:2272
yes
Evaluation Count:10914
2272-10914
228 return false;
executed: return false;
Execution Count:2272
2272
229 else if (isStartElement())
evaluated: isStartElement()
TRUEFALSE
yes
Evaluation Count:4635
yes
Evaluation Count:6279
4635-6279
230 return true;
executed: return true;
Execution Count:4635
4635
231 } -
232 return false;
executed: return false;
Execution Count:12
12
233} -
234void QXmlStreamReader::skipCurrentElement() -
235{ -
236 int depth = 1; -
237 while (depth && readNext() != Invalid) {
evaluated: depth
TRUEFALSE
yes
Evaluation Count:2199
yes
Evaluation Count:2155
evaluated: readNext() != Invalid
TRUEFALSE
yes
Evaluation Count:2192
yes
Evaluation Count:7
7-2199
238 if (isEndElement())
evaluated: isEndElement()
TRUEFALSE
yes
Evaluation Count:2168
yes
Evaluation Count:24
24-2168
239 --depth;
executed: --depth;
Execution Count:2168
2168
240 else if (isStartElement())
evaluated: isStartElement()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:11
11-13
241 ++depth;
executed: ++depth;
Execution Count:13
13
242 } -
243}
executed: }
Execution Count:2162
2162
244static const char QXmlStreamReader_tokenTypeString_string[] = -
245 "NoToken\0" -
246 "Invalid\0" -
247 "StartDocument\0" -
248 "EndDocument\0" -
249 "StartElement\0" -
250 "EndElement\0" -
251 "Characters\0" -
252 "Comment\0" -
253 "DTD\0" -
254 "EntityReference\0" -
255 "ProcessingInstruction\0"; -
256 -
257static const short QXmlStreamReader_tokenTypeString_indices[] = { -
258 0, 8, 16, 30, 42, 55, 66, 77, 85, 89, 105, 0 -
259}; -
260void QXmlStreamReader::setNamespaceProcessing(bool enable) -
261{ -
262 QXmlStreamReaderPrivate * const d = d_func(); -
263 d->namespaceProcessing = enable; -
264}
never executed: }
0
265 -
266bool QXmlStreamReader::namespaceProcessing() const -
267{ -
268 const QXmlStreamReaderPrivate * const d = d_func(); -
269 return d->namespaceProcessing;
never executed: return d->namespaceProcessing;
0
270} -
271 -
272 -
273 -
274 -
275 -
276QString QXmlStreamReader::tokenString() const -
277{ -
278 const QXmlStreamReaderPrivate * const d = d_func(); -
279 return QLatin1String(QXmlStreamReader_tokenTypeString_string + 1891
280 QXmlStreamReader_tokenTypeString_indices[d->type]);
executed: return QLatin1String(QXmlStreamReader_tokenTypeString_string + QXmlStreamReader_tokenTypeString_indices[d->type]);
Execution Count:1891
1891
281} -
282 -
283 -
284 -
285QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack() -
286{ -
287 tagStack.reserve(16); -
288 tagStackStringStorage.reserve(32); -
289 tagStackStringStorageSize = 0; -
290 NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); -
291 namespaceDeclaration.prefix = addToStringStorage(QLatin1String("xml")); -
292 namespaceDeclaration.namespaceUri = addToStringStorage(QLatin1String("http://www.w3.org/XML/1998/namespace")); -
293}
executed: }
Execution Count:5532
5532
294 -
295 -
296 -
297QXmlStreamReaderPrivate::QXmlStreamReaderPrivate(QXmlStreamReader *q) -
298 :q_ptr(q) -
299{ -
300 device = 0; -
301 deleteDevice = false; -
302 -
303 decoder = 0; -
304 -
305 stack_size = 64; -
306 sym_stack = 0; -
307 state_stack = 0; -
308 reallocateStack(); -
309 entityResolver = 0; -
310 init(); -
311 entityHash.insert(QLatin1String("lt"), Entity::createLiteral(QLatin1String("<"))); -
312 entityHash.insert(QLatin1String("gt"), Entity::createLiteral(QLatin1String(">"))); -
313 entityHash.insert(QLatin1String("amp"), Entity::createLiteral(QLatin1String("&"))); -
314 entityHash.insert(QLatin1String("apos"), Entity::createLiteral(QLatin1String("'"))); -
315 entityHash.insert(QLatin1String("quot"), Entity::createLiteral(QLatin1String("\""))); -
316}
executed: }
Execution Count:4801
4801
317 -
318void QXmlStreamReaderPrivate::init() -
319{ -
320 scanDtd = false; -
321 token = -1; -
322 token_char = 0; -
323 isEmptyElement = false; -
324 isWhitespace = true; -
325 isCDATA = false; -
326 standalone = false; -
327 tos = 0; -
328 resumeReduction = 0; -
329 state_stack[tos++] = 0; -
330 state_stack[tos] = 0; -
331 putStack.clear(); -
332 putStack.reserve(32); -
333 textBuffer.clear(); -
334 textBuffer.reserve(256); -
335 tagStack.clear(); -
336 tagsDone = false; -
337 attributes.clear(); -
338 attributes.reserve(16); -
339 lineNumber = lastLineStart = characterOffset = 0; -
340 readBufferPos = 0; -
341 nbytesread = 0; -
342 -
343 codec = QTextCodec::codecForMib(106); -
344 delete decoder; -
345 decoder = 0; -
346 -
347 attributeStack.clear(); -
348 attributeStack.reserve(16); -
349 entityParser = 0; -
350 hasCheckedStartDocument = false; -
351 normalizeLiterals = false; -
352 hasSeenTag = false; -
353 atEnd = false; -
354 inParseEntity = false; -
355 referenceToUnparsedEntityDetected = false; -
356 referenceToParameterEntityDetected = false; -
357 hasExternalDtdSubset = false; -
358 lockEncoding = false; -
359 namespaceProcessing = true; -
360 rawReadBuffer.clear(); -
361 dataBuffer.clear(); -
362 readBuffer.clear(); -
363 -
364 type = QXmlStreamReader::NoToken; -
365 error = QXmlStreamReader::NoError; -
366}
executed: }
Execution Count:7021
7021
367 -
368 -
369 -
370 -
371 -
372void QXmlStreamReaderPrivate::parseEntity(const QString &value) -
373{ -
374 QXmlStreamReader * const q = q_func(); -
375 -
376 if (value.isEmpty())
evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:124
14-124
377 return;
executed: return;
Execution Count:14
14
378 -
379 -
380 if (!entityParser)
evaluated: !entityParser
TRUEFALSE
yes
Evaluation Count:91
yes
Evaluation Count:33
33-91
381 entityParser = new QXmlStreamReaderPrivate(q);
executed: entityParser = new QXmlStreamReaderPrivate(q);
Execution Count:91
91
382 else -
383 entityParser->init();
executed: entityParser->init();
Execution Count:33
33
384 entityParser->inParseEntity = true; -
385 entityParser->readBuffer = value; -
386 entityParser->injectToken(PARSE_ENTITY); -
387 while (!entityParser->atEnd && entityParser->type != QXmlStreamReader::Invalid)
evaluated: !entityParser->atEnd
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:118
evaluated: entityParser->type != QXmlStreamReader::Invalid
TRUEFALSE
yes
Evaluation Count:209
yes
Evaluation Count:6
6-215
388 entityParser->parse();
executed: entityParser->parse();
Execution Count:209
209
389 if (entityParser->type == QXmlStreamReader::Invalid || entityParser->tagStack.size())
evaluated: entityParser->type == QXmlStreamReader::Invalid
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:108
evaluated: entityParser->tagStack.size()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:106
2-108
390 raiseWellFormedError(QXmlStream::tr("Invalid entity value."));
executed: raiseWellFormedError(QXmlStream::tr("Invalid entity value."));
Execution Count:18
18
391 -
392}
executed: }
Execution Count:124
124
393 -
394inline void QXmlStreamReaderPrivate::reallocateStack() -
395{ -
396 stack_size <<= 1; -
397 sym_stack = reinterpret_cast<Value*> (realloc(sym_stack, stack_size * sizeof(Value))); -
398 do { if (!(sym_stack)) qBadAlloc(); } while (0);
never executed: qBadAlloc();
partially evaluated: !(sym_stack)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4802
executed: }
Execution Count:4802
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4802
0-4802
399 state_stack = reinterpret_cast<int*> (realloc(state_stack, stack_size * sizeof(int))); -
400 do { if (!(sym_stack)) qBadAlloc(); } while (0);
partially evaluated: !(sym_stack)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4802
never executed: qBadAlloc();
executed: }
Execution Count:4802
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4802
0-4802
401}
executed: }
Execution Count:4802
4802
402 -
403 -
404QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate() -
405{ -
406 -
407 delete decoder; -
408 -
409 free(sym_stack); -
410 free(state_stack); -
411 delete entityParser; -
412}
executed: }
Execution Count:4801
4801
413 -
414 -
415inline uint QXmlStreamReaderPrivate::filterCarriageReturn() -
416{ -
417 uint peekc = peekChar(); -
418 if (peekc == '\n') {
evaluated: peekc == '\n'
TRUEFALSE
yes
Evaluation Count:8294
yes
Evaluation Count:2156
2156-8294
419 if (putStack.size())
partially evaluated: putStack.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8294
0-8294
420 putStack.pop();
never executed: putStack.pop();
0
421 else -
422 ++readBufferPos;
executed: ++readBufferPos;
Execution Count:8294
8294
423 return peekc;
executed: return peekc;
Execution Count:8294
8294
424 } -
425 if (peekc == 0) {
evaluated: peekc == 0
TRUEFALSE
yes
Evaluation Count:2146
yes
Evaluation Count:10
10-2146
426 putChar('\r'); -
427 return 0;
executed: return 0;
Execution Count:2146
2146
428 } -
429 return '\n';
executed: return '\n';
Execution Count:10
10
430} -
431 -
432 -
433 -
434 -
435 -
436inline uint QXmlStreamReaderPrivate::getChar() -
437{ -
438 uint c; -
439 if (putStack.size()) {
evaluated: putStack.size()
TRUEFALSE
yes
Evaluation Count:920172
yes
Evaluation Count:4993541
920172-4993541
440 c = atEnd ? 0 : putStack.pop();
evaluated: atEnd
TRUEFALSE
yes
Evaluation Count:4857
yes
Evaluation Count:915315
4857-915315
441 } else {
executed: }
Execution Count:920172
920172
442 if (readBufferPos < readBuffer.size())
evaluated: readBufferPos < readBuffer.size()
TRUEFALSE
yes
Evaluation Count:4880341
yes
Evaluation Count:113200
113200-4880341
443 c = readBuffer.at(readBufferPos++).unicode();
executed: c = readBuffer.at(readBufferPos++).unicode();
Execution Count:4880341
4880341
444 else -
445 c = getChar_helper();
executed: c = getChar_helper();
Execution Count:113200
113200
446 } -
447 -
448 return c;
executed: return c;
Execution Count:5913713
5913713
449} -
450 -
451inline uint QXmlStreamReaderPrivate::peekChar() -
452{ -
453 uint c; -
454 if (putStack.size()) {
evaluated: putStack.size()
TRUEFALSE
yes
Evaluation Count:13758
yes
Evaluation Count:79947
13758-79947
455 c = putStack.top(); -
456 } else if (readBufferPos < readBuffer.size()) {
evaluated: readBufferPos < readBuffer.size()
TRUEFALSE
yes
Evaluation Count:73265
yes
Evaluation Count:6682
executed: }
Execution Count:13758
6682-73265
457 c = readBuffer.at(readBufferPos).unicode(); -
458 } else {
executed: }
Execution Count:73265
73265
459 if ((c = getChar_helper()))
evaluated: (c = getChar_helper())
TRUEFALSE
yes
Evaluation Count:3331
yes
Evaluation Count:3351
3331-3351
460 --readBufferPos;
executed: --readBufferPos;
Execution Count:3331
3331
461 }
executed: }
Execution Count:6682
6682
462 -
463 return c;
executed: return c;
Execution Count:93705
93705
464} -
465bool QXmlStreamReaderPrivate::scanUntil(const char *str, short tokenToInject) -
466{ -
467 int pos = textBuffer.size(); -
468 int oldLineNumber = lineNumber; -
469 -
470 while (uint c = getChar()) {
evaluated: uint c = getChar()
TRUEFALSE
yes
Evaluation Count:1061152
yes
Evaluation Count:5871
5871-1061152
471 -
472 switch (c) { -
473 case '\r': -
474 if ((c = filterCarriageReturn()) == 0)
evaluated: (c = filterCarriageReturn()) == 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:402
3-402
475 break;
executed: break;
Execution Count:3
3
476 -
477 case '\n':
code before this statement executed: case '\n':
Execution Count:402
402
478 ++lineNumber; -
479 lastLineStart = characterOffset + readBufferPos; -
480 -
481 case '\t':
code before this statement executed: case '\t':
Execution Count:1645
1645
482 textBuffer += QChar(c); -
483 continue;
executed: continue;
Execution Count:2368
2368
484 default: -
485 if (c < 0x20 || (c > 0xFFFD && c < 0x10000) || c > QChar::LastValidCodePoint ) {
evaluated: c < 0x20
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:1058751
partially evaluated: c > 0xFFFD
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1058751
never evaluated: c < 0x10000
partially evaluated: c > QChar::LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1058751
0-1058751
486 raiseWellFormedError(QXmlStream::tr("Invalid XML character.")); -
487 lineNumber = oldLineNumber; -
488 return false;
executed: return false;
Execution Count:30
30
489 } -
490 textBuffer += QChar(c); -
491 }
executed: }
Execution Count:1058751
1058751
492 -
493 -
494 -
495 if (c == uint(*str)) {
evaluated: c == uint(*str)
TRUEFALSE
yes
Evaluation Count:63739
yes
Evaluation Count:995015
63739-995015
496 if (!*(str + 1)) {
partially evaluated: !*(str + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:63739
0-63739
497 if (tokenToInject >= 0)
never evaluated: tokenToInject >= 0
0
498 injectToken(tokenToInject);
never executed: injectToken(tokenToInject);
0
499 return true;
never executed: return true;
0
500 } else { -
501 if (scanString(str + 1, tokenToInject, false))
evaluated: scanString(str + 1, tokenToInject, false)
TRUEFALSE
yes
Evaluation Count:62699
yes
Evaluation Count:1040
1040-62699
502 return true;
executed: return true;
Execution Count:62699
62699
503 }
executed: }
Execution Count:1040
1040
504 } -
505 }
executed: }
Execution Count:996055
996055
506 putString(textBuffer, pos); -
507 textBuffer.resize(pos); -
508 lineNumber = oldLineNumber; -
509 return false;
executed: return false;
Execution Count:5871
5871
510} -
511 -
512bool QXmlStreamReaderPrivate::scanString(const char *str, short tokenToInject, bool requireSpace) -
513{ -
514 int n = 0; -
515 while (str[n]) {
evaluated: str[n]
TRUEFALSE
yes
Evaluation Count:585719
yes
Evaluation Count:123197
123197-585719
516 ushort c = getChar(); -
517 if (c != ushort(str[n])) {
evaluated: c != ushort(str[n])
TRUEFALSE
yes
Evaluation Count:24900
yes
Evaluation Count:560819
24900-560819
518 if (c)
evaluated: c
TRUEFALSE
yes
Evaluation Count:6731
yes
Evaluation Count:18169
6731-18169
519 putChar(c);
executed: putChar(c);
Execution Count:6731
6731
520 while (n--) {
evaluated: n--
TRUEFALSE
yes
Evaluation Count:39555
yes
Evaluation Count:24900
24900-39555
521 putChar(ushort(str[n])); -
522 }
executed: }
Execution Count:39555
39555
523 return false;
executed: return false;
Execution Count:24900
24900
524 } -
525 ++n; -
526 }
executed: }
Execution Count:560819
560819
527 for (int i = 0; i < n; ++i)
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:521264
yes
Evaluation Count:123197
123197-521264
528 textBuffer += QChar(ushort(str[i]));
executed: textBuffer += QChar(ushort(str[i]));
Execution Count:521264
521264
529 if (requireSpace) {
evaluated: requireSpace
TRUEFALSE
yes
Evaluation Count:10541
yes
Evaluation Count:112656
10541-112656
530 int s = fastScanSpace(); -
531 if (!s || atEnd) {
evaluated: !s
TRUEFALSE
yes
Evaluation Count:1608
yes
Evaluation Count:8933
evaluated: atEnd
TRUEFALSE
yes
Evaluation Count:1435
yes
Evaluation Count:7498
1435-8933
532 int pos = textBuffer.size() - n - s; -
533 putString(textBuffer, pos); -
534 textBuffer.resize(pos); -
535 return false;
executed: return false;
Execution Count:3043
3043
536 } -
537 }
executed: }
Execution Count:7498
7498
538 if (tokenToInject >= 0)
evaluated: tokenToInject >= 0
TRUEFALSE
yes
Evaluation Count:57455
yes
Evaluation Count:62699
57455-62699
539 injectToken(tokenToInject);
executed: injectToken(tokenToInject);
Execution Count:57455
57455
540 return true;
executed: return true;
Execution Count:120154
120154
541} -
542 -
543bool QXmlStreamReaderPrivate::scanAfterLangleBang() -
544{ -
545 switch (peekChar()) { -
546 case '[': -
547 return scanString(spell[CDATA_START], CDATA_START, false);
executed: return scanString(spell[CDATA_START], CDATA_START, false);
Execution Count:46321
46321
548 case 'D': -
549 return scanString(spell[DOCTYPE], DOCTYPE);
executed: return scanString(spell[DOCTYPE], DOCTYPE);
Execution Count:3683
3683
550 case 'A': -
551 return scanString(spell[ATTLIST], ATTLIST);
executed: return scanString(spell[ATTLIST], ATTLIST);
Execution Count:2230
2230
552 case 'N': -
553 return scanString(spell[NOTATION], NOTATION);
executed: return scanString(spell[NOTATION], NOTATION);
Execution Count:382
382
554 case 'E': -
555 if (scanString(spell[ELEMENT], ELEMENT))
evaluated: scanString(spell[ELEMENT], ELEMENT)
TRUEFALSE
yes
Evaluation Count:2122
yes
Evaluation Count:4575
2122-4575
556 return true;
executed: return true;
Execution Count:2122
2122
557 return scanString(spell[ENTITY], ENTITY);
executed: return scanString(spell[ENTITY], ENTITY);
Execution Count:4575
4575
558 -
559 default: -
560 ; -
561 };
executed: }
Execution Count:17122
17122
562 return false;
executed: return false;
Execution Count:17122
17122
563} -
564 -
565bool QXmlStreamReaderPrivate::scanPublicOrSystem() -
566{ -
567 switch (peekChar()) { -
568 case 'S': -
569 return scanString(spell[SYSTEM], SYSTEM);
executed: return scanString(spell[SYSTEM], SYSTEM);
Execution Count:440
440
570 case 'P': -
571 return scanString(spell[PUBLIC], PUBLIC);
executed: return scanString(spell[PUBLIC], PUBLIC);
Execution Count:263
263
572 default: -
573 ; -
574 }
executed: }
Execution Count:1854
1854
575 return false;
executed: return false;
Execution Count:1854
1854
576} -
577 -
578bool QXmlStreamReaderPrivate::scanNData() -
579{ -
580 if (fastScanSpace()) {
evaluated: fastScanSpace()
TRUEFALSE
yes
Evaluation Count:150
yes
Evaluation Count:48
48-150
581 if (scanString(spell[NDATA], NDATA))
evaluated: scanString(spell[NDATA], NDATA)
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:103
47-103
582 return true;
executed: return true;
Execution Count:47
47
583 putChar(' '); -
584 }
executed: }
Execution Count:103
103
585 return false;
executed: return false;
Execution Count:151
151
586} -
587 -
588bool QXmlStreamReaderPrivate::scanAfterDefaultDecl() -
589{ -
590 switch (peekChar()) { -
591 case 'R': -
592 return scanString(spell[REQUIRED], REQUIRED, false);
executed: return scanString(spell[REQUIRED], REQUIRED, false);
Execution Count:565
565
593 case 'I': -
594 return scanString(spell[IMPLIED], IMPLIED, false);
executed: return scanString(spell[IMPLIED], IMPLIED, false);
Execution Count:1317
1317
595 case 'F': -
596 return scanString(spell[FIXED], FIXED, false);
executed: return scanString(spell[FIXED], FIXED, false);
Execution Count:72
72
597 default: -
598 ; -
599 }
executed: }
Execution Count:200
200
600 return false;
executed: return false;
Execution Count:200
200
601} -
602 -
603bool QXmlStreamReaderPrivate::scanAttType() -
604{ -
605 switch (peekChar()) { -
606 case 'C': -
607 return scanString(spell[CDATA], CDATA);
executed: return scanString(spell[CDATA], CDATA);
Execution Count:1256
1256
608 case 'I': -
609 if (scanString(spell[ID], ID))
evaluated: scanString(spell[ID], ID)
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:202
70-202
610 return true;
executed: return true;
Execution Count:70
70
611 if (scanString(spell[IDREF], IDREF))
evaluated: scanString(spell[IDREF], IDREF)
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:179
23-179
612 return true;
executed: return true;
Execution Count:23
23
613 return scanString(spell[IDREFS], IDREFS);
executed: return scanString(spell[IDREFS], IDREFS);
Execution Count:179
179
614 case 'E': -
615 if (scanString(spell[ENTITY], ENTITY))
evaluated: scanString(spell[ENTITY], ENTITY)
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:137
26-137
616 return true;
executed: return true;
Execution Count:26
26
617 return scanString(spell[ENTITIES], ENTITIES);
executed: return scanString(spell[ENTITIES], ENTITIES);
Execution Count:137
137
618 case 'N': -
619 if (scanString(spell[NOTATION], NOTATION))
evaluated: scanString(spell[NOTATION], NOTATION)
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:292
42-292
620 return true;
executed: return true;
Execution Count:42
42
621 if (scanString(spell[NMTOKEN], NMTOKEN))
evaluated: scanString(spell[NMTOKEN], NMTOKEN)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:268
24-268
622 return true;
executed: return true;
Execution Count:24
24
623 return scanString(spell[NMTOKENS], NMTOKENS);
executed: return scanString(spell[NMTOKENS], NMTOKENS);
Execution Count:268
268
624 default: -
625 ; -
626 }
executed: }
Execution Count:84
84
627 return false;
executed: return false;
Execution Count:84
84
628} -
629inline int QXmlStreamReaderPrivate::fastScanLiteralContent() -
630{ -
631 int n = 0; -
632 uint c; -
633 while ((c = getChar())) {
evaluated: (c = getChar())
TRUEFALSE
yes
Evaluation Count:424128
yes
Evaluation Count:2235
2235-424128
634 switch (ushort(c)) { -
635 case 0xfffe: -
636 case 0xffff: -
637 case 0: -
638 -
639 -
640 putChar(c); -
641 return n;
executed: return n;
Execution Count:82
82
642 case '\r': -
643 if (filterCarriageReturn() == 0)
evaluated: filterCarriageReturn() == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:23
1-23
644 return n;
executed: return n;
Execution Count:1
1
645 -
646 case '\n':
code before this statement executed: case '\n':
Execution Count:23
23
647 ++lineNumber; -
648 lastLineStart = characterOffset + readBufferPos; -
649 -
650 case ' ':
code before this statement executed: case ' ':
Execution Count:235
235
651 case '\t': -
652 if (normalizeLiterals)
evaluated: normalizeLiterals
TRUEFALSE
yes
Evaluation Count:8899
yes
Evaluation Count:557
557-8899
653 textBuffer += QLatin1Char(' ');
executed: textBuffer += QLatin1Char(' ');
Execution Count:8899
8899
654 else -
655 textBuffer += QChar(c);
executed: textBuffer += QChar(c);
Execution Count:557
557
656 ++n; -
657 break;
executed: break;
Execution Count:9456
9456
658 case '&': -
659 case '<': -
660 case '\"': -
661 case '\'': -
662 if (!(c & 0xff0000)) {
partially evaluated: !(c & 0xff0000)
TRUEFALSE
yes
Evaluation Count:80845
no
Evaluation Count:0
0-80845
663 putChar(c); -
664 return n;
executed: return n;
Execution Count:80845
80845
665 } -
666 -
667 default:
code before this statement never executed: default:
0
668 textBuffer += QChar(c); -
669 ++n; -
670 }
executed: }
Execution Count:333744
333744
671 }
executed: }
Execution Count:343200
343200
672 return n;
executed: return n;
Execution Count:2235
2235
673} -
674 -
675inline int QXmlStreamReaderPrivate::fastScanSpace() -
676{ -
677 int n = 0; -
678 ushort c; -
679 while ((c = getChar())) {
evaluated: (c = getChar())
TRUEFALSE
yes
Evaluation Count:141198
yes
Evaluation Count:6683
6683-141198
680 switch (c) { -
681 case '\r': -
682 if ((c = filterCarriageReturn()) == 0)
evaluated: (c = filterCarriageReturn()) == 0
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:277
45-277
683 return n;
executed: return n;
Execution Count:45
45
684 -
685 case '\n':
code before this statement executed: case '\n':
Execution Count:277
277
686 ++lineNumber; -
687 lastLineStart = characterOffset + readBufferPos; -
688 -
689 case ' ':
code before this statement executed: case ' ':
Execution Count:343
343
690 case '\t': -
691 textBuffer += QChar(c); -
692 ++n; -
693 break;
executed: break;
Execution Count:13736
13736
694 default: -
695 putChar(c); -
696 return n;
executed: return n;
Execution Count:127417
127417
697 } -
698 }
executed: }
Execution Count:13736
13736
699 return n;
executed: return n;
Execution Count:6683
6683
700} -
701 -
702 -
703 -
704 -
705 -
706 -
707 -
708inline int QXmlStreamReaderPrivate::fastScanContentCharList() -
709{ -
710 int n = 0; -
711 uint c; -
712 while ((c = getChar())) {
evaluated: (c = getChar())
TRUEFALSE
yes
Evaluation Count:391680
yes
Evaluation Count:8000
8000-391680
713 switch (ushort(c)) { -
714 case 0xfffe: -
715 case 0xffff: -
716 case 0: -
717 putChar(c); -
718 return n;
executed: return n;
Execution Count:60
60
719 case ']': { -
720 isWhitespace = false; -
721 int pos = textBuffer.size(); -
722 textBuffer += QChar(ushort(c)); -
723 ++n; -
724 while ((c = getChar()) == ']') {
evaluated: (c = getChar()) == ']'
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:17
11-17
725 textBuffer += QChar(ushort(c)); -
726 ++n; -
727 }
executed: }
Execution Count:11
11
728 if (c == 0) {
evaluated: c == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:15
2-15
729 putString(textBuffer, pos); -
730 textBuffer.resize(pos); -
731 } else if (c == '>' && textBuffer.at(textBuffer.size()-2) == QLatin1Char(']')) {
executed: }
Execution Count:2
evaluated: c == '>'
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:6
evaluated: textBuffer.at(textBuffer.size()-2) == QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
1-9
732 raiseWellFormedError(QXmlStream::tr("Sequence ']]>' not allowed in content.")); -
733 } else {
executed: }
Execution Count:8
8
734 putChar(c); -
735 break;
executed: break;
Execution Count:7
7
736 } -
737 return n;
executed: return n;
Execution Count:10
10
738 } break;
dead code: break;
-
739 case '\r': -
740 if ((c = filterCarriageReturn()) == 0)
evaluated: (c = filterCarriageReturn()) == 0
TRUEFALSE
yes
Evaluation Count:127
yes
Evaluation Count:262
127-262
741 return n;
executed: return n;
Execution Count:127
127
742 -
743 case '\n':
code before this statement executed: case '\n':
Execution Count:262
262
744 ++lineNumber; -
745 lastLineStart = characterOffset + readBufferPos; -
746 -
747 case ' ':
code before this statement executed: case ' ':
Execution Count:347
347
748 case '\t': -
749 textBuffer += QChar(ushort(c)); -
750 ++n; -
751 break;
executed: break;
Execution Count:227056
227056
752 case '&': -
753 case '<': -
754 if (!(c & 0xff0000)) {
partially evaluated: !(c & 0xff0000)
TRUEFALSE
yes
Evaluation Count:137501
no
Evaluation Count:0
0-137501
755 putChar(c); -
756 return n;
executed: return n;
Execution Count:137501
137501
757 } -
758 -
759 default:
code before this statement never executed: default:
0
760 if (c < 0x20) {
evaluated: c < 0x20
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:26917
2-26917
761 putChar(c); -
762 return n;
executed: return n;
Execution Count:2
2
763 } -
764 isWhitespace = false; -
765 textBuffer += QChar(ushort(c)); -
766 ++n; -
767 }
executed: }
Execution Count:26917
26917
768 }
executed: }
Execution Count:253980
253980
769 return n;
executed: return n;
Execution Count:8000
8000
770} -
771 -
772inline int QXmlStreamReaderPrivate::fastScanName(int *prefix) -
773{ -
774 int n = 0; -
775 ushort c; -
776 while ((c = getChar())) {
evaluated: (c = getChar())
TRUEFALSE
yes
Evaluation Count:1726820
yes
Evaluation Count:9761
9761-1726820
777 switch (c) { -
778 case '\n': -
779 case ' ': -
780 case '\t': -
781 case '\r': -
782 case '&': -
783 case '#': -
784 case '\'': -
785 case '\"': -
786 case '<': -
787 case '>': -
788 case '[': -
789 case ']': -
790 case '=': -
791 case '%': -
792 case '/': -
793 case ';': -
794 case '?': -
795 case '!': -
796 case '^': -
797 case '|': -
798 case ',': -
799 case '(': -
800 case ')': -
801 case '+': -
802 case '*': -
803 putChar(c); -
804 if (prefix && *prefix == n+1) {
evaluated: prefix
TRUEFALSE
yes
Evaluation Count:252448
yes
Evaluation Count:2521
evaluated: *prefix == n+1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:252444
4-252448
805 *prefix = 0; -
806 putChar(':'); -
807 --n; -
808 }
executed: }
Execution Count:4
4
809 return n;
executed: return n;
Execution Count:254969
254969
810 case ':': -
811 if (prefix) {
evaluated: prefix
TRUEFALSE
yes
Evaluation Count:1114
yes
Evaluation Count:7
7-1114
812 if (*prefix == 0) {
evaluated: *prefix == 0
TRUEFALSE
yes
Evaluation Count:1112
yes
Evaluation Count:2
2-1112
813 *prefix = n+2; -
814 } else {
executed: }
Execution Count:1112
1112
815 putChar(c); -
816 return n;
executed: return n;
Execution Count:2
2
817 } -
818 } else { -
819 putChar(c); -
820 return n;
executed: return n;
Execution Count:7
7
821 } -
822 -
823 default:
code before this statement executed: default:
Execution Count:1112
1112
824 textBuffer += QChar(c); -
825 ++n; -
826 }
executed: }
Execution Count:1471842
1471842
827 }
executed: }
Execution Count:1471842
1471842
828 -
829 if (prefix)
evaluated: prefix
TRUEFALSE
yes
Evaluation Count:8770
yes
Evaluation Count:991
991-8770
830 *prefix = 0;
executed: *prefix = 0;
Execution Count:8770
8770
831 int pos = textBuffer.size() - n; -
832 putString(textBuffer, pos); -
833 textBuffer.resize(pos); -
834 return 0;
executed: return 0;
Execution Count:9761
9761
835} -
836 -
837enum NameChar { NameBeginning, NameNotBeginning, NotName }; -
838 -
839static const char Begi = static_cast<char>(NameBeginning); -
840static const char NtBg = static_cast<char>(NameNotBeginning); -
841static const char NotN = static_cast<char>(NotName); -
842 -
843static const char nameCharTable[128] = -
844{ -
845 -
846 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
847 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
848 -
849 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
850 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
851 -
852 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
853 NotN, NotN, NotN, NotN, NotN, NtBg, NtBg, NotN, -
854 -
855 NtBg, NtBg, NtBg, NtBg, NtBg, NtBg, NtBg, NtBg, -
856 NtBg, NtBg, Begi, NotN, NotN, NotN, NotN, NotN, -
857 -
858 NotN, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
859 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
860 -
861 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
862 Begi, Begi, Begi, NotN, NotN, NotN, NotN, Begi, -
863 -
864 NotN, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
865 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
866 -
867 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
868 Begi, Begi, Begi, NotN, NotN, NotN, NotN, NotN -
869}; -
870 -
871static inline NameChar fastDetermineNameChar(QChar ch) -
872{ -
873 ushort uc = ch.unicode(); -
874 if (!(uc & ~0x7f))
partially evaluated: !(uc & ~0x7f)
TRUEFALSE
yes
Evaluation Count:1139
no
Evaluation Count:0
0-1139
875 return static_cast<NameChar>(nameCharTable[uc]);
executed: return static_cast<NameChar>(nameCharTable[uc]);
Execution Count:1139
1139
876 -
877 QChar::Category cat = ch.category(); -
878 -
879 if ((cat >= QChar::Letter_Uppercase && cat <= QChar::Letter_Other)
never evaluated: cat >= QChar::Letter_Uppercase
never evaluated: cat <= QChar::Letter_Other
0
880 || cat == QChar::Number_Letter)
never evaluated: cat == QChar::Number_Letter
0
881 return NameBeginning;
never executed: return NameBeginning;
0
882 if ((cat >= QChar::Number_DecimalDigit && cat <= QChar::Number_Other)
never evaluated: cat >= QChar::Number_DecimalDigit
never evaluated: cat <= QChar::Number_Other
0
883 || (cat >= QChar::Mark_NonSpacing && cat <= QChar::Mark_Enclosing))
never evaluated: cat >= QChar::Mark_NonSpacing
never evaluated: cat <= QChar::Mark_Enclosing
0
884 return NameNotBeginning;
never executed: return NameNotBeginning;
0
885 return NotName;
never executed: return NotName;
0
886} -
887 -
888inline int QXmlStreamReaderPrivate::fastScanNMTOKEN() -
889{ -
890 int n = 0; -
891 uint c; -
892 while ((c = getChar())) {
evaluated: (c = getChar())
TRUEFALSE
yes
Evaluation Count:1139
yes
Evaluation Count:229
229-1139
893 if (fastDetermineNameChar(c) == NotName) {
evaluated: fastDetermineNameChar(c) == NotName
TRUEFALSE
yes
Evaluation Count:190
yes
Evaluation Count:949
190-949
894 putChar(c); -
895 return n;
executed: return n;
Execution Count:190
190
896 } else { -
897 ++n; -
898 textBuffer += QChar(c); -
899 }
executed: }
Execution Count:949
949
900 } -
901 -
902 int pos = textBuffer.size() - n; -
903 putString(textBuffer, pos); -
904 textBuffer.resize(pos); -
905 -
906 return n;
executed: return n;
Execution Count:229
229
907} -
908 -
909void QXmlStreamReaderPrivate::putString(const QString &s, int from) -
910{ -
911 putStack.reserve(s.size()); -
912 for (int i = s.size()-1; i >= from; --i)
evaluated: i >= from
TRUEFALSE
yes
Evaluation Count:205578
yes
Evaluation Count:18911
18911-205578
913 putStack.rawPush() = s.at(i).unicode();
executed: putStack.rawPush() = s.at(i).unicode();
Execution Count:205578
205578
914}
executed: }
Execution Count:18911
18911
915 -
916void QXmlStreamReaderPrivate::putStringLiteral(const QString &s) -
917{ -
918 putStack.reserve(s.size()); -
919 for (int i = s.size()-1; i >= 0; --i)
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:1106
yes
Evaluation Count:1093
1093-1106
920 putStack.rawPush() = ((LETTER << 16) | s.at(i).unicode());
executed: putStack.rawPush() = ((LETTER << 16) | s.at(i).unicode());
Execution Count:1106
1106
921}
executed: }
Execution Count:1093
1093
922 -
923void QXmlStreamReaderPrivate::putReplacement(const QString &s) -
924{ -
925 putStack.reserve(s.size()); -
926 for (int i = s.size()-1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:1077
yes
Evaluation Count:117
117-1077
927 ushort c = s.at(i).unicode(); -
928 if (c == '\n' || c == '\r')
evaluated: c == '\n'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1075
evaluated: c == '\r'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1073
2-1075
929 putStack.rawPush() = ((LETTER << 16) | c);
executed: putStack.rawPush() = ((LETTER << 16) | c);
Execution Count:4
4
930 else -
931 putStack.rawPush() = c;
executed: putStack.rawPush() = c;
Execution Count:1073
1073
932 } -
933}
executed: }
Execution Count:117
117
934void QXmlStreamReaderPrivate::putReplacementInAttributeValue(const QString &s) -
935{ -
936 putStack.reserve(s.size()); -
937 for (int i = s.size()-1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:990
yes
Evaluation Count:98
98-990
938 ushort c = s.at(i).unicode(); -
939 if (c == '&' || c == ';')
evaluated: c == '&'
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:941
evaluated: c == ';'
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:881
49-941
940 putStack.rawPush() = c;
executed: putStack.rawPush() = c;
Execution Count:109
109
941 else if (c == '\n' || c == '\r')
evaluated: c == '\n'
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:877
evaluated: c == '\r'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:875
2-877
942 putStack.rawPush() = ' ';
executed: putStack.rawPush() = ' ';
Execution Count:6
6
943 else -
944 putStack.rawPush() = ((LETTER << 16) | c);
executed: putStack.rawPush() = ((LETTER << 16) | c);
Execution Count:875
875
945 } -
946}
executed: }
Execution Count:98
98
947 -
948ushort QXmlStreamReaderPrivate::getChar_helper() -
949{ -
950 const int BUFFER_SIZE = 8192; -
951 characterOffset += readBufferPos; -
952 readBufferPos = 0; -
953 readBuffer.resize(0); -
954 -
955 if (decoder)
evaluated: decoder
TRUEFALSE
yes
Evaluation Count:114654
yes
Evaluation Count:5228
5228-114654
956 -
957 nbytesread = 0;
executed: nbytesread = 0;
Execution Count:114654
114654
958 if (device) {
evaluated: device
TRUEFALSE
yes
Evaluation Count:2257
yes
Evaluation Count:117625
2257-117625
959 rawReadBuffer.resize(BUFFER_SIZE); -
960 int nbytesreadOrMinus1 = device->read(rawReadBuffer.data() + nbytesread, BUFFER_SIZE - nbytesread); -
961 nbytesread += qMax(nbytesreadOrMinus1, 0); -
962 } else {
executed: }
Execution Count:2257
2257
963 if (nbytesread)
evaluated: nbytesread
TRUEFALSE
yes
Evaluation Count:780
yes
Evaluation Count:116845
780-116845
964 rawReadBuffer += dataBuffer;
executed: rawReadBuffer += dataBuffer;
Execution Count:780
780
965 else -
966 rawReadBuffer = dataBuffer;
executed: rawReadBuffer = dataBuffer;
Execution Count:116845
116845
967 nbytesread = rawReadBuffer.size(); -
968 dataBuffer.clear(); -
969 }
executed: }
Execution Count:117625
117625
970 if (!nbytesread) {
evaluated: !nbytesread
TRUEFALSE
yes
Evaluation Count:59602
yes
Evaluation Count:60280
59602-60280
971 atEnd = true; -
972 return 0;
executed: return 0;
Execution Count:59602
59602
973 } -
974 -
975 -
976 if (!decoder) {
evaluated: !decoder
TRUEFALSE
yes
Evaluation Count:3590
yes
Evaluation Count:56690
3590-56690
977 if (nbytesread < 4) {
evaluated: nbytesread < 4
TRUEFALSE
yes
Evaluation Count:780
yes
Evaluation Count:2810
780-2810
978 -
979 atEnd = true; -
980 return 0;
executed: return 0;
Execution Count:780
780
981 } -
982 int mib = 106; -
983 -
984 -
985 uchar ch1 = rawReadBuffer.at(0); -
986 uchar ch2 = rawReadBuffer.at(1); -
987 uchar ch3 = rawReadBuffer.at(2); -
988 uchar ch4 = rawReadBuffer.at(3); -
989 -
990 if ((ch1 == 0 && ch2 == 0 && ch3 == 0xfe && ch4 == 0xff) ||
evaluated: ch1 == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2809
partially evaluated: ch2 == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: ch3 == 0xfe
never evaluated: ch4 == 0xff
0-2809
991 (ch1 == 0xff && ch2 == 0xfe && ch3 == 0 && ch4 == 0))
evaluated: ch1 == 0xff
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:2770
partially evaluated: ch2 == 0xfe
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
partially evaluated: ch3 == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
never evaluated: ch4 == 0
0-2770
992 mib = 1017;
never executed: mib = 1017;
0
993 else if (ch1 == 0x3c && ch2 == 0x00 && ch3 == 0x00 && ch4 == 0x00)
evaluated: ch1 == 0x3c
TRUEFALSE
yes
Evaluation Count:2732
yes
Evaluation Count:78
partially evaluated: ch2 == 0x00
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2732
never evaluated: ch3 == 0x00
never evaluated: ch4 == 0x00
0-2732
994 mib = 1019;
never executed: mib = 1019;
0
995 else if (ch1 == 0x00 && ch2 == 0x00 && ch3 == 0x00 && ch4 == 0x3c)
evaluated: ch1 == 0x00
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2809
partially evaluated: ch2 == 0x00
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: ch3 == 0x00
never evaluated: ch4 == 0x3c
0-2809
996 mib = 1018;
never executed: mib = 1018;
0
997 else if ((ch1 == 0xfe && ch2 == 0xff) || (ch1 == 0xff && ch2 == 0xfe))
evaluated: ch1 == 0xfe
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2809
partially evaluated: ch2 == 0xff
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
evaluated: ch1 == 0xff
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:2769
partially evaluated: ch2 == 0xfe
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
0-2809
998 mib = 1015;
executed: mib = 1015;
Execution Count:41
41
999 else if (ch1 == 0x3c && ch2 == 0x00)
evaluated: ch1 == 0x3c
TRUEFALSE
yes
Evaluation Count:2732
yes
Evaluation Count:37
partially evaluated: ch2 == 0x00
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2732
0-2732
1000 mib = 1014;
never executed: mib = 1014;
0
1001 else if (ch1 == 0x00 && ch2 == 0x3c)
evaluated: ch1 == 0x00
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2768
partially evaluated: ch2 == 0x3c
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-2768
1002 mib = 1013;
executed: mib = 1013;
Execution Count:1
1
1003 codec = QTextCodec::codecForMib(mib); -
1004 qt_noop(); -
1005 decoder = codec->makeDecoder(); -
1006 }
executed: }
Execution Count:2810
2810
1007 -
1008 decoder->toUnicode(&readBuffer, rawReadBuffer.constData(), nbytesread); -
1009 -
1010 if(lockEncoding && decoder->hasFailure()) {
evaluated: lockEncoding
TRUEFALSE
yes
Evaluation Count:54038
yes
Evaluation Count:5462
partially evaluated: decoder->hasFailure()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:54038
0-54038
1011 raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); -
1012 readBuffer.clear(); -
1013 return 0;
never executed: return 0;
0
1014 } -
1015 -
1016 -
1017 -
1018 -
1019 readBuffer.reserve(1); -
1020 -
1021 if (readBufferPos < readBuffer.size()) {
evaluated: readBufferPos < readBuffer.size()
TRUEFALSE
yes
Evaluation Count:59257
yes
Evaluation Count:243
243-59257
1022 ushort c = readBuffer.at(readBufferPos++).unicode(); -
1023 return c;
executed: return c;
Execution Count:59257
59257
1024 } -
1025 -
1026 atEnd = true; -
1027 return 0;
executed: return 0;
Execution Count:243
243
1028} -
1029 -
1030QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix) -
1031{ -
1032 for (int j = namespaceDeclarations.size() - 1; j >= 0; --j) {
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:75420
yes
Evaluation Count:72129
72129-75420
1033 const NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.at(j); -
1034 if (namespaceDeclaration.prefix == prefix) {
evaluated: namespaceDeclaration.prefix == prefix
TRUEFALSE
yes
Evaluation Count:1851
yes
Evaluation Count:73569
1851-73569
1035 return namespaceDeclaration.namespaceUri;
executed: return namespaceDeclaration.namespaceUri;
Execution Count:1851
1851
1036 } -
1037 }
executed: }
Execution Count:73569
73569
1038 -
1039 -
1040 if (namespaceProcessing && !prefix.isEmpty())
partially evaluated: namespaceProcessing
TRUEFALSE
yes
Evaluation Count:72129
no
Evaluation Count:0
evaluated: !prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:72123
0-72129
1041 raiseWellFormedError(QXmlStream::tr("Namespace prefix '%1' not declared").arg(prefix.toString()));
executed: raiseWellFormedError(QXmlStream::tr("Namespace prefix '%1' not declared").arg(prefix.toString()));
Execution Count:6
6
1042 -
1043 -
1044 return QStringRef();
executed: return QStringRef();
Execution Count:72129
72129
1045} -
1046 -
1047 -
1048 -
1049 -
1050void QXmlStreamReaderPrivate::resolveTag() -
1051{ -
1052 int n = attributeStack.size(); -
1053 -
1054 if (namespaceProcessing) {
partially evaluated: namespaceProcessing
TRUEFALSE
yes
Evaluation Count:73241
no
Evaluation Count:0
0-73241
1055 for (int a = 0; a < dtdAttributes.size(); ++a) {
evaluated: a < dtdAttributes.size()
TRUEFALSE
yes
Evaluation Count:1672
yes
Evaluation Count:73241
1672-73241
1056 DtdAttribute &dtdAttribute = dtdAttributes[a]; -
1057 if (!dtdAttribute.isNamespaceAttribute
evaluated: !dtdAttribute.isNamespaceAttribute
TRUEFALSE
yes
Evaluation Count:1248
yes
Evaluation Count:424
424-1248
1058 || dtdAttribute.defaultValue.isNull()
evaluated: dtdAttribute.defaultValue.isNull()
TRUEFALSE
yes
Evaluation Count:91
yes
Evaluation Count:333
91-333
1059 || dtdAttribute.tagName != qualifiedName
evaluated: dtdAttribute.tagName != qualifiedName
TRUEFALSE
yes
Evaluation Count:329
yes
Evaluation Count:4
4-329
1060 || dtdAttribute.attributeQualifiedName.isNull())
partially evaluated: dtdAttribute.attributeQualifiedName.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1061 continue;
executed: continue;
Execution Count:1668
1668
1062 int i = 0; -
1063 while (i < n && symName(attributeStack[i].key) != dtdAttribute.attributeQualifiedName)
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
partially evaluated: symName(attributeStack[i].key) != dtdAttribute.attributeQualifiedName
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-4
1064 ++i;
executed: ++i;
Execution Count:3
3
1065 if (i != n)
partially evaluated: i != n
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1066 continue;
never executed: continue;
0
1067 if (dtdAttribute.attributePrefix.isEmpty() && dtdAttribute.attributeName == QLatin1String("xmlns")) {
evaluated: dtdAttribute.attributePrefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: dtdAttribute.attributeName == QLatin1String("xmlns")
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1068 NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); -
1069 namespaceDeclaration.prefix.clear(); -
1070 -
1071 const QStringRef ns(dtdAttribute.defaultValue); -
1072 if(ns == QLatin1String("http://www.w3.org/2000/xmlns/") ||
partially evaluated: ns == QLatin1String("http://www.w3.org/2000/xmlns/")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1073 ns == QLatin1String("http://www.w3.org/XML/1998/namespace"))
partially evaluated: ns == QLatin1String("http://www.w3.org/XML/1998/namespace")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1074 raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration."));
never executed: raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration."));
0
1075 else -
1076 namespaceDeclaration.namespaceUri = ns;
executed: namespaceDeclaration.namespaceUri = ns;
Execution Count:2
2
1077 } else if (dtdAttribute.attributePrefix == QLatin1String("xmlns")) {
partially evaluated: dtdAttribute.attributePrefix == QLatin1String("xmlns")
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1078 NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); -
1079 QStringRef namespacePrefix = dtdAttribute.attributeName; -
1080 QStringRef namespaceUri = dtdAttribute.defaultValue; -
1081 if (((namespacePrefix == QLatin1String("xml")) 0-2
1082 ^ (namespaceUri == QLatin1String("http://www.w3.org/XML/1998/namespace")))
partially evaluated: ((namespacePrefix == QLatin1String("xml")) ^ (namespaceUri == QLatin1String("http://www.w3.org/XML/1998/namespace")))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1083 || namespaceUri == QLatin1String("http://www.w3.org/2000/xmlns/")
partially evaluated: namespaceUri == QLatin1String("http://www.w3.org/2000/xmlns/")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1084 || namespaceUri.isEmpty()
partially evaluated: namespaceUri.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1085 || namespacePrefix == QLatin1String("xmlns"))
partially evaluated: namespacePrefix == QLatin1String("xmlns")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1086 raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration."));
never executed: raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration."));
0
1087 -
1088 namespaceDeclaration.prefix = namespacePrefix; -
1089 namespaceDeclaration.namespaceUri = namespaceUri; -
1090 }
executed: }
Execution Count:2
2
1091 } -
1092 }
executed: }
Execution Count:73241
73241
1093 -
1094 tagStack.top().namespaceDeclaration.namespaceUri = namespaceUri = namespaceForPrefix(prefix); -
1095 -
1096 attributes.resize(n); -
1097 -
1098 for (int i = 0; i < n; ++i) {
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:105034
yes
Evaluation Count:73241
73241-105034
1099 QXmlStreamAttribute &attribute = attributes[i]; -
1100 Attribute &attrib = attributeStack[i]; -
1101 QStringRef prefix(symPrefix(attrib.key)); -
1102 QStringRef name(symString(attrib.key)); -
1103 QStringRef qualifiedName(symName(attrib.key)); -
1104 QStringRef value(symString(attrib.value)); -
1105 -
1106 attribute.m_name = QXmlStreamStringRef(name); -
1107 attribute.m_qualifiedName = QXmlStreamStringRef(qualifiedName); -
1108 attribute.m_value = QXmlStreamStringRef(value); -
1109 -
1110 if (!prefix.isEmpty()) {
evaluated: !prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:739
yes
Evaluation Count:104295
739-104295
1111 QStringRef attributeNamespaceUri = namespaceForPrefix(prefix); -
1112 attribute.m_namespaceUri = QXmlStreamStringRef(attributeNamespaceUri); -
1113 }
executed: }
Execution Count:739
739
1114 -
1115 for (int j = 0; j < i; ++j) {
evaluated: j < i
TRUEFALSE
yes
Evaluation Count:97857
yes
Evaluation Count:105034
97857-105034
1116 if (attributes[j].name() == attribute.name()
evaluated: attributes[j].name() == attribute.name()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:97819
38-97819
1117 && attributes[j].namespaceUri() == attribute.namespaceUri()
evaluated: attributes[j].namespaceUri() == attribute.namespaceUri()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:22
16-22
1118 && (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName()))
partially evaluated: namespaceProcessing
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
never evaluated: attributes[j].qualifiedName() == attribute.qualifiedName()
0-16
1119 raiseWellFormedError(QXmlStream::tr("Attribute redefined."));
executed: raiseWellFormedError(QXmlStream::tr("Attribute redefined."));
Execution Count:16
16
1120 }
executed: }
Execution Count:97857
97857
1121 }
executed: }
Execution Count:105034
105034
1122 -
1123 for (int a = 0; a < dtdAttributes.size(); ++a) {
evaluated: a < dtdAttributes.size()
TRUEFALSE
yes
Evaluation Count:1672
yes
Evaluation Count:73241
1672-73241
1124 DtdAttribute &dtdAttribute = dtdAttributes[a]; -
1125 if (dtdAttribute.isNamespaceAttribute
evaluated: dtdAttribute.isNamespaceAttribute
TRUEFALSE
yes
Evaluation Count:424
yes
Evaluation Count:1248
424-1248
1126 || dtdAttribute.defaultValue.isNull()
evaluated: dtdAttribute.defaultValue.isNull()
TRUEFALSE
yes
Evaluation Count:1080
yes
Evaluation Count:168
168-1080
1127 || dtdAttribute.tagName != qualifiedName
evaluated: dtdAttribute.tagName != qualifiedName
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:93
75-93
1128 || dtdAttribute.attributeQualifiedName.isNull())
evaluated: dtdAttribute.attributeQualifiedName.isNull()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:91
2-91
1129 continue;
executed: continue;
Execution Count:1581
1581
1130 int i = 0; -
1131 while (i < n && symName(attributeStack[i].key) != dtdAttribute.attributeQualifiedName)
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:36
evaluated: symName(attributeStack[i].key) != dtdAttribute.attributeQualifiedName
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:55
36-117
1132 ++i;
executed: ++i;
Execution Count:62
62
1133 if (i != n)
evaluated: i != n
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:36
36-55
1134 continue;
executed: continue;
Execution Count:55
55
1135 -
1136 -
1137 -
1138 QXmlStreamAttribute attribute; -
1139 attribute.m_name = QXmlStreamStringRef(dtdAttribute.attributeName); -
1140 attribute.m_qualifiedName = QXmlStreamStringRef(dtdAttribute.attributeQualifiedName); -
1141 attribute.m_value = QXmlStreamStringRef(dtdAttribute.defaultValue); -
1142 -
1143 if (!dtdAttribute.attributePrefix.isEmpty()) {
partially evaluated: !dtdAttribute.attributePrefix.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36
0-36
1144 QStringRef attributeNamespaceUri = namespaceForPrefix(dtdAttribute.attributePrefix); -
1145 attribute.m_namespaceUri = QXmlStreamStringRef(attributeNamespaceUri); -
1146 }
never executed: }
0
1147 attribute.m_isDefault = true; -
1148 attributes.append(attribute); -
1149 }
executed: }
Execution Count:36
36
1150 -
1151 attributeStack.clear(); -
1152}
executed: }
Execution Count:73241
73241
1153 -
1154void QXmlStreamReaderPrivate::resolvePublicNamespaces() -
1155{ -
1156 const Tag &tag = tagStack.top(); -
1157 int n = namespaceDeclarations.size() - tag.namespaceDeclarationsSize; -
1158 publicNamespaceDeclarations.resize(n); -
1159 for (int i = 0; i < n; ++i) {
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:446
54-446
1160 const NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.at(tag.namespaceDeclarationsSize + i); -
1161 QXmlStreamNamespaceDeclaration &publicNamespaceDeclaration = publicNamespaceDeclarations[i]; -
1162 publicNamespaceDeclaration.m_prefix = QXmlStreamStringRef(namespaceDeclaration.prefix); -
1163 publicNamespaceDeclaration.m_namespaceUri = QXmlStreamStringRef(namespaceDeclaration.namespaceUri); -
1164 }
executed: }
Execution Count:54
54
1165}
executed: }
Execution Count:446
446
1166 -
1167void QXmlStreamReaderPrivate::resolveDtd() -
1168{ -
1169 publicNotationDeclarations.resize(notationDeclarations.size()); -
1170 for (int i = 0; i < notationDeclarations.size(); ++i) {
evaluated: i < notationDeclarations.size()
TRUEFALSE
yes
Evaluation Count:79
yes
Evaluation Count:52
52-79
1171 const QXmlStreamReaderPrivate::NotationDeclaration &notationDeclaration = notationDeclarations.at(i); -
1172 QXmlStreamNotationDeclaration &publicNotationDeclaration = publicNotationDeclarations[i]; -
1173 publicNotationDeclaration.m_name = QXmlStreamStringRef(notationDeclaration.name); -
1174 publicNotationDeclaration.m_systemId = QXmlStreamStringRef(notationDeclaration.systemId); -
1175 publicNotationDeclaration.m_publicId = QXmlStreamStringRef(notationDeclaration.publicId); -
1176 -
1177 }
executed: }
Execution Count:79
79
1178 notationDeclarations.clear(); -
1179 publicEntityDeclarations.resize(entityDeclarations.size()); -
1180 for (int i = 0; i < entityDeclarations.size(); ++i) {
evaluated: i < entityDeclarations.size()
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:52
44-52
1181 const QXmlStreamReaderPrivate::EntityDeclaration &entityDeclaration = entityDeclarations.at(i); -
1182 QXmlStreamEntityDeclaration &publicEntityDeclaration = publicEntityDeclarations[i]; -
1183 publicEntityDeclaration.m_name = QXmlStreamStringRef(entityDeclaration.name); -
1184 publicEntityDeclaration.m_notationName = QXmlStreamStringRef(entityDeclaration.notationName); -
1185 publicEntityDeclaration.m_systemId = QXmlStreamStringRef(entityDeclaration.systemId); -
1186 publicEntityDeclaration.m_publicId = QXmlStreamStringRef(entityDeclaration.publicId); -
1187 publicEntityDeclaration.m_value = QXmlStreamStringRef(entityDeclaration.value); -
1188 }
executed: }
Execution Count:44
44
1189 entityDeclarations.clear(); -
1190 parameterEntityHash.clear(); -
1191}
executed: }
Execution Count:52
52
1192 -
1193uint QXmlStreamReaderPrivate::resolveCharRef(int symbolIndex) -
1194{ -
1195 bool ok = true; -
1196 uint s; -
1197 -
1198 if (sym(symbolIndex).c == 'x')
evaluated: sym(symbolIndex).c == 'x'
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:138
98-138
1199 s = symString(symbolIndex, 1).toString().toUInt(&ok, 16);
executed: s = symString(symbolIndex, 1).toString().toUInt(&ok, 16);
Execution Count:98
98
1200 else -
1201 s = symString(symbolIndex).toString().toUInt(&ok, 10);
executed: s = symString(symbolIndex).toString().toUInt(&ok, 10);
Execution Count:138
138
1202 -
1203 ok &= (s == 0x9 || s == 0xa || s == 0xd || (s >= 0x20 && s <= 0xd7ff)
evaluated: s == 0x9
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:222
evaluated: s == 0xa
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:204
evaluated: s == 0xd
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:191
evaluated: s >= 0x20
TRUEFALSE
yes
Evaluation Count:178
yes
Evaluation Count:13
evaluated: s <= 0xd7ff
TRUEFALSE
yes
Evaluation Count:155
yes
Evaluation Count:23
13-222
1204 || (s >= 0xe000 && s <= 0xfffd) || (s >= 0x10000 && s <= QChar::LastValidCodePoint));
evaluated: s >= 0xe000
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:15
evaluated: s <= 0xfffd
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:17
evaluated: s >= 0x10000
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:18
evaluated: s <= QChar::LastValidCodePoint
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
1-21
1205 -
1206 return ok ? s : 0;
executed: return ok ? s : 0;
Execution Count:236
236
1207} -
1208 -
1209 -
1210void QXmlStreamReaderPrivate::checkPublicLiteral(const QStringRef &publicId) -
1211{ -
1212 -
1213 -
1214 const ushort *data = reinterpret_cast<const ushort *>(publicId.constData()); -
1215 uchar c = 0; -
1216 int i; -
1217 for (i = publicId.size() - 1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:7246
yes
Evaluation Count:172
172-7246
1218 if (data[i] < 256)
partially evaluated: data[i] < 256
TRUEFALSE
yes
Evaluation Count:7246
no
Evaluation Count:0
0-7246
1219 switch ((c = data[i])) { -
1220 case ' ': case '\n': case '\r': case '-': case '(': case ')': -
1221 case '+': case ',': case '.': case '/': case ':': case '=': -
1222 case '?': case ';': case '!': case '*': case '#': case '@': -
1223 case '$': case '_': case '%': case '\'': case '\"': -
1224 continue;
executed: continue;
Execution Count:1746
1746
1225 default: -
1226 if ((c >= 'a' && c <= 'z')
evaluated: c >= 'a'
TRUEFALSE
yes
Evaluation Count:3798
yes
Evaluation Count:1702
partially evaluated: c <= 'z'
TRUEFALSE
yes
Evaluation Count:3798
no
Evaluation Count:0
0-3798
1227 || (c >= 'A' && c <= 'Z')
evaluated: c >= 'A'
TRUEFALSE
yes
Evaluation Count:1429
yes
Evaluation Count:273
partially evaluated: c <= 'Z'
TRUEFALSE
yes
Evaluation Count:1429
no
Evaluation Count:0
0-1429
1228 || (c >= '0' && c <= '9'))
partially evaluated: c >= '0'
TRUEFALSE
yes
Evaluation Count:273
no
Evaluation Count:0
partially evaluated: c <= '9'
TRUEFALSE
yes
Evaluation Count:273
no
Evaluation Count:0
0-273
1229 continue;
executed: continue;
Execution Count:5500
5500
1230 }
never executed: }
0
1231 break;
never executed: break;
0
1232 } -
1233 if (i >= 0)
partially evaluated: i >= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:172
0-172
1234 raiseWellFormedError(QXmlStream::tr("Unexpected character '%1' in public id literal.").arg(QChar(QLatin1Char(c))));
never executed: raiseWellFormedError(QXmlStream::tr("Unexpected character '%1' in public id literal.").arg(QChar(QLatin1Char(c))));
0
1235}
executed: }
Execution Count:172
172
1236 -
1237 -
1238 -
1239 -
1240 -
1241 -
1242bool QXmlStreamReaderPrivate::checkStartDocument() -
1243{ -
1244 hasCheckedStartDocument = true; -
1245 -
1246 if (scanString(spell[XML], XML))
evaluated: scanString(spell[XML], XML)
TRUEFALSE
yes
Evaluation Count:1091
yes
Evaluation Count:4651
1091-4651
1247 return true;
executed: return true;
Execution Count:1091
1091
1248 -
1249 type = QXmlStreamReader::StartDocument; -
1250 if (atEnd) {
evaluated: atEnd
TRUEFALSE
yes
Evaluation Count:2683
yes
Evaluation Count:1968
1968-2683
1251 hasCheckedStartDocument = false; -
1252 raiseError(QXmlStreamReader::PrematureEndOfDocumentError); -
1253 }
executed: }
Execution Count:2683
2683
1254 return false;
executed: return false;
Execution Count:4651
4651
1255} -
1256 -
1257void QXmlStreamReaderPrivate::startDocument() -
1258{ -
1259 QString err; -
1260 if (documentVersion != QLatin1String("1.0")) {
evaluated: documentVersion != QLatin1String("1.0")
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1047
4-1047
1261 if (documentVersion.toString().contains(QLatin1Char(' ')))
evaluated: documentVersion.toString().contains(QLatin1Char(' '))
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
1262 err = QXmlStream::tr("Invalid XML version string.");
executed: err = QXmlStream::tr("Invalid XML version string.");
Execution Count:1
1
1263 else -
1264 err = QXmlStream::tr("Unsupported XML version.");
executed: err = QXmlStream::tr("Unsupported XML version.");
Execution Count:3
3
1265 } -
1266 int n = attributeStack.size(); -
1267 -
1268 -
1269 -
1270 -
1271 -
1272 bool hasStandalone = false; -
1273 -
1274 for (int i = 0; err.isNull() && i < n; ++i) {
evaluated: err.isNull()
TRUEFALSE
yes
Evaluation Count:1527
yes
Evaluation Count:31
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:507
yes
Evaluation Count:1020
31-1527
1275 Attribute &attrib = attributeStack[i]; -
1276 QStringRef prefix(symPrefix(attrib.key)); -
1277 QStringRef key(symString(attrib.key)); -
1278 QStringRef value(symString(attrib.value)); -
1279 -
1280 if (prefix.isEmpty() && key == QLatin1String("encoding")) {
partially evaluated: prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:507
no
Evaluation Count:0
evaluated: key == QLatin1String("encoding")
TRUEFALSE
yes
Evaluation Count:474
yes
Evaluation Count:33
0-507
1281 const QString name(value.toString()); -
1282 documentEncoding = value; -
1283 -
1284 if(hasStandalone)
evaluated: hasStandalone
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:473
1-473
1285 err = QXmlStream::tr("The standalone pseudo attribute must appear after the encoding.");
executed: err = QXmlStream::tr("The standalone pseudo attribute must appear after the encoding.");
Execution Count:1
1
1286 if(!QXmlUtils::isEncName(name))
evaluated: !QXmlUtils::isEncName(name)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:458
16-458
1287 err = QXmlStream::tr("%1 is an invalid encoding name.").arg(name);
executed: err = QXmlStream::tr("%1 is an invalid encoding name.").arg(name);
Execution Count:16
16
1288 else { -
1289 -
1290 -
1291 -
1292 QTextCodec *const newCodec = QTextCodec::codecForName(name.toLatin1()); -
1293 if (!newCodec)
partially evaluated: !newCodec
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:458
0-458
1294 err = QXmlStream::tr("Encoding %1 is unsupported").arg(name);
never executed: err = QXmlStream::tr("Encoding %1 is unsupported").arg(name);
0
1295 else if (newCodec != codec && !lockEncoding) {
evaluated: newCodec != codec
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:454
partially evaluated: !lockEncoding
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-454
1296 codec = newCodec; -
1297 delete decoder; -
1298 decoder = codec->makeDecoder(); -
1299 decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread); -
1300 }
executed: }
Execution Count:4
4
1301 -
1302 } -
1303 } else if (prefix.isEmpty() && key == QLatin1String("standalone")) {
partially evaluated: prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
evaluated: key == QLatin1String("standalone")
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:4
0-33
1304 hasStandalone = true; -
1305 if (value == QLatin1String("yes"))
evaluated: value == QLatin1String("yes")
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:8
8-21
1306 standalone = true;
executed: standalone = true;
Execution Count:21
21
1307 else if (value == QLatin1String("no"))
evaluated: value == QLatin1String("no")
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
1308 standalone = false;
executed: standalone = false;
Execution Count:2
2
1309 else -
1310 err = QXmlStream::tr("Standalone accepts only yes or no.");
executed: err = QXmlStream::tr("Standalone accepts only yes or no.");
Execution Count:6
6
1311 } else { -
1312 err = QXmlStream::tr("Invalid attribute in XML declaration."); -
1313 }
executed: }
Execution Count:4
4
1314 } -
1315 -
1316 if (!err.isNull())
evaluated: !err.isNull()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:1020
31-1020
1317 raiseWellFormedError(err);
executed: raiseWellFormedError(err);
Execution Count:31
31
1318 attributeStack.clear(); -
1319}
executed: }
Execution Count:1051
1051
1320 -
1321 -
1322void QXmlStreamReaderPrivate::raiseError(QXmlStreamReader::Error error, const QString& message) -
1323{ -
1324 this->error = error; -
1325 errorString = message; -
1326 if (errorString.isNull()) {
evaluated: errorString.isNull()
TRUEFALSE
yes
Evaluation Count:58733
yes
Evaluation Count:1204
1204-58733
1327 if (error == QXmlStreamReader::PrematureEndOfDocumentError)
partially evaluated: error == QXmlStreamReader::PrematureEndOfDocumentError
TRUEFALSE
yes
Evaluation Count:58733
no
Evaluation Count:0
0-58733
1328 errorString = QXmlStream::tr("Premature end of document.");
executed: errorString = QXmlStream::tr("Premature end of document.");
Execution Count:58733
58733
1329 else if (error == QXmlStreamReader::CustomError)
never evaluated: error == QXmlStreamReader::CustomError
0
1330 errorString = QXmlStream::tr("Invalid document.");
never executed: errorString = QXmlStream::tr("Invalid document.");
0
1331 } -
1332 -
1333 type = QXmlStreamReader::Invalid; -
1334}
executed: }
Execution Count:59937
59937
1335 -
1336void QXmlStreamReaderPrivate::raiseWellFormedError(const QString &message) -
1337{ -
1338 raiseError(QXmlStreamReader::NotWellFormedError, message); -
1339}
executed: }
Execution Count:1166
1166
1340 -
1341void QXmlStreamReaderPrivate::parseError() -
1342{ -
1343 -
1344 if (token == EOF_SYMBOL) {
evaluated: token == EOF_SYMBOL
TRUEFALSE
yes
Evaluation Count:6306
yes
Evaluation Count:592
592-6306
1345 raiseError(QXmlStreamReader::PrematureEndOfDocumentError); -
1346 return;
executed: return;
Execution Count:6306
6306
1347 } -
1348 const int nmax = 4; -
1349 QString error_message; -
1350 int ers = state_stack[tos]; -
1351 int nexpected = 0; -
1352 int expected[nmax]; -
1353 if (token != ERROR)
evaluated: token != ERROR
TRUEFALSE
yes
Evaluation Count:590
yes
Evaluation Count:2
2-590
1354 for (int tk = 0; tk < TERMINAL_COUNT; ++tk) {
evaluated: tk < TERMINAL_COUNT
TRUEFALSE
yes
Evaluation Count:33630
yes
Evaluation Count:590
590-33630
1355 int k = t_action(ers, tk); -
1356 if (k <= 0)
evaluated: k <= 0
TRUEFALSE
yes
Evaluation Count:30589
yes
Evaluation Count:3041
3041-30589
1357 continue;
executed: continue;
Execution Count:30589
30589
1358 if (spell[tk]) {
evaluated: spell[tk]
TRUEFALSE
yes
Evaluation Count:2960
yes
Evaluation Count:81
81-2960
1359 if (nexpected < nmax)
evaluated: nexpected < nmax
TRUEFALSE
yes
Evaluation Count:1344
yes
Evaluation Count:1616
1344-1616
1360 expected[nexpected++] = tk;
executed: expected[nexpected++] = tk;
Execution Count:1344
1344
1361 }
executed: }
Execution Count:2960
2960
1362 }
executed: }
Execution Count:3041
3041
1363 -
1364 error_message.clear (); -
1365 if (nexpected && nexpected < nmax) {
evaluated: nexpected
TRUEFALSE
yes
Evaluation Count:590
yes
Evaluation Count:2
evaluated: nexpected < nmax
TRUEFALSE
yes
Evaluation Count:442
yes
Evaluation Count:148
2-590
1366 bool first = true; -
1367 -
1368 for (int s = 0; s < nexpected; ++s) {
evaluated: s < nexpected
TRUEFALSE
yes
Evaluation Count:752
yes
Evaluation Count:442
442-752
1369 if (first)
evaluated: first
TRUEFALSE
yes
Evaluation Count:442
yes
Evaluation Count:310
310-442
1370 error_message += QXmlStream::tr ("Expected ");
executed: error_message += QXmlStream::tr ("Expected ");
Execution Count:442
442
1371 else if (s == nexpected - 1)
evaluated: s == nexpected - 1
TRUEFALSE
yes
Evaluation Count:221
yes
Evaluation Count:89
89-221
1372 error_message += QLatin1String (nexpected > 2 ? ", or " : " or ");
executed: error_message += QLatin1String (nexpected > 2 ? ", or " : " or ");
Execution Count:221
221
1373 else -
1374 error_message += QLatin1String (", ");
executed: error_message += QLatin1String (", ");
Execution Count:89
89
1375 -
1376 first = false; -
1377 error_message += QLatin1String("\'"); -
1378 error_message += QLatin1String (spell [expected[s]]); -
1379 error_message += QLatin1String("\'"); -
1380 }
executed: }
Execution Count:752
752
1381 error_message += QXmlStream::tr(", but got \'"); -
1382 error_message += QLatin1String(spell [token]); -
1383 error_message += QLatin1String("\'"); -
1384 } else {
executed: }
Execution Count:442
442
1385 error_message += QXmlStream::tr("Unexpected \'"); -
1386 error_message += QLatin1String(spell [token]); -
1387 error_message += QLatin1String("\'"); -
1388 }
executed: }
Execution Count:150
150
1389 error_message += QLatin1Char('.'); -
1390 -
1391 raiseWellFormedError(error_message); -
1392}
executed: }
Execution Count:592
592
1393 -
1394void QXmlStreamReaderPrivate::resume(int rule) { -
1395 resumeReduction = rule; -
1396 if (error == QXmlStreamReader::NoError)
evaluated: error == QXmlStreamReader::NoError
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:44562
27-44562
1397 raiseError(QXmlStreamReader::PrematureEndOfDocumentError);
executed: raiseError(QXmlStreamReader::PrematureEndOfDocumentError);
Execution Count:27
27
1398}
executed: }
Execution Count:44589
44589
1399 -
1400 -
1401 -
1402 -
1403 -
1404qint64 QXmlStreamReader::lineNumber() const -
1405{ -
1406 const QXmlStreamReaderPrivate * const d = d_func(); -
1407 return d->lineNumber + 1;
executed: return d->lineNumber + 1;
Execution Count:551
551
1408} -
1409 -
1410 -
1411 -
1412 -
1413 -
1414qint64 QXmlStreamReader::columnNumber() const -
1415{ -
1416 const QXmlStreamReaderPrivate * const d = d_func(); -
1417 return d->characterOffset - d->lastLineStart + d->readBufferPos;
executed: return d->characterOffset - d->lastLineStart + d->readBufferPos;
Execution Count:551
551
1418} -
1419 -
1420 -
1421 -
1422 -
1423 -
1424qint64 QXmlStreamReader::characterOffset() const -
1425{ -
1426 const QXmlStreamReaderPrivate * const d = d_func(); -
1427 return d->characterOffset + d->readBufferPos;
never executed: return d->characterOffset + d->readBufferPos;
0
1428} -
1429 -
1430 -
1431 -
1432 -
1433 -
1434QStringRef QXmlStreamReader::text() const -
1435{ -
1436 const QXmlStreamReaderPrivate * const d = d_func(); -
1437 return d->text;
executed: return d->text;
Execution Count:3544
3544
1438} -
1439QXmlStreamNotationDeclarations QXmlStreamReader::notationDeclarations() const -
1440{ -
1441 const QXmlStreamReaderPrivate * const d = d_func(); -
1442 if (d->notationDeclarations.size())
evaluated: d->notationDeclarations.size()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:2533
47-2533
1443 const_cast<QXmlStreamReaderPrivate *>(d)->resolveDtd();
executed: const_cast<QXmlStreamReaderPrivate *>(d)->resolveDtd();
Execution Count:47
47
1444 return d->publicNotationDeclarations;
executed: return d->publicNotationDeclarations;
Execution Count:2580
2580
1445} -
1446QXmlStreamEntityDeclarations QXmlStreamReader::entityDeclarations() const -
1447{ -
1448 const QXmlStreamReaderPrivate * const d = d_func(); -
1449 if (d->entityDeclarations.size())
evaluated: d->entityDeclarations.size()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1891
5-1891
1450 const_cast<QXmlStreamReaderPrivate *>(d)->resolveDtd();
executed: const_cast<QXmlStreamReaderPrivate *>(d)->resolveDtd();
Execution Count:5
5
1451 return d->publicEntityDeclarations;
executed: return d->publicEntityDeclarations;
Execution Count:1896
1896
1452} -
1453QStringRef QXmlStreamReader::dtdName() const -
1454{ -
1455 const QXmlStreamReaderPrivate * const d = d_func(); -
1456 if (d->type == QXmlStreamReader::DTD)
evaluated: d->type == QXmlStreamReader::DTD
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:1866
50-1866
1457 return d->dtdName;
executed: return d->dtdName;
Execution Count:50
50
1458 return QStringRef();
executed: return QStringRef();
Execution Count:1866
1866
1459} -
1460QStringRef QXmlStreamReader::dtdPublicId() const -
1461{ -
1462 const QXmlStreamReaderPrivate * const d = d_func(); -
1463 if (d->type == QXmlStreamReader::DTD)
evaluated: d->type == QXmlStreamReader::DTD
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1866
27-1866
1464 return d->dtdPublicId;
executed: return d->dtdPublicId;
Execution Count:27
27
1465 return QStringRef();
executed: return QStringRef();
Execution Count:1866
1866
1466} -
1467QStringRef QXmlStreamReader::dtdSystemId() const -
1468{ -
1469 const QXmlStreamReaderPrivate * const d = d_func(); -
1470 if (d->type == QXmlStreamReader::DTD)
evaluated: d->type == QXmlStreamReader::DTD
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1866
27-1866
1471 return d->dtdSystemId;
executed: return d->dtdSystemId;
Execution Count:27
27
1472 return QStringRef();
executed: return QStringRef();
Execution Count:1866
1866
1473} -
1474QXmlStreamNamespaceDeclarations QXmlStreamReader::namespaceDeclarations() const -
1475{ -
1476 const QXmlStreamReaderPrivate * const d = d_func(); -
1477 if (d->publicNamespaceDeclarations.isEmpty() && d->type == StartElement)
evaluated: d->publicNamespaceDeclarations.isEmpty()
TRUEFALSE
yes
Evaluation Count:1895
yes
Evaluation Count:38
evaluated: d->type == StartElement
TRUEFALSE
yes
Evaluation Count:446
yes
Evaluation Count:1449
38-1895
1478 const_cast<QXmlStreamReaderPrivate *>(d)->resolvePublicNamespaces();
executed: const_cast<QXmlStreamReaderPrivate *>(d)->resolvePublicNamespaces();
Execution Count:446
446
1479 return d->publicNamespaceDeclarations;
executed: return d->publicNamespaceDeclarations;
Execution Count:1933
1933
1480} -
1481void QXmlStreamReader::addExtraNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &extraNamespaceDeclaration) -
1482{ -
1483 QXmlStreamReaderPrivate * const d = d_func(); -
1484 QXmlStreamReaderPrivate::NamespaceDeclaration &namespaceDeclaration = d->namespaceDeclarations.push(); -
1485 namespaceDeclaration.prefix = d->addToStringStorage(extraNamespaceDeclaration.prefix()); -
1486 namespaceDeclaration.namespaceUri = d->addToStringStorage(extraNamespaceDeclaration.namespaceUri()); -
1487}
executed: }
Execution Count:2
2
1488void QXmlStreamReader::addExtraNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &extraNamespaceDeclarations) -
1489{ -
1490 for (int i = 0; i < extraNamespaceDeclarations.size(); ++i)
never evaluated: i < extraNamespaceDeclarations.size()
0
1491 addExtraNamespaceDeclaration(extraNamespaceDeclarations.at(i));
never executed: addExtraNamespaceDeclaration(extraNamespaceDeclarations.at(i));
0
1492}
never executed: }
0
1493QString QXmlStreamReader::readElementText(ReadElementTextBehaviour behaviour) -
1494{ -
1495 QXmlStreamReaderPrivate * const d = d_func(); -
1496 if (isStartElement()) {
partially evaluated: isStartElement()
TRUEFALSE
yes
Evaluation Count:663
no
Evaluation Count:0
0-663
1497 QString result; -
1498 for(;;) { -
1499 switch (readNext()) { -
1500 case Characters: -
1501 case EntityReference: -
1502 result.insert(result.size(), d->text.unicode(), d->text.size()); -
1503 break;
executed: break;
Execution Count:666
666
1504 case EndElement: -
1505 return result;
executed: return result;
Execution Count:658
658
1506 case ProcessingInstruction: -
1507 case Comment: -
1508 break;
executed: break;
Execution Count:2
2
1509 case StartElement: -
1510 if (behaviour == SkipChildElements) {
evaluated: behaviour == SkipChildElements
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
2-4
1511 skipCurrentElement(); -
1512 break;
executed: break;
Execution Count:2
2
1513 } else if (behaviour == IncludeChildElements) {
evaluated: behaviour == IncludeChildElements
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
1514 result += readElementText(behaviour); -
1515 break;
executed: break;
Execution Count:2
2
1516 } -
1517 -
1518 default:
code before this statement executed: default:
Execution Count:2
2
1519 if (d->error || behaviour == ErrorOnUnexpectedElement) {
evaluated: d->error
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
partially evaluated: behaviour == ErrorOnUnexpectedElement
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-3
1520 if (!d->error)
evaluated: !d->error
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
1521 d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data."));
executed: d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data."));
Execution Count:2
2
1522 return result;
executed: return result;
Execution Count:5
5
1523 } -
1524 }
never executed: }
0
1525 }
executed: }
Execution Count:672
672
1526 }
never executed: }
0
1527 return QString();
never executed: return QString();
0
1528} -
1529 -
1530 -
1531 -
1532 -
1533 -
1534void QXmlStreamReader::raiseError(const QString& message) -
1535{ -
1536 QXmlStreamReaderPrivate * const d = d_func(); -
1537 d->raiseError(CustomError, message); -
1538}
never executed: }
0
1539 -
1540 -
1541 -
1542 -
1543 -
1544 -
1545QString QXmlStreamReader::errorString() const -
1546{ -
1547 const QXmlStreamReaderPrivate * const d = d_func(); -
1548 if (d->type == QXmlStreamReader::Invalid)
evaluated: d->type == QXmlStreamReader::Invalid
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:553
30-553
1549 return d->errorString;
executed: return d->errorString;
Execution Count:30
30
1550 return QString();
executed: return QString();
Execution Count:553
553
1551} -
1552 -
1553 -
1554 -
1555 -
1556 -
1557QXmlStreamReader::Error QXmlStreamReader::error() const -
1558{ -
1559 const QXmlStreamReaderPrivate * const d = d_func(); -
1560 if (d->type == QXmlStreamReader::Invalid)
evaluated: d->type == QXmlStreamReader::Invalid
TRUEFALSE
yes
Evaluation Count:59915
yes
Evaluation Count:2743
2743-59915
1561 return d->error;
executed: return d->error;
Execution Count:59915
59915
1562 return NoError;
executed: return NoError;
Execution Count:2743
2743
1563} -
1564 -
1565 -
1566 -
1567 -
1568QStringRef QXmlStreamReader::processingInstructionTarget() const -
1569{ -
1570 const QXmlStreamReaderPrivate * const d = d_func(); -
1571 return d->processingInstructionTarget;
executed: return d->processingInstructionTarget;
Execution Count:1975
1975
1572} -
1573 -
1574 -
1575 -
1576 -
1577QStringRef QXmlStreamReader::processingInstructionData() const -
1578{ -
1579 const QXmlStreamReaderPrivate * const d = d_func(); -
1580 return d->processingInstructionData;
executed: return d->processingInstructionData;
Execution Count:2012
2012
1581} -
1582QStringRef QXmlStreamReader::name() const -
1583{ -
1584 const QXmlStreamReaderPrivate * const d = d_func(); -
1585 return d->name;
executed: return d->name;
Execution Count:13063
13063
1586} -
1587 -
1588 -
1589 -
1590 -
1591 -
1592 -
1593QStringRef QXmlStreamReader::namespaceUri() const -
1594{ -
1595 const QXmlStreamReaderPrivate * const d = d_func(); -
1596 return d->namespaceUri;
executed: return d->namespaceUri;
Execution Count:3742
3742
1597} -
1598QStringRef QXmlStreamReader::qualifiedName() const -
1599{ -
1600 const QXmlStreamReaderPrivate * const d = d_func(); -
1601 return d->qualifiedName;
executed: return d->qualifiedName;
Execution Count:3043
3043
1602} -
1603QStringRef QXmlStreamReader::prefix() const -
1604{ -
1605 const QXmlStreamReaderPrivate * const d = d_func(); -
1606 return d->prefix;
executed: return d->prefix;
Execution Count:1931
1931
1607} -
1608 -
1609 -
1610 -
1611 -
1612QXmlStreamAttributes QXmlStreamReader::attributes() const -
1613{ -
1614 const QXmlStreamReaderPrivate * const d = d_func(); -
1615 return d->attributes;
executed: return d->attributes;
Execution Count:8594
8594
1616} -
1617QXmlStreamAttribute::QXmlStreamAttribute() -
1618{ -
1619 m_isDefault = false; -
1620}
executed: }
Execution Count:105070
105070
1621 -
1622 -
1623 -
1624 -
1625QXmlStreamAttribute::~QXmlStreamAttribute() -
1626{ -
1627} -
1628 -
1629 -
1630 -
1631 -
1632QXmlStreamAttribute::QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value) -
1633{ -
1634 m_namespaceUri = QXmlStreamStringRef(QStringRef(&namespaceUri)); -
1635 m_name = m_qualifiedName = QXmlStreamStringRef(QStringRef(&name)); -
1636 m_value = QXmlStreamStringRef(QStringRef(&value)); -
1637 m_namespaceUri = QXmlStreamStringRef(QStringRef(&namespaceUri)); -
1638}
never executed: }
0
1639 -
1640 -
1641 -
1642 -
1643QXmlStreamAttribute::QXmlStreamAttribute(const QString &qualifiedName, const QString &value) -
1644{ -
1645 int colon = qualifiedName.indexOf(QLatin1Char(':')); -
1646 m_name = QXmlStreamStringRef(QStringRef(&qualifiedName, -
1647 colon + 1, -
1648 qualifiedName.size() - (colon + 1))); -
1649 m_qualifiedName = QXmlStreamStringRef(QStringRef(&qualifiedName)); -
1650 m_value = QXmlStreamStringRef(QStringRef(&value)); -
1651}
never executed: }
0
1652QXmlStreamAttribute::QXmlStreamAttribute(const QXmlStreamAttribute &other) -
1653{ -
1654 *this = other; -
1655}
executed: }
Execution Count:2579
2579
1656 -
1657 -
1658 -
1659 -
1660QXmlStreamAttribute& QXmlStreamAttribute::operator=(const QXmlStreamAttribute &other) -
1661{ -
1662 m_name = other.m_name; -
1663 m_namespaceUri = other.m_namespaceUri; -
1664 m_qualifiedName = other.m_qualifiedName; -
1665 m_value = other.m_value; -
1666 m_isDefault = other.m_isDefault; -
1667 return *this;
executed: return *this;
Execution Count:2588
2588
1668} -
1669QXmlStreamNotationDeclaration::QXmlStreamNotationDeclaration() -
1670{ -
1671} -
1672 -
1673 -
1674 -
1675QXmlStreamNotationDeclaration::QXmlStreamNotationDeclaration(const QXmlStreamNotationDeclaration &other) -
1676{ -
1677 *this = other; -
1678}
executed: }
Execution Count:304
304
1679 -
1680 -
1681 -
1682 -
1683QXmlStreamNotationDeclaration& QXmlStreamNotationDeclaration::operator=(const QXmlStreamNotationDeclaration &other) -
1684{ -
1685 m_name = other.m_name; -
1686 m_systemId = other.m_systemId; -
1687 m_publicId = other.m_publicId; -
1688 return *this;
executed: return *this;
Execution Count:304
304
1689} -
1690 -
1691 -
1692 -
1693 -
1694QXmlStreamNotationDeclaration::~QXmlStreamNotationDeclaration() -
1695{ -
1696} -
1697QXmlStreamNamespaceDeclaration::QXmlStreamNamespaceDeclaration() -
1698{ -
1699} -
1700 -
1701 -
1702 -
1703 -
1704 -
1705 -
1706QXmlStreamNamespaceDeclaration::QXmlStreamNamespaceDeclaration(const QString &prefix, const QString &namespaceUri) -
1707{ -
1708 m_prefix = prefix; -
1709 m_namespaceUri = namespaceUri; -
1710}
executed: }
Execution Count:2
2
1711 -
1712 -
1713 -
1714 -
1715QXmlStreamNamespaceDeclaration::QXmlStreamNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &other) -
1716{ -
1717 *this = other; -
1718}
executed: }
Execution Count:54
54
1719 -
1720 -
1721 -
1722 -
1723QXmlStreamNamespaceDeclaration& QXmlStreamNamespaceDeclaration::operator=(const QXmlStreamNamespaceDeclaration &other) -
1724{ -
1725 m_prefix = other.m_prefix; -
1726 m_namespaceUri = other.m_namespaceUri; -
1727 return *this;
executed: return *this;
Execution Count:54
54
1728} -
1729 -
1730 -
1731 -
1732QXmlStreamNamespaceDeclaration::~QXmlStreamNamespaceDeclaration() -
1733{ -
1734} -
1735QXmlStreamEntityDeclaration::QXmlStreamEntityDeclaration() -
1736{ -
1737} -
1738 -
1739 -
1740 -
1741 -
1742QXmlStreamEntityDeclaration::QXmlStreamEntityDeclaration(const QXmlStreamEntityDeclaration &other) -
1743{ -
1744 *this = other; -
1745}
executed: }
Execution Count:10
10
1746 -
1747 -
1748 -
1749 -
1750QXmlStreamEntityDeclaration& QXmlStreamEntityDeclaration::operator=(const QXmlStreamEntityDeclaration &other) -
1751{ -
1752 m_name = other.m_name; -
1753 m_notationName = other.m_notationName; -
1754 m_systemId = other.m_systemId; -
1755 m_publicId = other.m_publicId; -
1756 m_value = other.m_value; -
1757 return *this;
executed: return *this;
Execution Count:10
10
1758} -
1759 -
1760 -
1761 -
1762 -
1763QXmlStreamEntityDeclaration::~QXmlStreamEntityDeclaration() -
1764{ -
1765} -
1766QStringRef QXmlStreamAttributes::value(const QString &namespaceUri, const QString &name) const -
1767{ -
1768 for (int i = 0; i < size(); ++i) {
evaluated: i < size()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:6
6-28
1769 const QXmlStreamAttribute &attribute = at(i); -
1770 if (attribute.name() == name && attribute.namespaceUri() == namespaceUri)
evaluated: attribute.name() == name
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:21
evaluated: attribute.namespaceUri() == namespaceUri
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-21
1771 return attribute.value();
executed: return attribute.value();
Execution Count:5
5
1772 }
executed: }
Execution Count:23
23
1773 return QStringRef();
executed: return QStringRef();
Execution Count:6
6
1774} -
1775 -
1776 -
1777 -
1778 -
1779 -
1780 -
1781QStringRef QXmlStreamAttributes::value(const QString &namespaceUri, QLatin1String name) const -
1782{ -
1783 for (int i = 0; i < size(); ++i) {
never evaluated: i < size()
0
1784 const QXmlStreamAttribute &attribute = at(i); -
1785 if (attribute.name() == name && attribute.namespaceUri() == namespaceUri)
never evaluated: attribute.name() == name
never evaluated: attribute.namespaceUri() == namespaceUri
0
1786 return attribute.value();
never executed: return attribute.value();
0
1787 }
never executed: }
0
1788 return QStringRef();
never executed: return QStringRef();
0
1789} -
1790 -
1791 -
1792 -
1793 -
1794 -
1795 -
1796QStringRef QXmlStreamAttributes::value(QLatin1String namespaceUri, QLatin1String name) const -
1797{ -
1798 for (int i = 0; i < size(); ++i) {
never evaluated: i < size()
0
1799 const QXmlStreamAttribute &attribute = at(i); -
1800 if (attribute.name() == name && attribute.namespaceUri() == namespaceUri)
never evaluated: attribute.name() == name
never evaluated: attribute.namespaceUri() == namespaceUri
0
1801 return attribute.value();
never executed: return attribute.value();
0
1802 }
never executed: }
0
1803 return QStringRef();
never executed: return QStringRef();
0
1804} -
1805QStringRef QXmlStreamAttributes::value(const QString &qualifiedName) const -
1806{ -
1807 for (int i = 0; i < size(); ++i) {
evaluated: i < size()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:3
3-19
1808 const QXmlStreamAttribute &attribute = at(i); -
1809 if (attribute.qualifiedName() == qualifiedName)
evaluated: attribute.qualifiedName() == qualifiedName
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:14
5-14
1810 return attribute.value();
executed: return attribute.value();
Execution Count:5
5
1811 }
executed: }
Execution Count:14
14
1812 return QStringRef();
executed: return QStringRef();
Execution Count:3
3
1813} -
1814QStringRef QXmlStreamAttributes::value(QLatin1String qualifiedName) const -
1815{ -
1816 for (int i = 0; i < size(); ++i) {
evaluated: i < size()
TRUEFALSE
yes
Evaluation Count:29257
yes
Evaluation Count:857
857-29257
1817 const QXmlStreamAttribute &attribute = at(i); -
1818 if (attribute.qualifiedName() == qualifiedName)
evaluated: attribute.qualifiedName() == qualifiedName
TRUEFALSE
yes
Evaluation Count:14123
yes
Evaluation Count:15134
14123-15134
1819 return attribute.value();
executed: return attribute.value();
Execution Count:14123
14123
1820 }
executed: }
Execution Count:15134
15134
1821 return QStringRef();
executed: return QStringRef();
Execution Count:857
857
1822} -
1823 -
1824 -
1825 -
1826 -
1827 -
1828void QXmlStreamAttributes::append(const QString &namespaceUri, const QString &name, const QString &value) -
1829{ -
1830 append(QXmlStreamAttribute(namespaceUri, name, value)); -
1831}
never executed: }
0
1832 -
1833 -
1834 -
1835 -
1836 -
1837void QXmlStreamAttributes::append(const QString &qualifiedName, const QString &value) -
1838{ -
1839 append(QXmlStreamAttribute(qualifiedName, value)); -
1840}
never executed: }
0
1841bool QXmlStreamReader::isWhitespace() const -
1842{ -
1843 const QXmlStreamReaderPrivate * const d = d_func(); -
1844 return d->type == QXmlStreamReader::Characters && d->isWhitespace;
executed: return d->type == QXmlStreamReader::Characters && d->isWhitespace;
Execution Count:1891
1891
1845} -
1846 -
1847 -
1848 -
1849 -
1850 -
1851 -
1852bool QXmlStreamReader::isCDATA() const -
1853{ -
1854 const QXmlStreamReaderPrivate * const d = d_func(); -
1855 return d->type == QXmlStreamReader::Characters && d->isCDATA;
executed: return d->type == QXmlStreamReader::Characters && d->isCDATA;
Execution Count:1891
1891
1856} -
1857bool QXmlStreamReader::isStandaloneDocument() const -
1858{ -
1859 const QXmlStreamReaderPrivate * const d = d_func(); -
1860 return d->standalone;
executed: return d->standalone;
Execution Count:74
74
1861} -
1862QStringRef QXmlStreamReader::documentVersion() const -
1863{ -
1864 const QXmlStreamReaderPrivate * const d = d_func(); -
1865 if (d->type == QXmlStreamReader::StartDocument)
evaluated: d->type == QXmlStreamReader::StartDocument
TRUEFALSE
yes
Evaluation Count:129
yes
Evaluation Count:1817
129-1817
1866 return d->documentVersion;
executed: return d->documentVersion;
Execution Count:129
129
1867 return QStringRef();
executed: return QStringRef();
Execution Count:1817
1817
1868} -
1869QStringRef QXmlStreamReader::documentEncoding() const -
1870{ -
1871 const QXmlStreamReaderPrivate * const d = d_func(); -
1872 if (d->type == QXmlStreamReader::StartDocument)
evaluated: d->type == QXmlStreamReader::StartDocument
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:1817
80-1817
1873 return d->documentEncoding;
executed: return d->documentEncoding;
Execution Count:80
80
1874 return QStringRef();
executed: return QStringRef();
Execution Count:1817
1817
1875} -
1876class QXmlStreamWriterPrivate : public QXmlStreamPrivateTagStack { -
1877 QXmlStreamWriter *q_ptr; -
1878 inline QXmlStreamWriter* q_func() { return static_cast<QXmlStreamWriter *>(q_ptr); } inline const QXmlStreamWriter* q_func() const { return static_cast<const QXmlStreamWriter *>(q_ptr); } friend class QXmlStreamWriter; -
1879public: -
1880 QXmlStreamWriterPrivate(QXmlStreamWriter *q); -
1881 ~QXmlStreamWriterPrivate() { -
1882 if (deleteDevice)
evaluated: deleteDevice
TRUEFALSE
yes
Evaluation Count:710
yes
Evaluation Count:21
21-710
1883 delete device;
executed: delete device;
Execution Count:710
710
1884 -
1885 delete encoder; -
1886 -
1887 }
executed: }
Execution Count:731
731
1888 -
1889 void write(const QStringRef &); -
1890 void write(const QString &); -
1891 void writeEscaped(const QString &, bool escapeWhitespace = false); -
1892 void write(const char *s, int len); -
1893 template <int N> void write(const char (&s)[N]) { write(s, N - 1); }
executed: }
Execution Count:8713
8713
1894 bool finishStartElement(bool contents = true); -
1895 void writeStartElement(const QString &namespaceUri, const QString &name); -
1896 QIODevice *device; -
1897 QString *stringDevice; -
1898 uint deleteDevice :1; -
1899 uint inStartElement :1; -
1900 uint inEmptyElement :1; -
1901 uint lastWasStartElement :1; -
1902 uint wroteSomething :1; -
1903 uint hasError :1; -
1904 uint autoFormatting :1; -
1905 uint isCodecASCIICompatible :1; -
1906 QByteArray autoFormattingIndent; -
1907 NamespaceDeclaration emptyNamespace; -
1908 int lastNamespaceDeclaration; -
1909 -
1910 -
1911 QTextCodec *codec; -
1912 QTextEncoder *encoder; -
1913 -
1914 void checkIfASCIICompatibleCodec(); -
1915 -
1916 NamespaceDeclaration &findNamespace(const QString &namespaceUri, bool writeDeclaration = false, bool noDefault = false); -
1917 void writeNamespaceDeclaration(const NamespaceDeclaration &namespaceDeclaration); -
1918 -
1919 int namespacePrefixCount; -
1920 -
1921 void indent(int level); -
1922}; -
1923 -
1924 -
1925QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q) -
1926 :autoFormattingIndent(4, ' ') -
1927{ -
1928 q_ptr = q; -
1929 device = 0; -
1930 stringDevice = 0; -
1931 deleteDevice = false; -
1932 -
1933 codec = QTextCodec::codecForMib(106); -
1934 encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); -
1935 -
1936 checkIfASCIICompatibleCodec(); -
1937 inStartElement = inEmptyElement = false; -
1938 wroteSomething = false; -
1939 hasError = false; -
1940 lastWasStartElement = false; -
1941 lastNamespaceDeclaration = 1; -
1942 autoFormatting = false; -
1943 namespacePrefixCount = 0; -
1944}
executed: }
Execution Count:731
731
1945 -
1946void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec() -
1947{ -
1948 -
1949 qt_noop(); -
1950 -
1951 const QByteArray bytes = encoder->fromUnicode(QString::fromUtf8("" " " "", sizeof(" ") - 1)); -
1952 isCodecASCIICompatible = (bytes.count() == 1); -
1953 -
1954 -
1955 -
1956}
executed: }
Execution Count:738
738
1957 -
1958void QXmlStreamWriterPrivate::write(const QStringRef &s) -
1959{ -
1960 if (device) {
evaluated: device
TRUEFALSE
yes
Evaluation Count:2631
yes
Evaluation Count:8
8-2631
1961 if (hasError)
evaluated: hasError
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2627
4-2627
1962 return;
executed: return;
Execution Count:4
4
1963 -
1964 -
1965 -
1966 QByteArray bytes = encoder->fromUnicode(s.constData(), s.size()); -
1967 -
1968 if (device->write(bytes) != bytes.size())
evaluated: device->write(bytes) != bytes.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2626
1-2626
1969 hasError = true;
executed: hasError = true;
Execution Count:1
1
1970 }
executed: }
Execution Count:2627
2627
1971 else if (stringDevice)
partially evaluated: stringDevice
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
1972 s.appendTo(stringDevice);
executed: s.appendTo(stringDevice);
Execution Count:8
8
1973 else -
1974 QMessageLogger("xml/qxmlstream.cpp", 3052, __PRETTY_FUNCTION__).warning("QXmlStreamWriter: No device");
never executed: QMessageLogger("xml/qxmlstream.cpp", 3052, __PRETTY_FUNCTION__).warning("QXmlStreamWriter: No device");
0
1975} -
1976 -
1977void QXmlStreamWriterPrivate::write(const QString &s) -
1978{ -
1979 if (device) {
evaluated: device
TRUEFALSE
yes
Evaluation Count:4898
yes
Evaluation Count:72
72-4898
1980 if (hasError)
evaluated: hasError
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4897
1-4897
1981 return;
executed: return;
Execution Count:1
1
1982 -
1983 -
1984 -
1985 QByteArray bytes = encoder->fromUnicode(s); -
1986 -
1987 if (device->write(bytes) != bytes.size())
evaluated: device->write(bytes) != bytes.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4896
1-4896
1988 hasError = true;
executed: hasError = true;
Execution Count:1
1
1989 }
executed: }
Execution Count:4897
4897
1990 else if (stringDevice)
partially evaluated: stringDevice
TRUEFALSE
yes
Evaluation Count:72
no
Evaluation Count:0
0-72
1991 stringDevice->append(s);
executed: stringDevice->append(s);
Execution Count:72
72
1992 else -
1993 QMessageLogger("xml/qxmlstream.cpp", 3071, __PRETTY_FUNCTION__).warning("QXmlStreamWriter: No device");
never executed: QMessageLogger("xml/qxmlstream.cpp", 3071, __PRETTY_FUNCTION__).warning("QXmlStreamWriter: No device");
0
1994} -
1995 -
1996void QXmlStreamWriterPrivate::writeEscaped(const QString &s, bool escapeWhitespace) -
1997{ -
1998 QString escaped; -
1999 escaped.reserve(s.size()); -
2000 for ( int i = 0; i < s.size(); ++i ) {
evaluated: i < s.size()
TRUEFALSE
yes
Evaluation Count:20194
yes
Evaluation Count:3310
3310-20194
2001 QChar c = s.at(i); -
2002 if (c.unicode() == '<' )
evaluated: c.unicode() == '<'
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:20144
50-20144
2003 escaped.append(QLatin1String("&lt;"));
executed: escaped.append(QLatin1String("&lt;"));
Execution Count:50
50
2004 else if (c.unicode() == '>' )
evaluated: c.unicode() == '>'
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:20092
52-20092
2005 escaped.append(QLatin1String("&gt;"));
executed: escaped.append(QLatin1String("&gt;"));
Execution Count:52
52
2006 else if (c.unicode() == '&' )
evaluated: c.unicode() == '&'
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:20063
29-20063
2007 escaped.append(QLatin1String("&amp;"));
executed: escaped.append(QLatin1String("&amp;"));
Execution Count:29
29
2008 else if (c.unicode() == '\"' )
evaluated: c.unicode() == '\"'
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:20042
21-20042
2009 escaped.append(QLatin1String("&quot;"));
executed: escaped.append(QLatin1String("&quot;"));
Execution Count:21
21
2010 else if (escapeWhitespace && c.isSpace()) {
evaluated: escapeWhitespace
TRUEFALSE
yes
Evaluation Count:3440
yes
Evaluation Count:16602
evaluated: c.isSpace()
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:3267
173-16602
2011 if (c.unicode() == '\n')
evaluated: c.unicode() == '\n'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:171
2-171
2012 escaped.append(QLatin1String("&#10;"));
executed: escaped.append(QLatin1String("&#10;"));
Execution Count:2
2
2013 else if (c.unicode() == '\r')
evaluated: c.unicode() == '\r'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:169
2-169
2014 escaped.append(QLatin1String("&#13;"));
executed: escaped.append(QLatin1String("&#13;"));
Execution Count:2
2
2015 else if (c.unicode() == '\t')
evaluated: c.unicode() == '\t'
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:166
3-166
2016 escaped.append(QLatin1String("&#9;"));
executed: escaped.append(QLatin1String("&#9;"));
Execution Count:3
3
2017 else -
2018 escaped += c;
executed: escaped += c;
Execution Count:166
166
2019 } else { -
2020 escaped += QChar(c); -
2021 }
executed: }
Execution Count:19869
19869
2022 } -
2023 write(escaped); -
2024}
executed: }
Execution Count:3310
3310
2025 -
2026 -
2027void QXmlStreamWriterPrivate::write(const char *s, int len) -
2028{ -
2029 if (device) {
evaluated: device
TRUEFALSE
yes
Evaluation Count:8771
yes
Evaluation Count:64
64-8771
2030 if (hasError)
evaluated: hasError
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:8757
14-8757
2031 return;
executed: return;
Execution Count:14
14
2032 if (isCodecASCIICompatible) {
evaluated: isCodecASCIICompatible
TRUEFALSE
yes
Evaluation Count:8753
yes
Evaluation Count:4
4-8753
2033 if (device->write(s, len) != len)
evaluated: device->write(s, len) != len
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8751
2-8751
2034 hasError = true;
executed: hasError = true;
Execution Count:2
2
2035 return;
executed: return;
Execution Count:8753
8753
2036 } -
2037 }
executed: }
Execution Count:4
4
2038 -
2039 write(QString::fromLatin1(s, len)); -
2040}
executed: }
Execution Count:68
68
2041 -
2042void QXmlStreamWriterPrivate::writeNamespaceDeclaration(const NamespaceDeclaration &namespaceDeclaration) { -
2043 if (namespaceDeclaration.prefix.isEmpty()) {
partially evaluated: namespaceDeclaration.prefix.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:48
0-48
2044 write(" xmlns=\""); -
2045 write(namespaceDeclaration.namespaceUri); -
2046 write("\""); -
2047 } else {
never executed: }
0
2048 write(" xmlns:"); -
2049 write(namespaceDeclaration.prefix); -
2050 write("=\""); -
2051 write(namespaceDeclaration.namespaceUri); -
2052 write("\""); -
2053 }
executed: }
Execution Count:48
48
2054} -
2055 -
2056bool QXmlStreamWriterPrivate::finishStartElement(bool contents) -
2057{ -
2058 bool hadSomethingWritten = wroteSomething; -
2059 wroteSomething = contents; -
2060 if (!inStartElement)
evaluated: !inStartElement
TRUEFALSE
yes
Evaluation Count:4993
yes
Evaluation Count:1189
1189-4993
2061 return hadSomethingWritten;
executed: return hadSomethingWritten;
Execution Count:4993
4993
2062 -
2063 if (inEmptyElement) {
evaluated: inEmptyElement
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1175
14-1175
2064 write("/>"); -
2065 QXmlStreamWriterPrivate::Tag &tag = tagStack_pop(); -
2066 lastNamespaceDeclaration = tag.namespaceDeclarationsSize; -
2067 lastWasStartElement = false; -
2068 } else {
executed: }
Execution Count:14
14
2069 write(">"); -
2070 }
executed: }
Execution Count:1175
1175
2071 inStartElement = inEmptyElement = false; -
2072 lastNamespaceDeclaration = namespaceDeclarations.size(); -
2073 return hadSomethingWritten;
executed: return hadSomethingWritten;
Execution Count:1189
1189
2074} -
2075 -
2076QXmlStreamPrivateTagStack::NamespaceDeclaration &QXmlStreamWriterPrivate::findNamespace(const QString &namespaceUri, bool writeDeclaration, bool noDefault) -
2077{ -
2078 for (int j = namespaceDeclarations.size() - 1; j >= 0; --j) {
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:1583
yes
Evaluation Count:1161
1161-1583
2079 NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations[j]; -
2080 if (namespaceDeclaration.namespaceUri == namespaceUri) {
evaluated: namespaceDeclaration.namespaceUri == namespaceUri
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:1474
109-1474
2081 if (!noDefault || !namespaceDeclaration.prefix.isEmpty())
evaluated: !noDefault
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:69
partially evaluated: !namespaceDeclaration.prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:69
no
Evaluation Count:0
0-69
2082 return namespaceDeclaration;
executed: return namespaceDeclaration;
Execution Count:109
109
2083 }
never executed: }
0
2084 }
executed: }
Execution Count:1474
1474
2085 if (namespaceUri.isEmpty())
evaluated: namespaceUri.isEmpty()
TRUEFALSE
yes
Evaluation Count:1142
yes
Evaluation Count:19
19-1142
2086 return emptyNamespace;
executed: return emptyNamespace;
Execution Count:1142
1142
2087 NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); -
2088 if (namespaceUri.isEmpty()) {
partially evaluated: namespaceUri.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
2089 namespaceDeclaration.prefix.clear(); -
2090 } else {
never executed: }
0
2091 QString s; -
2092 int n = ++namespacePrefixCount; -
2093 for(;;) { -
2094 s = QLatin1Char('n') + QString::number(n++); -
2095 int j = namespaceDeclarations.size() - 2; -
2096 while (j >= 0 && namespaceDeclarations.at(j).prefix != s)
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:19
partially evaluated: namespaceDeclarations.at(j).prefix != s
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
0-22
2097 --j;
executed: --j;
Execution Count:22
22
2098 if (j < 0)
partially evaluated: j < 0
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
0-19
2099 break;
executed: break;
Execution Count:19
19
2100 }
never executed: }
0
2101 namespaceDeclaration.prefix = addToStringStorage(s); -
2102 }
executed: }
Execution Count:19
19
2103 namespaceDeclaration.namespaceUri = addToStringStorage(namespaceUri); -
2104 if (writeDeclaration)
evaluated: writeDeclaration
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:15
4-15
2105 writeNamespaceDeclaration(namespaceDeclaration);
executed: writeNamespaceDeclaration(namespaceDeclaration);
Execution Count:4
4
2106 return namespaceDeclaration;
executed: return namespaceDeclaration;
Execution Count:19
19
2107} -
2108 -
2109 -
2110 -
2111void QXmlStreamWriterPrivate::indent(int level) -
2112{ -
2113 write("\n"); -
2114 for (int i = level; i > 0; --i)
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:80
80-98
2115 write(autoFormattingIndent.constData(), autoFormattingIndent.length());
executed: write(autoFormattingIndent.constData(), autoFormattingIndent.length());
Execution Count:98
98
2116}
executed: }
Execution Count:80
80
2117 -
2118 -
2119 -
2120 -
2121 -
2122 -
2123 -
2124QXmlStreamWriter::QXmlStreamWriter() -
2125 : d_ptr(new QXmlStreamWriterPrivate(this)) -
2126{ -
2127}
never executed: }
0
2128 -
2129 -
2130 -
2131 -
2132QXmlStreamWriter::QXmlStreamWriter(QIODevice *device) -
2133 : d_ptr(new QXmlStreamWriterPrivate(this)) -
2134{ -
2135 QXmlStreamWriterPrivate * const d = d_func(); -
2136 d->device = device; -
2137}
executed: }
Execution Count:19
19
2138 -
2139 -
2140 -
2141 -
2142 -
2143QXmlStreamWriter::QXmlStreamWriter(QByteArray *array) -
2144 : d_ptr(new QXmlStreamWriterPrivate(this)) -
2145{ -
2146 QXmlStreamWriterPrivate * const d = d_func(); -
2147 d->device = new QBuffer(array); -
2148 d->device->open(QIODevice::WriteOnly); -
2149 d->deleteDevice = true; -
2150}
executed: }
Execution Count:710
710
2151 -
2152 -
2153 -
2154 -
2155QXmlStreamWriter::QXmlStreamWriter(QString *string) -
2156 : d_ptr(new QXmlStreamWriterPrivate(this)) -
2157{ -
2158 QXmlStreamWriterPrivate * const d = d_func(); -
2159 d->stringDevice = string; -
2160}
executed: }
Execution Count:2
2
2161 -
2162 -
2163 -
2164 -
2165QXmlStreamWriter::~QXmlStreamWriter() -
2166{ -
2167} -
2168void QXmlStreamWriter::setDevice(QIODevice *device) -
2169{ -
2170 QXmlStreamWriterPrivate * const d = d_func(); -
2171 if (device == d->device)
never evaluated: device == d->device
0
2172 return;
never executed: return;
0
2173 d->stringDevice = 0; -
2174 if (d->deleteDevice) {
never evaluated: d->deleteDevice
0
2175 delete d->device; -
2176 d->deleteDevice = false; -
2177 }
never executed: }
0
2178 d->device = device; -
2179}
never executed: }
0
2180 -
2181 -
2182 -
2183 -
2184 -
2185 -
2186 -
2187QIODevice *QXmlStreamWriter::device() const -
2188{ -
2189 const QXmlStreamWriterPrivate * const d = d_func(); -
2190 return d->device;
never executed: return d->device;
0
2191} -
2192void QXmlStreamWriter::setCodec(QTextCodec *codec) -
2193{ -
2194 QXmlStreamWriterPrivate * const d = d_func(); -
2195 if (codec) {
partially evaluated: codec
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
2196 d->codec = codec; -
2197 delete d->encoder; -
2198 d->encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); -
2199 d->checkIfASCIICompatibleCodec(); -
2200 }
executed: }
Execution Count:7
7
2201}
executed: }
Execution Count:7
7
2202void QXmlStreamWriter::setCodec(const char *codecName) -
2203{ -
2204 setCodec(QTextCodec::codecForName(codecName)); -
2205}
executed: }
Execution Count:1
1
2206 -
2207 -
2208 -
2209 -
2210 -
2211 -
2212QTextCodec *QXmlStreamWriter::codec() const -
2213{ -
2214 const QXmlStreamWriterPrivate * const d = d_func(); -
2215 return d->codec;
never executed: return d->codec;
0
2216} -
2217void QXmlStreamWriter::setAutoFormatting(bool enable) -
2218{ -
2219 QXmlStreamWriterPrivate * const d = d_func(); -
2220 d->autoFormatting = enable; -
2221}
executed: }
Execution Count:15
15
2222 -
2223 -
2224 -
2225 -
2226 -
2227 -
2228bool QXmlStreamWriter::autoFormatting() const -
2229{ -
2230 const QXmlStreamWriterPrivate * const d = d_func(); -
2231 return d->autoFormatting;
never executed: return d->autoFormatting;
0
2232} -
2233void QXmlStreamWriter::setAutoFormattingIndent(int spacesOrTabs) -
2234{ -
2235 QXmlStreamWriterPrivate * const d = d_func(); -
2236 d->autoFormattingIndent = QByteArray(qAbs(spacesOrTabs), spacesOrTabs >= 0 ? ' ' : '\t'); -
2237}
executed: }
Execution Count:9
9
2238 -
2239int QXmlStreamWriter::autoFormattingIndent() const -
2240{ -
2241 const QXmlStreamWriterPrivate * const d = d_func(); -
2242 return d->autoFormattingIndent.count(' ') - d->autoFormattingIndent.count('\t');
executed: return d->autoFormattingIndent.count(' ') - d->autoFormattingIndent.count('\t');
Execution Count:1
1
2243} -
2244 -
2245 -
2246 -
2247 -
2248 -
2249 -
2250 -
2251bool QXmlStreamWriter::hasError() const -
2252{ -
2253 const QXmlStreamWriterPrivate * const d = d_func(); -
2254 return d->hasError;
executed: return d->hasError;
Execution Count:6
6
2255} -
2256void QXmlStreamWriter::writeAttribute(const QString &qualifiedName, const QString &value) -
2257{ -
2258 QXmlStreamWriterPrivate * const d = d_func(); -
2259 qt_noop(); -
2260 qt_noop(); -
2261 d->write(" "); -
2262 d->write(qualifiedName); -
2263 d->write("=\""); -
2264 d->writeEscaped(value, true); -
2265 d->write("\""); -
2266}
executed: }
Execution Count:439
439
2267void QXmlStreamWriter::writeAttribute(const QString &namespaceUri, const QString &name, const QString &value) -
2268{ -
2269 QXmlStreamWriterPrivate * const d = d_func(); -
2270 qt_noop(); -
2271 qt_noop(); -
2272 QXmlStreamWriterPrivate::NamespaceDeclaration &namespaceDeclaration = d->findNamespace(namespaceUri, true, true); -
2273 d->write(" "); -
2274 if (!namespaceDeclaration.prefix.isEmpty()) {
partially evaluated: !namespaceDeclaration.prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:73
no
Evaluation Count:0
0-73
2275 d->write(namespaceDeclaration.prefix); -
2276 d->write(":"); -
2277 }
executed: }
Execution Count:73
73
2278 d->write(name); -
2279 d->write("=\""); -
2280 d->writeEscaped(value, true); -
2281 d->write("\""); -
2282}
executed: }
Execution Count:73
73
2283void QXmlStreamWriter::writeAttribute(const QXmlStreamAttribute& attribute) -
2284{ -
2285 if (attribute.namespaceUri().isEmpty())
evaluated: attribute.namespaceUri().isEmpty()
TRUEFALSE
yes
Evaluation Count:433
yes
Evaluation Count:34
34-433
2286 writeAttribute(attribute.qualifiedName().toString(), 433
2287 attribute.value().toString());
executed: writeAttribute(attribute.qualifiedName().toString(), attribute.value().toString());
Execution Count:433
433
2288 else -
2289 writeAttribute(attribute.namespaceUri().toString(), 34
2290 attribute.name().toString(), 34
2291 attribute.value().toString());
executed: writeAttribute(attribute.namespaceUri().toString(), attribute.name().toString(), attribute.value().toString());
Execution Count:34
34
2292} -
2293void QXmlStreamWriter::writeAttributes(const QXmlStreamAttributes& attributes) -
2294{ -
2295 QXmlStreamWriterPrivate * const d = d_func(); -
2296 qt_noop(); -
2297 (void)d;; -
2298 for (int i = 0; i < attributes.size(); ++i)
partially evaluated: i < attributes.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2299 writeAttribute(attributes.at(i));
never executed: writeAttribute(attributes.at(i));
0
2300}
executed: }
Execution Count:4
4
2301void QXmlStreamWriter::writeCDATA(const QString &text) -
2302{ -
2303 QXmlStreamWriterPrivate * const d = d_func(); -
2304 d->finishStartElement(); -
2305 QString copy(text); -
2306 copy.replace(QLatin1String("]]>"), QLatin1String("]]]]><![CDATA[>")); -
2307 d->write("<![CDATA["); -
2308 d->write(copy); -
2309 d->write("]]>"); -
2310}
never executed: }
0
2311void QXmlStreamWriter::writeCharacters(const QString &text) -
2312{ -
2313 QXmlStreamWriterPrivate * const d = d_func(); -
2314 d->finishStartElement(); -
2315 d->writeEscaped(text); -
2316}
executed: }
Execution Count:2798
2798
2317 -
2318 -
2319 -
2320 -
2321 -
2322 -
2323void QXmlStreamWriter::writeComment(const QString &text) -
2324{ -
2325 QXmlStreamWriterPrivate * const d = d_func(); -
2326 qt_noop(); -
2327 if (!d->finishStartElement(false) && d->autoFormatting)
partially evaluated: !d->finishStartElement(false)
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
partially evaluated: d->autoFormatting
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
2328 d->indent(d->tagStack.size());
executed: d->indent(d->tagStack.size());
Execution Count:7
7
2329 d->write("<!--"); -
2330 d->write(text); -
2331 d->write("-->"); -
2332 d->inStartElement = d->lastWasStartElement = false; -
2333}
executed: }
Execution Count:7
7
2334 -
2335 -
2336 -
2337 -
2338 -
2339void QXmlStreamWriter::writeDTD(const QString &dtd) -
2340{ -
2341 QXmlStreamWriterPrivate * const d = d_func(); -
2342 d->finishStartElement(); -
2343 if (d->autoFormatting)
partially evaluated: d->autoFormatting
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
2344 d->write("\n");
never executed: d->write("\n");
0
2345 d->write(dtd); -
2346 if (d->autoFormatting)
partially evaluated: d->autoFormatting
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
2347 d->write("\n");
never executed: d->write("\n");
0
2348}
executed: }
Execution Count:46
46
2349 -
2350 -
2351 -
2352 -
2353 -
2354 -
2355 -
2356void QXmlStreamWriter::writeEmptyElement(const QString &qualifiedName) -
2357{ -
2358 QXmlStreamWriterPrivate * const d = d_func(); -
2359 qt_noop(); -
2360 d->writeStartElement(QString(), qualifiedName); -
2361 d->inEmptyElement = true; -
2362}
executed: }
Execution Count:5
5
2363void QXmlStreamWriter::writeEmptyElement(const QString &namespaceUri, const QString &name) -
2364{ -
2365 QXmlStreamWriterPrivate * const d = d_func(); -
2366 qt_noop(); -
2367 d->writeStartElement(namespaceUri, name); -
2368 d->inEmptyElement = true; -
2369}
executed: }
Execution Count:9
9
2370void QXmlStreamWriter::writeTextElement(const QString &qualifiedName, const QString &text) -
2371{ -
2372 writeStartElement(qualifiedName); -
2373 writeCharacters(text); -
2374 writeEndElement(); -
2375}
executed: }
Execution Count:1
1
2376void QXmlStreamWriter::writeTextElement(const QString &namespaceUri, const QString &name, const QString &text) -
2377{ -
2378 writeStartElement(namespaceUri, name); -
2379 writeCharacters(text); -
2380 writeEndElement(); -
2381}
never executed: }
0
2382 -
2383 -
2384 -
2385 -
2386 -
2387 -
2388 -
2389void QXmlStreamWriter::writeEndDocument() -
2390{ -
2391 QXmlStreamWriterPrivate * const d = d_func(); -
2392 while (d->tagStack.size())
evaluated: d->tagStack.size()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:20
8-20
2393 writeEndElement();
executed: writeEndElement();
Execution Count:8
8
2394 d->write("\n"); -
2395}
executed: }
Execution Count:20
20
2396 -
2397 -
2398 -
2399 -
2400 -
2401 -
2402void QXmlStreamWriter::writeEndElement() -
2403{ -
2404 QXmlStreamWriterPrivate * const d = d_func(); -
2405 if (d->tagStack.isEmpty())
evaluated: d->tagStack.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1185
1-1185
2406 return;
executed: return;
Execution Count:1
1
2407 -
2408 -
2409 if (d->inStartElement && !d->inEmptyElement) {
evaluated: d->inStartElement
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:1168
evaluated: !d->inEmptyElement
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:11
6-1168
2410 d->write("/>"); -
2411 d->lastWasStartElement = d->inStartElement = false; -
2412 QXmlStreamWriterPrivate::Tag &tag = d->tagStack_pop(); -
2413 d->lastNamespaceDeclaration = tag.namespaceDeclarationsSize; -
2414 return;
executed: return;
Execution Count:6
6
2415 } -
2416 -
2417 if (!d->finishStartElement(false) && !d->lastWasStartElement && d->autoFormatting)
evaluated: !d->finishStartElement(false)
TRUEFALSE
yes
Evaluation Count:95
yes
Evaluation Count:1084
evaluated: !d->lastWasStartElement
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:7
evaluated: d->autoFormatting
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:61
7-1084
2418 d->indent(d->tagStack.size()-1);
executed: d->indent(d->tagStack.size()-1);
Execution Count:27
27
2419 if (d->tagStack.isEmpty())
evaluated: d->tagStack.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1175
4-1175
2420 return;
executed: return;
Execution Count:4
4
2421 d->lastWasStartElement = false; -
2422 QXmlStreamWriterPrivate::Tag &tag = d->tagStack_pop(); -
2423 d->lastNamespaceDeclaration = tag.namespaceDeclarationsSize; -
2424 d->write("</"); -
2425 if (!tag.namespaceDeclaration.prefix.isEmpty()) {
evaluated: !tag.namespaceDeclaration.prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:1132
43-1132
2426 d->write(tag.namespaceDeclaration.prefix); -
2427 d->write(":"); -
2428 }
executed: }
Execution Count:43
43
2429 d->write(tag.name); -
2430 d->write(">"); -
2431}
executed: }
Execution Count:1175
1175
2432 -
2433 -
2434 -
2435 -
2436 -
2437 -
2438void QXmlStreamWriter::writeEntityReference(const QString &name) -
2439{ -
2440 QXmlStreamWriterPrivate * const d = d_func(); -
2441 d->finishStartElement(); -
2442 d->write("&"); -
2443 d->write(name); -
2444 d->write(";"); -
2445}
executed: }
Execution Count:857
857
2446void QXmlStreamWriter::writeNamespace(const QString &namespaceUri, const QString &prefix) -
2447{ -
2448 QXmlStreamWriterPrivate * const d = d_func(); -
2449 qt_noop(); -
2450 qt_noop(); -
2451 if (prefix.isEmpty()) {
partially evaluated: prefix.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
0-29
2452 d->findNamespace(namespaceUri, d->inStartElement); -
2453 } else {
never executed: }
0
2454 qt_noop(); -
2455 qt_noop(); -
2456 QXmlStreamWriterPrivate::NamespaceDeclaration &namespaceDeclaration = d->namespaceDeclarations.push(); -
2457 namespaceDeclaration.prefix = d->addToStringStorage(prefix); -
2458 namespaceDeclaration.namespaceUri = d->addToStringStorage(namespaceUri); -
2459 if (d->inStartElement)
evaluated: d->inStartElement
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:27
2-27
2460 d->writeNamespaceDeclaration(namespaceDeclaration);
executed: d->writeNamespaceDeclaration(namespaceDeclaration);
Execution Count:2
2
2461 }
executed: }
Execution Count:29
29
2462} -
2463void QXmlStreamWriter::writeDefaultNamespace(const QString &namespaceUri) -
2464{ -
2465 QXmlStreamWriterPrivate * const d = d_func(); -
2466 qt_noop(); -
2467 qt_noop(); -
2468 QXmlStreamWriterPrivate::NamespaceDeclaration &namespaceDeclaration = d->namespaceDeclarations.push(); -
2469 namespaceDeclaration.prefix.clear(); -
2470 namespaceDeclaration.namespaceUri = d->addToStringStorage(namespaceUri); -
2471 if (d->inStartElement)
never evaluated: d->inStartElement
0
2472 d->writeNamespaceDeclaration(namespaceDeclaration);
never executed: d->writeNamespaceDeclaration(namespaceDeclaration);
0
2473}
never executed: }
0
2474 -
2475 -
2476 -
2477 -
2478 -
2479 -
2480void QXmlStreamWriter::writeProcessingInstruction(const QString &target, const QString &data) -
2481{ -
2482 QXmlStreamWriterPrivate * const d = d_func(); -
2483 qt_noop(); -
2484 if (!d->finishStartElement(false) && d->autoFormatting)
evaluated: !d->finishStartElement(false)
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:11
evaluated: d->autoFormatting
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:60
1-61
2485 d->indent(d->tagStack.size());
executed: d->indent(d->tagStack.size());
Execution Count:1
1
2486 d->write("<?"); -
2487 d->write(target); -
2488 if (!data.isNull()) {
partially evaluated: !data.isNull()
TRUEFALSE
yes
Evaluation Count:72
no
Evaluation Count:0
0-72
2489 d->write(" "); -
2490 d->write(data); -
2491 }
executed: }
Execution Count:72
72
2492 d->write("?>"); -
2493}
executed: }
Execution Count:72
72
2494void QXmlStreamWriter::writeStartDocument() -
2495{ -
2496 writeStartDocument(QLatin1String("1.0")); -
2497}
executed: }
Execution Count:21
21
2498 -
2499 -
2500 -
2501 -
2502 -
2503 -
2504 -
2505void QXmlStreamWriter::writeStartDocument(const QString &version) -
2506{ -
2507 QXmlStreamWriterPrivate * const d = d_func(); -
2508 d->finishStartElement(false); -
2509 d->write("<?xml version=\""); -
2510 d->write(version); -
2511 if (d->device) {
evaluated: d->device
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:2
2-22
2512 d->write("\" encoding=\""); -
2513 -
2514 -
2515 -
2516 d->write(d->codec->name().constData(), d->codec->name().length()); -
2517 -
2518 }
executed: }
Execution Count:22
22
2519 d->write("\"?>"); -
2520}
executed: }
Execution Count:24
24
2521 -
2522 -
2523 -
2524 -
2525 -
2526 -
2527 -
2528void QXmlStreamWriter::writeStartDocument(const QString &version, bool standalone) -
2529{ -
2530 QXmlStreamWriterPrivate * const d = d_func(); -
2531 d->finishStartElement(false); -
2532 d->write("<?xml version=\""); -
2533 d->write(version); -
2534 if (d->device) {
partially evaluated: d->device
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2535 d->write("\" encoding=\""); -
2536 -
2537 -
2538 -
2539 d->write(d->codec->name().constData(), d->codec->name().length()); -
2540 -
2541 }
executed: }
Execution Count:2
2
2542 if (standalone)
evaluated: standalone
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2543 d->write("\" standalone=\"yes\"?>");
executed: d->write("\" standalone=\"yes\"?>");
Execution Count:1
1
2544 else -
2545 d->write("\" standalone=\"no\"?>");
executed: d->write("\" standalone=\"no\"?>");
Execution Count:1
1
2546} -
2547void QXmlStreamWriter::writeStartElement(const QString &qualifiedName) -
2548{ -
2549 QXmlStreamWriterPrivate * const d = d_func(); -
2550 qt_noop(); -
2551 d->writeStartElement(QString(), qualifiedName); -
2552}
executed: }
Execution Count:9
9
2553void QXmlStreamWriter::writeStartElement(const QString &namespaceUri, const QString &name) -
2554{ -
2555 QXmlStreamWriterPrivate * const d = d_func(); -
2556 qt_noop(); -
2557 d->writeStartElement(namespaceUri, name); -
2558}
executed: }
Execution Count:1174
1174
2559 -
2560void QXmlStreamWriterPrivate::writeStartElement(const QString &namespaceUri, const QString &name) -
2561{ -
2562 if (!finishStartElement(false) && autoFormatting)
evaluated: !finishStartElement(false)
TRUEFALSE
yes
Evaluation Count:756
yes
Evaluation Count:441
evaluated: autoFormatting
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:711
45-756
2563 indent(tagStack.size());
executed: indent(tagStack.size());
Execution Count:45
45
2564 -
2565 Tag &tag = tagStack_push(); -
2566 tag.name = addToStringStorage(name); -
2567 tag.namespaceDeclaration = findNamespace(namespaceUri); -
2568 write("<"); -
2569 if (!tag.namespaceDeclaration.prefix.isEmpty()) {
evaluated: !tag.namespaceDeclaration.prefix.isEmpty()
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:1142
55-1142
2570 write(tag.namespaceDeclaration.prefix); -
2571 write(":"); -
2572 }
executed: }
Execution Count:55
55
2573 write(tag.name); -
2574 inStartElement = lastWasStartElement = true; -
2575 -
2576 for (int i = lastNamespaceDeclaration; i < namespaceDeclarations.size(); ++i)
evaluated: i < namespaceDeclarations.size()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:1197
42-1197
2577 writeNamespaceDeclaration(namespaceDeclarations[i]);
executed: writeNamespaceDeclaration(namespaceDeclarations[i]);
Execution Count:42
42
2578 tag.namespaceDeclarationsSize = lastNamespaceDeclaration; -
2579}
executed: }
Execution Count:1197
1197
2580void QXmlStreamWriter::writeCurrentToken(const QXmlStreamReader &reader) -
2581{ -
2582 switch (reader.tokenType()) { -
2583 case QXmlStreamReader::NoToken: -
2584 break;
never executed: break;
0
2585 case QXmlStreamReader::StartDocument: -
2586 writeStartDocument(); -
2587 break;
executed: break;
Execution Count:2
2
2588 case QXmlStreamReader::EndDocument: -
2589 writeEndDocument(); -
2590 break;
executed: break;
Execution Count:2
2
2591 case QXmlStreamReader::StartElement: { -
2592 QXmlStreamNamespaceDeclarations namespaceDeclarations = reader.namespaceDeclarations(); -
2593 for (int i = 0; i < namespaceDeclarations.size(); ++i) {
partially evaluated: i < namespaceDeclarations.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2594 const QXmlStreamNamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.at(i); -
2595 writeNamespace(namespaceDeclaration.namespaceUri().toString(), -
2596 namespaceDeclaration.prefix().toString()); -
2597 }
never executed: }
0
2598 writeStartElement(reader.namespaceUri().toString(), reader.name().toString()); -
2599 writeAttributes(reader.attributes()); -
2600 } break;
executed: break;
Execution Count:4
4
2601 case QXmlStreamReader::EndElement: -
2602 writeEndElement(); -
2603 break;
executed: break;
Execution Count:1144
1144
2604 case QXmlStreamReader::Characters: -
2605 if (reader.isCDATA())
never evaluated: reader.isCDATA()
0
2606 writeCDATA(reader.text().toString());
never executed: writeCDATA(reader.text().toString());
0
2607 else -
2608 writeCharacters(reader.text().toString());
never executed: writeCharacters(reader.text().toString());
0
2609 break;
never executed: break;
0
2610 case QXmlStreamReader::Comment: -
2611 writeComment(reader.text().toString()); -
2612 break;
executed: break;
Execution Count:6
6
2613 case QXmlStreamReader::DTD: -
2614 writeDTD(reader.text().toString()); -
2615 break;
never executed: break;
0
2616 case QXmlStreamReader::EntityReference: -
2617 writeEntityReference(reader.name().toString()); -
2618 break;
executed: break;
Execution Count:1
1
2619 case QXmlStreamReader::ProcessingInstruction: -
2620 writeProcessingInstruction(reader.processingInstructionTarget().toString(), -
2621 reader.processingInstructionData().toString()); -
2622 break;
executed: break;
Execution Count:48
48
2623 default: -
2624 qt_noop(); -
2625 QMessageLogger("xml/qxmlstream.cpp", 3929, __PRETTY_FUNCTION__).warning("QXmlStreamWriter: writeCurrentToken() with invalid state."); -
2626 break;
never executed: break;
0
2627 } -
2628}
executed: }
Execution Count:1207
1207
2629 -
2630 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial