sax/qxml.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtXml module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qxml.h" -
43#include "qtextcodec.h" -
44#include "qbuffer.h" -
45#include "qregexp.h" -
46#include "qmap.h" -
47#include "qstack.h" -
48#include <qdebug.h> -
49 -
50 -
51#ifdef Q_CC_BOR // borland 6 finds bogus warnings when building this file in uic3 -
52# pragma warn -8080 -
53#endif -
54 -
55//#define QT_QXML_DEBUG -
56 -
57// Error strings for the XML reader -
58#define XMLERR_OK QT_TRANSLATE_NOOP("QXml", "no error occurred") -
59#define XMLERR_ERRORBYCONSUMER QT_TRANSLATE_NOOP("QXml", "error triggered by consumer") -
60#define XMLERR_UNEXPECTEDEOF QT_TRANSLATE_NOOP("QXml", "unexpected end of file") -
61#define XMLERR_MORETHANONEDOCTYPE QT_TRANSLATE_NOOP("QXml", "more than one document type definition") -
62#define XMLERR_ERRORPARSINGELEMENT QT_TRANSLATE_NOOP("QXml", "error occurred while parsing element") -
63#define XMLERR_TAGMISMATCH QT_TRANSLATE_NOOP("QXml", "tag mismatch") -
64#define XMLERR_ERRORPARSINGCONTENT QT_TRANSLATE_NOOP("QXml", "error occurred while parsing content") -
65#define XMLERR_UNEXPECTEDCHARACTER QT_TRANSLATE_NOOP("QXml", "unexpected character") -
66#define XMLERR_INVALIDNAMEFORPI QT_TRANSLATE_NOOP("QXml", "invalid name for processing instruction") -
67#define XMLERR_VERSIONEXPECTED QT_TRANSLATE_NOOP("QXml", "version expected while reading the XML declaration") -
68#define XMLERR_WRONGVALUEFORSDECL QT_TRANSLATE_NOOP("QXml", "wrong value for standalone declaration") -
69#define XMLERR_EDECLORSDDECLEXPECTED QT_TRANSLATE_NOOP("QXml", "encoding declaration or standalone declaration expected while reading the XML declaration") -
70#define XMLERR_SDDECLEXPECTED QT_TRANSLATE_NOOP("QXml", "standalone declaration expected while reading the XML declaration") -
71#define XMLERR_ERRORPARSINGDOCTYPE QT_TRANSLATE_NOOP("QXml", "error occurred while parsing document type definition") -
72#define XMLERR_LETTEREXPECTED QT_TRANSLATE_NOOP("QXml", "letter is expected") -
73#define XMLERR_ERRORPARSINGCOMMENT QT_TRANSLATE_NOOP("QXml", "error occurred while parsing comment") -
74#define XMLERR_ERRORPARSINGREFERENCE QT_TRANSLATE_NOOP("QXml", "error occurred while parsing reference") -
75#define XMLERR_INTERNALGENERALENTITYINDTD QT_TRANSLATE_NOOP("QXml", "internal general entity reference not allowed in DTD") -
76#define XMLERR_EXTERNALGENERALENTITYINAV QT_TRANSLATE_NOOP("QXml", "external parsed general entity reference not allowed in attribute value") -
77#define XMLERR_EXTERNALGENERALENTITYINDTD QT_TRANSLATE_NOOP("QXml", "external parsed general entity reference not allowed in DTD") -
78#define XMLERR_UNPARSEDENTITYREFERENCE QT_TRANSLATE_NOOP("QXml", "unparsed entity reference in wrong context") -
79#define XMLERR_RECURSIVEENTITIES QT_TRANSLATE_NOOP("QXml", "recursive entities") -
80#define XMLERR_ERRORINTEXTDECL QT_TRANSLATE_NOOP("QXml", "error in the text declaration of an external entity") -
81 -
82QT_BEGIN_NAMESPACE -
83 -
84// the constants for the lookup table -
85static const signed char cltWS = 0; // white space -
86static const signed char cltPer = 1; // % -
87static const signed char cltAmp = 2; // & -
88static const signed char cltGt = 3; // > -
89static const signed char cltLt = 4; // < -
90static const signed char cltSlash = 5; // / -
91static const signed char cltQm = 6; // ? -
92static const signed char cltEm = 7; // ! -
93static const signed char cltDash = 8; // - -
94static const signed char cltCB = 9; // ] -
95static const signed char cltOB = 10; // [ -
96static const signed char cltEq = 11; // = -
97static const signed char cltDq = 12; // " -
98static const signed char cltSq = 13; // ' -
99static const signed char cltUnknown = 14; -
100 -
101// Hack for letting QDom know where the skipped entity occurred -
102// ### the use of this variable means the code isn't reentrant. -
103bool qt_xml_skipped_entity_in_content; -
104 -
105// character lookup table -
106static const signed char charLookupTable[256]={ -
107 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x00 - 0x07 -
108 cltUnknown, // 0x08 -
109 cltWS, // 0x09 \t -
110 cltWS, // 0x0A \n -
111 cltUnknown, // 0x0B -
112 cltUnknown, // 0x0C -
113 cltWS, // 0x0D \r -
114 cltUnknown, // 0x0E -
115 cltUnknown, // 0x0F -
116 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x17 - 0x16 -
117 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x18 - 0x1F -
118 cltWS, // 0x20 Space -
119 cltEm, // 0x21 ! -
120 cltDq, // 0x22 " -
121 cltUnknown, // 0x23 -
122 cltUnknown, // 0x24 -
123 cltPer, // 0x25 % -
124 cltAmp, // 0x26 & -
125 cltSq, // 0x27 ' -
126 cltUnknown, // 0x28 -
127 cltUnknown, // 0x29 -
128 cltUnknown, // 0x2A -
129 cltUnknown, // 0x2B -
130 cltUnknown, // 0x2C -
131 cltDash, // 0x2D - -
132 cltUnknown, // 0x2E -
133 cltSlash, // 0x2F / -
134 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x30 - 0x37 -
135 cltUnknown, // 0x38 -
136 cltUnknown, // 0x39 -
137 cltUnknown, // 0x3A -
138 cltUnknown, // 0x3B -
139 cltLt, // 0x3C < -
140 cltEq, // 0x3D = -
141 cltGt, // 0x3E > -
142 cltQm, // 0x3F ? -
143 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x40 - 0x47 -
144 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x48 - 0x4F -
145 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x50 - 0x57 -
146 cltUnknown, // 0x58 -
147 cltUnknown, // 0x59 -
148 cltUnknown, // 0x5A -
149 cltOB, // 0x5B [ -
150 cltUnknown, // 0x5C -
151 cltCB, // 0x5D] -
152 cltUnknown, // 0x5E -
153 cltUnknown, // 0x5F -
154 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x60 - 0x67 -
155 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x68 - 0x6F -
156 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x70 - 0x77 -
157 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x78 - 0x7F -
158 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x80 - 0x87 -
159 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x88 - 0x8F -
160 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x90 - 0x97 -
161 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x98 - 0x9F -
162 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xA0 - 0xA7 -
163 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xA8 - 0xAF -
164 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xB0 - 0xB7 -
165 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xB8 - 0xBF -
166 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xC0 - 0xC7 -
167 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xC8 - 0xCF -
168 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xD0 - 0xD7 -
169 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xD8 - 0xDF -
170 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xE0 - 0xE7 -
171 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xE8 - 0xEF -
172 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0xF0 - 0xF7 -
173 cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown // 0xF8 - 0xFF -
174}; -
175 -
176// -
177// local helper functions -
178// -
179 -
180/* -
181 This function strips the TextDecl [77] ("<?xml ...?>") from the string \a -
182 str. The stripped version is stored in \a str. If this function finds an -
183 invalid TextDecl, it returns false, otherwise true. -
184 -
185 This function is used for external entities since those can include an -
186 TextDecl that must be stripped before inserting the entity. -
187*/ -
188static bool stripTextDecl(QString& str) -
189{ -
190 QString textDeclStart(QLatin1String("<?xml"));
never executed (the execution status of this line is deduced): QString textDeclStart(QLatin1String("<?xml"));
-
191 if (str.startsWith(textDeclStart)) {
never evaluated: str.startsWith(textDeclStart)
0
192 QRegExp textDecl(QString::fromLatin1(
never executed (the execution status of this line is deduced): QRegExp textDecl(QString::fromLatin1(
-
193 "^<\\?xml\\s+"
never executed (the execution status of this line is deduced): "^<\\?xml\\s+"
-
194 "(version\\s*=\\s*((['\"])[-a-zA-Z0-9_.:]+\\3))?"
never executed (the execution status of this line is deduced): "(version\\s*=\\s*((['\"])[-a-zA-Z0-9_.:]+\\3))?"
-
195 "\\s*"
never executed (the execution status of this line is deduced): "\\s*"
-
196 "(encoding\\s*=\\s*((['\"])[A-Za-z][-a-zA-Z0-9_.]*\\6))?"
never executed (the execution status of this line is deduced): "(encoding\\s*=\\s*((['\"])[A-Za-z][-a-zA-Z0-9_.]*\\6))?"
-
197 "\\s*\\?>"
never executed (the execution status of this line is deduced): "\\s*\\?>"
-
198 ));
never executed (the execution status of this line is deduced): ));
-
199 QString strTmp = str.replace(textDecl, QLatin1String(""));
never executed (the execution status of this line is deduced): QString strTmp = str.replace(textDecl, QLatin1String(""));
-
200 if (strTmp.length() != str.length())
never evaluated: strTmp.length() != str.length()
0
201 return false; // external entity has wrong TextDecl
never executed: return false;
0
202 str = strTmp;
never executed (the execution status of this line is deduced): str = strTmp;
-
203 }
never executed: }
0
204 return true;
never executed: return true;
0
205} -
206 -
207 -
208class QXmlAttributesPrivate -
209{ -
210}; -
211 -
212/* \class QXmlInputSourcePrivate -
213 \internal -
214 -
215 There's a slight misdesign in this class that can -
216 be worth to keep in mind: the `str' member is -
217 a buffer which QXmlInputSource::next() returns from, -
218 and which is populated from the input device or input -
219 stream. However, when the input is a QString(the user called -
220 QXmlInputSource::setData()), `str' has two roles: it's the -
221 buffer, but also the source. This /seems/ to be no problem -
222 because in the case of having no device or stream, the QString -
223 is read in one go. -
224 */ -
225class QXmlInputSourcePrivate -
226{ -
227public: -
228 QIODevice *inputDevice; -
229 QTextStream *inputStream; -
230 -
231 QString str; -
232 const QChar *unicode; -
233 int pos; -
234 int length; -
235 bool nextReturnedEndOfData; -
236#ifndef QT_NO_TEXTCODEC -
237 QTextDecoder *encMapper; -
238#endif -
239 -
240 QByteArray encodingDeclBytes; -
241 QString encodingDeclChars; -
242 bool lookingForEncodingDecl; -
243}; -
244class QXmlParseExceptionPrivate -
245{ -
246public: -
247 QXmlParseExceptionPrivate() -
248 : column(-1), line(-1) -
249 { -
250 }
executed: }
Execution Count:159
159
251 QXmlParseExceptionPrivate(const QXmlParseExceptionPrivate &other) -
252 : msg(other.msg), column(other.column), line(other.line), -
253 pub(other.pub), sys(other.sys) -
254 { -
255 }
executed: }
Execution Count:2
2
256 -
257 QString msg; -
258 int column; -
259 int line; -
260 QString pub; -
261 QString sys; -
262 -
263}; -
264 -
265class QXmlLocatorPrivate -
266{ -
267}; -
268 -
269class QXmlDefaultHandlerPrivate -
270{ -
271}; -
272 -
273class QXmlSimpleReaderPrivate -
274{ -
275public: -
276 ~QXmlSimpleReaderPrivate(); -
277private: -
278 // functions -
279 QXmlSimpleReaderPrivate(QXmlSimpleReader *reader); -
280 void initIncrementalParsing(); -
281 -
282 // used to determine if elements are correctly nested -
283 QStack<QString> tags; -
284 -
285 // used by parseReference() and parsePEReference() -
286 enum EntityRecognitionContext { InContent, InAttributeValue, InEntityValue, InDTD }; -
287 -
288 // used for entity declarations -
289 struct ExternParameterEntity -
290 { -
291 ExternParameterEntity() {} -
292 ExternParameterEntity(const QString &p, const QString &s) -
293 : publicId(p), systemId(s) {}
executed: }
Execution Count:62
62
294 QString publicId; -
295 QString systemId; -
296 -
297 Q_DUMMY_COMPARISON_OPERATOR(ExternParameterEntity) -
298 }; -
299 struct ExternEntity -
300 { -
301 ExternEntity() {} -
302 ExternEntity(const QString &p, const QString &s, const QString &n) -
303 : publicId(p), systemId(s), notation(n) {}
executed: }
Execution Count:188
188
304 QString publicId; -
305 QString systemId; -
306 QString notation; -
307 Q_DUMMY_COMPARISON_OPERATOR(ExternEntity) -
308 }; -
309 QMap<QString,ExternParameterEntity> externParameterEntities; -
310 QMap<QString,QString> parameterEntities; -
311 QMap<QString,ExternEntity> externEntities; -
312 QMap<QString,QString> entities; -
313 -
314 // used for parsing of entity references -
315 struct XmlRef { -
316 XmlRef() -
317 : index(0) {}
never executed: }
0
318 XmlRef(const QString &_name, const QString &_value) -
319 : name(_name), value(_value), index(0) {}
executed: }
Execution Count:2826
2826
320 bool isEmpty() const { return index == value.length(); }
executed: return index == value.length();
Execution Count:14221
14221
321 QChar next() { return value.at(index++); }
executed: return value.at(index++);
Execution Count:11417
11417
322 QString name; -
323 QString value; -
324 int index; -
325 }; -
326 QStack<XmlRef> xmlRefStack; -
327 -
328 // used for standalone declaration -
329 enum Standalone { Yes, No, Unknown }; -
330 -
331 QString doctype; // only used for the doctype -
332 QString xmlVersion; // only used to store the version information -
333 QString encoding; // only used to store the encoding -
334 Standalone standalone; // used to store the value of the standalone declaration -
335 -
336 QString publicId; // used by parseExternalID() to store the public ID -
337 QString systemId; // used by parseExternalID() to store the system ID -
338 -
339 // Since publicId/systemId is used as temporary variables by parseExternalID(), it -
340 // might overwrite the PUBLIC/SYSTEM for the document we're parsing. In effect, we would -
341 // possibly send off an QXmlParseException that has the PUBLIC/SYSTEM of a entity declaration -
342 // instead of those of the current document. -
343 // Hence we have these two variables for storing the document's data. -
344 QString thisPublicId; -
345 QString thisSystemId; -
346 -
347 QString attDeclEName; // use by parseAttlistDecl() -
348 QString attDeclAName; // use by parseAttlistDecl() -
349 -
350 // flags for some features support -
351 bool useNamespaces; -
352 bool useNamespacePrefixes; -
353 bool reportWhitespaceCharData; -
354 bool reportEntities; -
355 -
356 // used to build the attribute list -
357 QXmlAttributes attList; -
358 -
359 // used in QXmlSimpleReader::parseContent() to decide whether character -
360 // data was read -
361 bool contentCharDataRead; -
362 -
363 // helper classes -
364 QScopedPointer<QXmlLocator> locator; -
365 QXmlNamespaceSupport namespaceSupport; -
366 -
367 // error string -
368 QString error; -
369 -
370 // arguments for parse functions (this is needed to allow incremental -
371 // parsing) -
372 bool parsePI_xmldecl; -
373 bool parseName_useRef; -
374 bool parseReference_charDataRead; -
375 EntityRecognitionContext parseReference_context; -
376 bool parseExternalID_allowPublicID; -
377 EntityRecognitionContext parsePEReference_context; -
378 QString parseString_s; -
379 -
380 // for incremental parsing -
381 struct ParseState { -
382 typedef bool (QXmlSimpleReaderPrivate::*ParseFunction)(); -
383 ParseFunction function; -
384 int state; -
385 }; -
386 QStack<ParseState> *parseStack; -
387 -
388 // used in parseProlog() -
389 bool xmldecl_possible; -
390 bool doctype_read; -
391 -
392 // used in parseDoctype() -
393 bool startDTDwasReported; -
394 -
395 // used in parseString() -
396 signed char Done; -
397 -
398 -
399 // variables -
400 QXmlContentHandler *contentHnd; -
401 QXmlErrorHandler *errorHnd; -
402 QXmlDTDHandler *dtdHnd; -
403 QXmlEntityResolver *entityRes; -
404 QXmlLexicalHandler *lexicalHnd; -
405 QXmlDeclHandler *declHnd; -
406 -
407 QXmlInputSource *inputSource; -
408 -
409 QChar c; // the character at reading position -
410 int lineNr; // number of line -
411 int columnNr; // position in line -
412 -
413 QChar nameArray[256]; // only used for names -
414 QString nameValue; // only used for names -
415 int nameArrayPos; -
416 int nameValueLen; -
417 QChar refArray[256]; // only used for references -
418 QString refValue; // only used for references -
419 int refArrayPos; -
420 int refValueLen; -
421 QChar stringArray[256]; // used for any other strings that are parsed -
422 QString stringValue; // used for any other strings that are parsed -
423 int stringArrayPos; -
424 int stringValueLen; -
425 QString emptyStr; -
426 -
427 const QString &string(); -
428 void stringClear(); -
429 void stringAddC(QChar); -
430 inline void stringAddC() { stringAddC(c); }
executed: }
Execution Count:2172170
2172170
431 const QString &name(); -
432 void nameClear(); -
433 void nameAddC(QChar); -
434 inline void nameAddC() { nameAddC(c); }
executed: }
Execution Count:448708
448708
435 const QString &ref(); -
436 void refClear(); -
437 void refAddC(QChar); -
438 inline void refAddC() { refAddC(c); }
executed: }
Execution Count:37949
37949
439 -
440 // private functions -
441 bool eat_ws(); -
442 bool next_eat_ws(); -
443 -
444 void QT_FASTCALL next(); -
445 bool atEnd(); -
446 -
447 void init(const QXmlInputSource* i); -
448 void initData(); -
449 -
450 bool entityExist(const QString&) const; -
451 -
452 bool parseBeginOrContinue(int state, bool incremental); -
453 -
454 bool parseProlog(); -
455 bool parseElement(); -
456 bool processElementEmptyTag(); -
457 bool processElementETagBegin2(); -
458 bool processElementAttribute(); -
459 bool parseMisc(); -
460 bool parseContent(); -
461 -
462 bool parsePI(); -
463 bool parseDoctype(); -
464 bool parseComment(); -
465 -
466 bool parseName(); -
467 bool parseNmtoken(); -
468 bool parseAttribute(); -
469 bool parseReference(); -
470 bool processReference(); -
471 -
472 bool parseExternalID(); -
473 bool parsePEReference(); -
474 bool parseMarkupdecl(); -
475 bool parseAttlistDecl(); -
476 bool parseAttType(); -
477 bool parseAttValue(); -
478 bool parseElementDecl(); -
479 bool parseNotationDecl(); -
480 bool parseChoiceSeq(); -
481 bool parseEntityDecl(); -
482 bool parseEntityValue(); -
483 -
484 bool parseString(); -
485 -
486 bool insertXmlRef(const QString&, const QString&, bool); -
487 -
488 bool reportEndEntities(); -
489 void reportParseError(const QString& error); -
490 -
491 typedef bool (QXmlSimpleReaderPrivate::*ParseFunction) (); -
492 void unexpectedEof(ParseFunction where, int state); -
493 void parseFailed(ParseFunction where, int state); -
494 void pushParseState(ParseFunction function, int state); -
495 -
496 Q_DECLARE_PUBLIC(QXmlSimpleReader) -
497 QXmlSimpleReader *q_ptr; -
498 -
499 friend class QXmlSimpleReaderLocator; -
500}; -
501 -
502/*! -
503 \class QXmlParseException -
504 \reentrant -
505 \brief The QXmlParseException class is used to report errors with -
506 the QXmlErrorHandler interface. -
507 -
508 \inmodule QtXml -
509 \ingroup xml-tools -
510 -
511 The XML subsystem constructs an instance of this class when it -
512 detects an error. You can retrieve the place where the error -
513 occurred using systemId(), publicId(), lineNumber() and -
514 columnNumber(), along with the error message(). The possible error -
515 messages are: -
516 -
517 -
518 \list -
519 \li "no error occurred" -
520 \li "error triggered by consumer" -
521 \li "unexpected end of file" -
522 \li "more than one document type definition" -
523 \li "error occurred while parsing element" -
524 \li "tag mismatch" -
525 \li "error occurred while parsing content" -
526 \li "unexpected character" -
527 \li "invalid name for processing instruction" -
528 \li "version expected while reading the XML declaration" -
529 \li "wrong value for standalone declaration" -
530 \li "encoding declaration or standalone declaration expected while reading the XML declaration" -
531 \li "standalone declaration expected while reading the XML declaration" -
532 \li "error occurred while parsing document type definition" -
533 \li "letter is expected" -
534 \li "error occurred while parsing comment" -
535 \li "error occurred while parsing reference" -
536 \li "internal general entity reference not allowed in DTD" -
537 \li "external parsed general entity reference not allowed in attribute value" -
538 \li "external parsed general entity reference not allowed in DTD" -
539 \li "unparsed entity reference n wrong context" -
540 \li "recursive entities" -
541 \li "error in the text declaration of an external entity" -
542 \endlist -
543 -
544 Note that, if you want to display these error messages to your -
545 application's users, they will be displayed in English unless -
546 they are explicitly translated. -
547 -
548 \sa QXmlErrorHandler, QXmlReader -
549*/ -
550 -
551/*! -
552 Constructs a parse exception with the error string \a name for -
553 column \a c and line \a l for the public identifier \a p and the -
554 system identifier \a s. -
555*/ -
556 -
557QXmlParseException::QXmlParseException(const QString& name, int c, int l, -
558 const QString& p, const QString& s) -
559 : d(new QXmlParseExceptionPrivate) -
560{ -
561 d->msg = name;
executed (the execution status of this line is deduced): d->msg = name;
-
562 d->column = c;
executed (the execution status of this line is deduced): d->column = c;
-
563 d->line = l;
executed (the execution status of this line is deduced): d->line = l;
-
564 d->pub = p;
executed (the execution status of this line is deduced): d->pub = p;
-
565 d->sys = s;
executed (the execution status of this line is deduced): d->sys = s;
-
566}
executed: }
Execution Count:159
159
567 -
568/*! -
569 Creates a copy of \a other. -
570*/ -
571QXmlParseException::QXmlParseException(const QXmlParseException& other) : -
572 d(new QXmlParseExceptionPrivate(*other.d)) -
573{ -
574 -
575}
executed: }
Execution Count:2
2
576 -
577/*! -
578 Destroys the QXmlParseException. -
579*/ -
580QXmlParseException::~QXmlParseException() -
581{ -
582} -
583 -
584/*! -
585 Returns the error message. -
586*/ -
587QString QXmlParseException::message() const -
588{ -
589 return d->msg;
executed: return d->msg;
Execution Count:299
299
590} -
591/*! -
592 Returns the column number where the error occurred. -
593*/ -
594int QXmlParseException::columnNumber() const -
595{ -
596 return d->column;
executed: return d->column;
Execution Count:299
299
597} -
598/*! -
599 Returns the line number where the error occurred. -
600*/ -
601int QXmlParseException::lineNumber() const -
602{ -
603 return d->line;
executed: return d->line;
Execution Count:299
299
604} -
605/*! -
606 Returns the public identifier where the error occurred. -
607*/ -
608QString QXmlParseException::publicId() const -
609{ -
610 return d->pub;
executed: return d->pub;
Execution Count:145
145
611} -
612/*! -
613 Returns the system identifier where the error occurred. -
614*/ -
615QString QXmlParseException::systemId() const -
616{ -
617 return d->sys;
executed: return d->sys;
Execution Count:145
145
618} -
619 -
620 -
621/*! -
622 \class QXmlLocator -
623 \reentrant -
624 \brief The QXmlLocator class provides the XML handler classes with -
625 information about the parsing position within a file. -
626 -
627 \inmodule QtXml -
628 \ingroup xml-tools -
629 -
630 The reader reports a QXmlLocator to the content handler before it -
631 starts to parse the document. This is done with the -
632 QXmlContentHandler::setDocumentLocator() function. The handler -
633 classes can now use this locator to get the position (lineNumber() -
634 and columnNumber()) that the reader has reached. -
635*/ -
636 -
637/*! -
638 Constructor. -
639*/ -
640QXmlLocator::QXmlLocator() -
641{ -
642} -
643 -
644/*! -
645 Destructor. -
646*/ -
647QXmlLocator::~QXmlLocator() -
648{ -
649} -
650 -
651/*! -
652 \fn int QXmlLocator::columnNumber() const -
653 -
654 Returns the column number (starting at 1) or -1 if there is no -
655 column number available. -
656*/ -
657 -
658/*! -
659 \fn int QXmlLocator::lineNumber() const -
660 -
661 Returns the line number (starting at 1) or -1 if there is no line -
662 number available. -
663*/ -
664 -
665class QXmlSimpleReaderLocator : public QXmlLocator -
666{ -
667public: -
668 QXmlSimpleReaderLocator(QXmlSimpleReader* parent) -
669 { -
670 reader = parent;
executed (the execution status of this line is deduced): reader = parent;
-
671 }
executed: }
Execution Count:2247
2247
672 ~QXmlSimpleReaderLocator() -
673 { -
674 } -
675 -
676 int columnNumber() const -
677 { -
678 return (reader->d_ptr->columnNr == -1 ? -1 : reader->d_ptr->columnNr + 1);
executed: return (reader->d_ptr->columnNr == -1 ? -1 : reader->d_ptr->columnNr + 1);
Execution Count:78305
78305
679 } -
680 int lineNumber() const -
681 { -
682 return (reader->d_ptr->lineNr == -1 ? -1 : reader->d_ptr->lineNr + 1);
executed: return (reader->d_ptr->lineNr == -1 ? -1 : reader->d_ptr->lineNr + 1);
Execution Count:78305
78305
683 } -
684// QString getPublicId() -
685// QString getSystemId() -
686 -
687private: -
688 QXmlSimpleReader *reader; -
689}; -
690 -
691/********************************************* -
692 * -
693 * QXmlNamespaceSupport -
694 * -
695 *********************************************/ -
696 -
697typedef QMap<QString, QString> NamespaceMap; -
698 -
699class QXmlNamespaceSupportPrivate -
700{ -
701public: -
702 QXmlNamespaceSupportPrivate() -
703 { -
704 ns.insert(QLatin1String("xml"), QLatin1String("http://www.w3.org/XML/1998/namespace")); // the XML namespace
executed (the execution status of this line is deduced): ns.insert(QLatin1String("xml"), QLatin1String("http://www.w3.org/XML/1998/namespace"));
-
705 }
executed: }
Execution Count:2247
2247
706 -
707 ~QXmlNamespaceSupportPrivate() -
708 { -
709 } -
710 -
711 QStack<NamespaceMap> nsStack; -
712 NamespaceMap ns; -
713}; -
714 -
715/*! -
716 \class QXmlNamespaceSupport -
717 \since 4.4 -
718 \reentrant -
719 \brief The QXmlNamespaceSupport class is a helper class for XML -
720 readers which want to include namespace support. -
721 -
722 \inmodule QtXml -
723 \ingroup xml-tools -
724 -
725 You can set the prefix for the current namespace with setPrefix(), -
726 and get the list of current prefixes (or those for a given URI) -
727 with prefixes(). The namespace URI is available from uri(). Use -
728 pushContext() to start a new namespace context, and popContext() -
729 to return to the previous namespace context. Use splitName() or -
730 processName() to split a name into its prefix and local name. -
731 -
732 \sa {Namespace Support via Features} -
733*/ -
734 -
735/*! -
736 Constructs a QXmlNamespaceSupport. -
737*/ -
738QXmlNamespaceSupport::QXmlNamespaceSupport() -
739{ -
740 d = new QXmlNamespaceSupportPrivate;
executed (the execution status of this line is deduced): d = new QXmlNamespaceSupportPrivate;
-
741}
executed: }
Execution Count:2247
2247
742 -
743/*! -
744 Destroys a QXmlNamespaceSupport. -
745*/ -
746QXmlNamespaceSupport::~QXmlNamespaceSupport() -
747{ -
748 delete d;
executed (the execution status of this line is deduced): delete d;
-
749}
executed: }
Execution Count:2247
2247
750 -
751/*! -
752 This function declares a prefix \a pre in the current namespace -
753 context to be the namespace URI \a uri. The prefix remains in -
754 force until this context is popped, unless it is shadowed in a -
755 descendant context. -
756 -
757 Note that there is an asymmetry in this library. prefix() does not -
758 return the default "" prefix, even if you have declared one; to -
759 check for a default prefix, you must look it up explicitly using -
760 uri(). This asymmetry exists to make it easier to look up prefixes -
761 for attribute names, where the default prefix is not allowed. -
762*/ -
763void QXmlNamespaceSupport::setPrefix(const QString& pre, const QString& uri) -
764{ -
765 if(pre.isNull()) {
evaluated: pre.isNull()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:14
5-14
766 d->ns.insert(QLatin1String(""), uri);
executed (the execution status of this line is deduced): d->ns.insert(QLatin1String(""), uri);
-
767 } else {
executed: }
Execution Count:5
5
768 d->ns.insert(pre, uri);
executed (the execution status of this line is deduced): d->ns.insert(pre, uri);
-
769 }
executed: }
Execution Count:14
14
770} -
771 -
772/*! -
773 Returns one of the prefixes mapped to the namespace URI \a uri. -
774 -
775 If more than one prefix is currently mapped to the same URI, this -
776 function makes an arbitrary selection; if you want all of the -
777 prefixes, use prefixes() instead. -
778 -
779 Note: to check for a default prefix, use the uri() function with -
780 an argument of "". -
781*/ -
782QString QXmlNamespaceSupport::prefix(const QString& uri) const -
783{ -
784 NamespaceMap::const_iterator itc, it = d->ns.constBegin();
never executed (the execution status of this line is deduced): NamespaceMap::const_iterator itc, it = d->ns.constBegin();
-
785 while ((itc=it) != d->ns.constEnd()) {
never evaluated: (itc=it) != d->ns.constEnd()
0
786 ++it;
never executed (the execution status of this line is deduced): ++it;
-
787 if (*itc == uri && !itc.key().isEmpty())
never evaluated: *itc == uri
never evaluated: !itc.key().isEmpty()
0
788 return itc.key();
never executed: return itc.key();
0
789 }
never executed: }
0
790 return QLatin1String("");
never executed: return QLatin1String("");
0
791} -
792 -
793/*! -
794 Looks up the prefix \a prefix in the current context and returns -
795 the currently-mapped namespace URI. Use the empty string ("") for -
796 the default namespace. -
797*/ -
798QString QXmlNamespaceSupport::uri(const QString& prefix) const -
799{ -
800 return d->ns[prefix];
executed: return d->ns[prefix];
Execution Count:46
46
801} -
802 -
803/*! -
804 Splits the name \a qname at the ':' and returns the prefix in \a -
805 prefix and the local name in \a localname. -
806 -
807 \sa processName() -
808*/ -
809void QXmlNamespaceSupport::splitName(const QString& qname, QString& prefix, -
810 QString& localname) const -
811{ -
812 int pos = qname.indexOf(QLatin1Char(':'));
executed (the execution status of this line is deduced): int pos = qname.indexOf(QLatin1Char(':'));
-
813 if (pos == -1)
evaluated: pos == -1
TRUEFALSE
yes
Evaluation Count:12005
yes
Evaluation Count:48
48-12005
814 pos = qname.size();
executed: pos = qname.size();
Execution Count:12005
12005
815 -
816 prefix = qname.left(pos);
executed (the execution status of this line is deduced): prefix = qname.left(pos);
-
817 localname = qname.mid(pos+1);
executed (the execution status of this line is deduced): localname = qname.mid(pos+1);
-
818}
executed: }
Execution Count:12053
12053
819 -
820/*! -
821 Processes a raw XML 1.0 name in the current context by removing -
822 the prefix and looking it up among the prefixes currently -
823 declared. -
824 -
825 \a qname is the raw XML 1.0 name to be processed. \a isAttribute -
826 is true if the name is an attribute name. -
827 -
828 This function stores the namespace URI in \a nsuri (which will be -
829 set to an empty string if the raw name has an undeclared prefix), -
830 and stores the local name (without prefix) in \a localname (which -
831 will be set to an empty string if no namespace is in use). -
832 -
833 Note that attribute names are processed differently than element -
834 names: an unprefixed element name gets the default namespace (if -
835 any), while an unprefixed attribute name does not. -
836*/ -
837void QXmlNamespaceSupport::processName(const QString& qname, -
838 bool isAttribute, -
839 QString& nsuri, QString& localname) const -
840{ -
841 int len = qname.size();
executed (the execution status of this line is deduced): int len = qname.size();
-
842 const QChar *data = qname.constData();
executed (the execution status of this line is deduced): const QChar *data = qname.constData();
-
843 for (int pos = 0; pos < len; ++pos) {
evaluated: pos < len
TRUEFALSE
yes
Evaluation Count:96816
yes
Evaluation Count:21326
21326-96816
844 if (data[pos] == QLatin1Char(':')) {
evaluated: data[pos] == QLatin1Char(':')
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:96770
46-96770
845 nsuri = uri(qname.left(pos));
executed (the execution status of this line is deduced): nsuri = uri(qname.left(pos));
-
846 localname = qname.mid(pos + 1);
executed (the execution status of this line is deduced): localname = qname.mid(pos + 1);
-
847 return;
executed: return;
Execution Count:46
46
848 } -
849 }
executed: }
Execution Count:96770
96770
850 -
851 // there was no ':' -
852 nsuri.clear();
executed (the execution status of this line is deduced): nsuri.clear();
-
853 // attributes don't take default namespace -
854 if (!isAttribute && !d->ns.isEmpty()) {
evaluated: !isAttribute
TRUEFALSE
yes
Evaluation Count:9326
yes
Evaluation Count:12000
partially evaluated: !d->ns.isEmpty()
TRUEFALSE
yes
Evaluation Count:9326
no
Evaluation Count:0
0-12000
855 /* -
856 We want to access d->ns.value(""), but as an optimization -
857 we use the fact that "" compares less than any other -
858 string, so it's either first in the map or not there. -
859 */ -
860 NamespaceMap::const_iterator first = d->ns.constBegin();
executed (the execution status of this line is deduced): NamespaceMap::const_iterator first = d->ns.constBegin();
-
861 if (first.key().isEmpty())
evaluated: first.key().isEmpty()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:9301
25-9301
862 nsuri = first.value(); // get default namespace
executed: nsuri = first.value();
Execution Count:25
25
863 }
executed: }
Execution Count:9326
9326
864 localname = qname;
executed (the execution status of this line is deduced): localname = qname;
-
865}
executed: }
Execution Count:21326
21326
866 -
867/*! -
868 Returns a list of all the prefixes currently declared. -
869 -
870 If there is a default prefix, this function does not return it in -
871 the list; check for the default prefix using uri() with an -
872 argument of "". -
873*/ -
874QStringList QXmlNamespaceSupport::prefixes() const -
875{ -
876 QStringList list;
executed (the execution status of this line is deduced): QStringList list;
-
877 -
878 NamespaceMap::const_iterator itc, it = d->ns.constBegin();
executed (the execution status of this line is deduced): NamespaceMap::const_iterator itc, it = d->ns.constBegin();
-
879 while ((itc=it) != d->ns.constEnd()) {
evaluated: (itc=it) != d->ns.constEnd()
TRUEFALSE
yes
Evaluation Count:473
yes
Evaluation Count:458
458-473
880 ++it;
executed (the execution status of this line is deduced): ++it;
-
881 if (!itc.key().isEmpty())
evaluated: !itc.key().isEmpty()
TRUEFALSE
yes
Evaluation Count:472
yes
Evaluation Count:1
1-472
882 list.append(itc.key());
executed: list.append(itc.key());
Execution Count:472
472
883 }
executed: }
Execution Count:473
473
884 return list;
executed: return list;
Execution Count:458
458
885} -
886 -
887/*! -
888 \overload -
889 -
890 Returns a list of all prefixes currently declared for the -
891 namespace URI \a uri. -
892 -
893 The "xml:" prefix is included. If you only want one prefix that is -
894 mapped to the namespace URI, and you don't care which one you get, -
895 use the prefix() function instead. -
896 -
897 Note: The empty (default) prefix is never included in this list; -
898 to check for the presence of a default namespace, call uri() with -
899 "" as the argument. -
900*/ -
901QStringList QXmlNamespaceSupport::prefixes(const QString& uri) const -
902{ -
903 QStringList list;
never executed (the execution status of this line is deduced): QStringList list;
-
904 -
905 NamespaceMap::const_iterator itc, it = d->ns.constBegin();
never executed (the execution status of this line is deduced): NamespaceMap::const_iterator itc, it = d->ns.constBegin();
-
906 while ((itc=it) != d->ns.constEnd()) {
never evaluated: (itc=it) != d->ns.constEnd()
0
907 ++it;
never executed (the execution status of this line is deduced): ++it;
-
908 if (*itc == uri && !itc.key().isEmpty())
never evaluated: *itc == uri
never evaluated: !itc.key().isEmpty()
0
909 list.append(itc.key());
never executed: list.append(itc.key());
0
910 }
never executed: }
0
911 return list;
never executed: return list;
0
912} -
913 -
914/*! -
915 Starts a new namespace context. -
916 -
917 Normally, you should push a new context at the beginning of each -
918 XML element: the new context automatically inherits the -
919 declarations of its parent context, and it also keeps track of -
920 which declarations were made within this context. -
921 -
922 \sa popContext() -
923*/ -
924void QXmlNamespaceSupport::pushContext() -
925{ -
926 d->nsStack.push(d->ns);
executed (the execution status of this line is deduced): d->nsStack.push(d->ns);
-
927}
executed: }
Execution Count:4841
4841
928 -
929/*! -
930 Reverts to the previous namespace context. -
931 -
932 Normally, you should pop the context at the end of each XML -
933 element. After popping the context, all namespace prefix mappings -
934 that were previously in force are restored. -
935 -
936 \sa pushContext() -
937*/ -
938void QXmlNamespaceSupport::popContext() -
939{ -
940 d->ns.clear();
executed (the execution status of this line is deduced): d->ns.clear();
-
941 if(!d->nsStack.isEmpty())
partially evaluated: !d->nsStack.isEmpty()
TRUEFALSE
yes
Evaluation Count:4769
no
Evaluation Count:0
0-4769
942 d->ns = d->nsStack.pop();
executed: d->ns = d->nsStack.pop();
Execution Count:4769
4769
943}
executed: }
Execution Count:4769
4769
944 -
945/*! -
946 Resets this namespace support object ready for reuse. -
947*/ -
948void QXmlNamespaceSupport::reset() -
949{ -
950 QXmlNamespaceSupportPrivate *newD = new QXmlNamespaceSupportPrivate;
never executed (the execution status of this line is deduced): QXmlNamespaceSupportPrivate *newD = new QXmlNamespaceSupportPrivate;
-
951 delete d;
never executed (the execution status of this line is deduced): delete d;
-
952 d = newD;
never executed (the execution status of this line is deduced): d = newD;
-
953}
never executed: }
0
954 -
955 -
956 -
957/********************************************* -
958 * -
959 * QXmlAttributes -
960 * -
961 *********************************************/ -
962 -
963/*! -
964 \class QXmlAttributes -
965 \reentrant -
966 \brief The QXmlAttributes class provides XML attributes. -
967 -
968 \inmodule QtXml -
969 \ingroup xml-tools -
970 -
971 If attributes are reported by QXmlContentHandler::startElement() -
972 this class is used to pass the attribute values. -
973 -
974 Use index() to locate the position of an attribute in the list, -
975 count() to retrieve the number of attributes, and clear() to -
976 remove the attributes. New attributes can be added with append(). -
977 Use type() to get an attribute's type and value() to get its -
978 value. The attribute's name is available from localName() or -
979 qName(), and its namespace URI from uri(). -
980 -
981*/ -
982 -
983/*! -
984 \fn QXmlAttributes::QXmlAttributes() -
985 -
986 Constructs an empty attribute list. -
987*/ -
988 -
989/*! -
990 \fn QXmlAttributes::~QXmlAttributes() -
991 -
992 Destroys the attributes object. -
993*/ -
994 -
995/*! -
996 Looks up the index of an attribute by the qualified name \a qName. -
997 -
998 Returns the index of the attribute or -1 if it wasn't found. -
999 -
1000 \sa {Namespace Support via Features} -
1001*/ -
1002int QXmlAttributes::index(const QString& qName) const -
1003{ -
1004 for (int i = 0; i < attList.size(); ++i) {
never evaluated: i < attList.size()
0
1005 if (attList.at(i).qname == qName)
never evaluated: attList.at(i).qname == qName
0
1006 return i;
never executed: return i;
0
1007 }
never executed: }
0
1008 return -1;
never executed: return -1;
0
1009} -
1010 -
1011/*! \overload -
1012 */ -
1013int QXmlAttributes::index(QLatin1String qName) const -
1014{ -
1015 for (int i = 0; i < attList.size(); ++i) {
evaluated: i < attList.size()
TRUEFALSE
yes
Evaluation Count:11810
yes
Evaluation Count:2589
2589-11810
1016 if (attList.at(i).qname == qName)
evaluated: attList.at(i).qname == qName
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:11786
24-11786
1017 return i;
executed: return i;
Execution Count:24
24
1018 }
executed: }
Execution Count:11786
11786
1019 return -1;
executed: return -1;
Execution Count:2589
2589
1020} -
1021 -
1022/*! -
1023 \overload -
1024 -
1025 Looks up the index of an attribute by a namespace name. -
1026 -
1027 \a uri specifies the namespace URI, or an empty string if the name -
1028 has no namespace URI. \a localPart specifies the attribute's local -
1029 name. -
1030 -
1031 Returns the index of the attribute, or -1 if it wasn't found. -
1032 -
1033 \sa {Namespace Support via Features} -
1034*/ -
1035int QXmlAttributes::index(const QString& uri, const QString& localPart) const -
1036{ -
1037 for (int i = 0; i < attList.size(); ++i) {
evaluated: i < attList.size()
TRUEFALSE
yes
Evaluation Count:51512
yes
Evaluation Count:5843
5843-51512
1038 const Attribute &att = attList.at(i);
executed (the execution status of this line is deduced): const Attribute &att = attList.at(i);
-
1039 if (att.uri == uri && att.localname == localPart)
partially evaluated: att.uri == uri
TRUEFALSE
yes
Evaluation Count:51512
no
Evaluation Count:0
evaluated: att.localname == localPart
TRUEFALSE
yes
Evaluation Count:8130
yes
Evaluation Count:43382
0-51512
1040 return i;
executed: return i;
Execution Count:8130
8130
1041 }
executed: }
Execution Count:43382
43382
1042 return -1;
executed: return -1;
Execution Count:5843
5843
1043} -
1044 -
1045/*! -
1046 Returns the number of attributes in the list. -
1047 -
1048 \sa count() -
1049*/ -
1050int QXmlAttributes::length() const -
1051{ -
1052 return attList.count();
executed: return attList.count();
Execution Count:56766
56766
1053} -
1054 -
1055/*! -
1056 \fn int QXmlAttributes::count() const -
1057 -
1058 Returns the number of attributes in the list. This function is -
1059 equivalent to length(). -
1060*/ -
1061 -
1062/*! -
1063 Looks up an attribute's local name for the attribute at position -
1064 \a index. If no namespace processing is done, the local name is -
1065 an empty string. -
1066 -
1067 \sa {Namespace Support via Features} -
1068*/ -
1069QString QXmlAttributes::localName(int index) const -
1070{ -
1071 return attList.at(index).localname;
executed: return attList.at(index).localname;
Execution Count:408
408
1072} -
1073 -
1074/*! -
1075 Looks up an attribute's XML 1.0 qualified name for the attribute -
1076 at position \a index. -
1077 -
1078 \sa {Namespace Support via Features} -
1079*/ -
1080QString QXmlAttributes::qName(int index) const -
1081{ -
1082 return attList.at(index).qname;
executed: return attList.at(index).qname;
Execution Count:17161
17161
1083} -
1084 -
1085/*! -
1086 Looks up an attribute's namespace URI for the attribute at -
1087 position \a index. If no namespace processing is done or if the -
1088 attribute has no namespace, the namespace URI is an empty string. -
1089 -
1090 \sa {Namespace Support via Features} -
1091*/ -
1092QString QXmlAttributes::uri(int index) const -
1093{ -
1094 return attList.at(index).uri;
executed: return attList.at(index).uri;
Execution Count:421
421
1095} -
1096 -
1097/*! -
1098 Looks up an attribute's type for the attribute at position \a -
1099 index. -
1100 -
1101 Currently only "CDATA" is returned. -
1102*/ -
1103QString QXmlAttributes::type(int) const -
1104{ -
1105 return QLatin1String("CDATA");
executed: return QLatin1String("CDATA");
Execution Count:408
408
1106} -
1107 -
1108/*! -
1109 \overload -
1110 -
1111 Looks up an attribute's type for the qualified name \a qName. -
1112 -
1113 Currently only "CDATA" is returned. -
1114*/ -
1115QString QXmlAttributes::type(const QString&) const -
1116{ -
1117 return QLatin1String("CDATA");
never executed: return QLatin1String("CDATA");
0
1118} -
1119 -
1120/*! -
1121 \overload -
1122 -
1123 Looks up an attribute's type by namespace name. -
1124 -
1125 \a uri specifies the namespace URI and \a localName specifies the -
1126 local name. If the name has no namespace URI, use an empty string -
1127 for \a uri. -
1128 -
1129 Currently only "CDATA" is returned. -
1130*/ -
1131QString QXmlAttributes::type(const QString&, const QString&) const -
1132{ -
1133 return QLatin1String("CDATA");
never executed: return QLatin1String("CDATA");
0
1134} -
1135 -
1136/*! -
1137 Returns an attribute's value for the attribute at position \a -
1138 index. The index must be a valid position -
1139 (i.e., 0 <= \a index < count()). -
1140*/ -
1141QString QXmlAttributes::value(int index) const -
1142{ -
1143 return attList.at(index).value;
executed: return attList.at(index).value;
Execution Count:17172
17172
1144} -
1145 -
1146/*! -
1147 \overload -
1148 -
1149 Returns an attribute's value for the qualified name \a qName, or an -
1150 empty string if no attribute exists for the name given. -
1151 -
1152 \sa {Namespace Support via Features} -
1153*/ -
1154QString QXmlAttributes::value(const QString& qName) const -
1155{ -
1156 int i = index(qName);
never executed (the execution status of this line is deduced): int i = index(qName);
-
1157 if (i == -1)
never evaluated: i == -1
0
1158 return QString();
never executed: return QString();
0
1159 return attList.at(i).value;
never executed: return attList.at(i).value;
0
1160} -
1161 -
1162/*! -
1163 \overload -
1164 -
1165 Returns an attribute's value for the qualified name \a qName, or an -
1166 empty string if no attribute exists for the name given. -
1167 -
1168 \sa {Namespace Support via Features} -
1169*/ -
1170QString QXmlAttributes::value(QLatin1String qName) const -
1171{ -
1172 int i = index(qName);
never executed (the execution status of this line is deduced): int i = index(qName);
-
1173 if (i == -1)
never evaluated: i == -1
0
1174 return QString();
never executed: return QString();
0
1175 return attList.at(i).value;
never executed: return attList.at(i).value;
0
1176} -
1177 -
1178/*! -
1179 \overload -
1180 -
1181 Returns an attribute's value by namespace name. -
1182 -
1183 \a uri specifies the namespace URI, or an empty string if the name -
1184 has no namespace URI. \a localName specifies the attribute's local -
1185 name. -
1186*/ -
1187QString QXmlAttributes::value(const QString& uri, const QString& localName) const -
1188{ -
1189 int i = index(uri, localName);
executed (the execution status of this line is deduced): int i = index(uri, localName);
-
1190 if (i == -1)
evaluated: i == -1
TRUEFALSE
yes
Evaluation Count:4320
yes
Evaluation Count:7751
4320-7751
1191 return QString();
executed: return QString();
Execution Count:4320
4320
1192 return attList.at(i).value;
executed: return attList.at(i).value;
Execution Count:7751
7751
1193} -
1194 -
1195/*! -
1196 Clears the list of attributes. -
1197 -
1198 \sa append() -
1199*/ -
1200void QXmlAttributes::clear() -
1201{ -
1202 attList.clear();
executed (the execution status of this line is deduced): attList.clear();
-
1203}
executed: }
Execution Count:42667
42667
1204 -
1205/*! -
1206 Appends a new attribute entry to the list of attributes. The -
1207 qualified name of the attribute is \a qName, the namespace URI is -
1208 \a uri and the local name is \a localPart. The value of the -
1209 attribute is \a value. -
1210 -
1211 \sa qName(), uri(), localName(), value() -
1212*/ -
1213void QXmlAttributes::append(const QString &qName, const QString &uri, const QString &localPart, const QString &value) -
1214{ -
1215 Attribute att;
executed (the execution status of this line is deduced): Attribute att;
-
1216 att.qname = qName;
executed (the execution status of this line is deduced): att.qname = qName;
-
1217 att.uri = uri;
executed (the execution status of this line is deduced): att.uri = uri;
-
1218 att.localname = localPart;
executed (the execution status of this line is deduced): att.localname = localPart;
-
1219 att.value = value;
executed (the execution status of this line is deduced): att.value = value;
-
1220 -
1221 attList.append(att);
executed (the execution status of this line is deduced): attList.append(att);
-
1222}
executed: }
Execution Count:28773
28773
1223 -
1224 -
1225/********************************************* -
1226 * -
1227 * QXmlInputSource -
1228 * -
1229 *********************************************/ -
1230 -
1231/*! -
1232 \class QXmlInputSource -
1233 \reentrant -
1234 \brief The QXmlInputSource class provides the input data for the -
1235 QXmlReader subclasses. -
1236 -
1237 \inmodule QtXml -
1238 \ingroup xml-tools -
1239 -
1240 All subclasses of QXmlReader read the input XML document from this -
1241 class. -
1242 -
1243 This class recognizes the encoding of the data by reading the -
1244 encoding declaration in the XML file if it finds one, and reading -
1245 the data using the corresponding encoding. If it does not find an -
1246 encoding declaration, then it assumes that the data is either in -
1247 UTF-8 or UTF-16, depending on whether it can find a byte-order -
1248 mark. -
1249 -
1250 There are two ways to populate the input source with data: you can -
1251 construct it with a QIODevice* so that the input source reads the -
1252 data from that device. Or you can set the data explicitly with one -
1253 of the setData() functions. -
1254 -
1255 Usually you either construct a QXmlInputSource that works on a -
1256 QIODevice* or you construct an empty QXmlInputSource and set the -
1257 data with setData(). There are only rare occasions where you would -
1258 want to mix both methods. -
1259 -
1260 The QXmlReader subclasses use the next() function to read the -
1261 input character by character. If you want to start from the -
1262 beginning again, use reset(). -
1263 -
1264 The functions data() and fetchData() are useful if you want to do -
1265 something with the data other than parsing, e.g. displaying the -
1266 raw XML file. The benefit of using the QXmlInputClass in such -
1267 cases is that it tries to use the correct encoding. -
1268 -
1269 \sa QXmlReader, QXmlSimpleReader -
1270*/ -
1271 -
1272// the following two are guaranteed not to be a character -
1273const ushort QXmlInputSource::EndOfData = 0xfffe; -
1274const ushort QXmlInputSource::EndOfDocument = 0xffff; -
1275 -
1276/* -
1277 Common part of the constructors. -
1278*/ -
1279void QXmlInputSource::init() -
1280{ -
1281 d = new QXmlInputSourcePrivate;
executed (the execution status of this line is deduced): d = new QXmlInputSourcePrivate;
-
1282 -
1283 QT_TRY {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:2245
no
Evaluation Count:0
0-2245
1284 d->inputDevice = 0;
executed (the execution status of this line is deduced): d->inputDevice = 0;
-
1285 d->inputStream = 0;
executed (the execution status of this line is deduced): d->inputStream = 0;
-
1286 -
1287 setData(QString());
executed (the execution status of this line is deduced): setData(QString());
-
1288#ifndef QT_NO_TEXTCODEC -
1289 d->encMapper = 0;
executed (the execution status of this line is deduced): d->encMapper = 0;
-
1290#endif -
1291 d->nextReturnedEndOfData = true; // first call to next() will call fetchData()
executed (the execution status of this line is deduced): d->nextReturnedEndOfData = true;
-
1292 -
1293 d->encodingDeclBytes.clear();
executed (the execution status of this line is deduced): d->encodingDeclBytes.clear();
-
1294 d->encodingDeclChars.clear();
executed (the execution status of this line is deduced): d->encodingDeclChars.clear();
-
1295 d->lookingForEncodingDecl = true;
executed (the execution status of this line is deduced): d->lookingForEncodingDecl = true;
-
1296 } QT_CATCH(...) {
executed: }
Execution Count:2245
2245
1297 delete(d);
never executed (the execution status of this line is deduced): delete(d);
-
1298 QT_RETHROW;
never executed (the execution status of this line is deduced): qt_noop();
-
1299 }
never executed: }
0
1300} -
1301 -
1302/*! -
1303 Constructs an input source which contains no data. -
1304 -
1305 \sa setData() -
1306*/ -
1307QXmlInputSource::QXmlInputSource() -
1308{ -
1309 init();
executed (the execution status of this line is deduced): init();
-
1310}
executed: }
Execution Count:1782
1782
1311 -
1312/*! -
1313 Constructs an input source and gets the data from device \a dev. -
1314 If \a dev is not open, it is opened in read-only mode. If \a dev -
1315 is 0 or it is not possible to read from the device, the input -
1316 source will contain no data. -
1317 -
1318 \sa setData(), fetchData(), QIODevice -
1319*/ -
1320QXmlInputSource::QXmlInputSource(QIODevice *dev) -
1321{ -
1322 init();
executed (the execution status of this line is deduced): init();
-
1323 d->inputDevice = dev;
executed (the execution status of this line is deduced): d->inputDevice = dev;
-
1324 if (dev->isOpen())
evaluated: dev->isOpen()
TRUEFALSE
yes
Evaluation Count:447
yes
Evaluation Count:16
16-447
1325 d->inputDevice->setTextModeEnabled(false);
executed: d->inputDevice->setTextModeEnabled(false);
Execution Count:447
447
1326}
executed: }
Execution Count:463
463
1327 -
1328/*! -
1329 Destructor. -
1330*/ -
1331QXmlInputSource::~QXmlInputSource() -
1332{ -
1333 // ### close the input device. -
1334#ifndef QT_NO_TEXTCODEC -
1335 delete d->encMapper;
executed (the execution status of this line is deduced): delete d->encMapper;
-
1336#endif -
1337 delete d;
executed (the execution status of this line is deduced): delete d;
-
1338}
executed: }
Execution Count:2245
2245
1339 -
1340/*! -
1341Returns the next character of the input source. If this function -
1342reaches the end of available data, it returns -
1343QXmlInputSource::EndOfData. If you call next() after that, it -
1344tries to fetch more data by calling fetchData(). If the -
1345fetchData() call results in new data, this function returns the -
1346first character of that data; otherwise it returns -
1347QXmlInputSource::EndOfDocument. -
1348 -
1349Readers, such as QXmlSimpleReader, will assume that the end of -
1350the XML document has been reached if the this function returns -
1351QXmlInputSource::EndOfDocument, and will check that the -
1352supplied input is well-formed. Therefore, when reimplementing -
1353this function, it is important to ensure that this behavior is -
1354duplicated. -
1355 -
1356\sa reset(), fetchData(), QXmlSimpleReader::parse(), -
1357 QXmlSimpleReader::parseContinue() -
1358*/ -
1359QChar QXmlInputSource::next() -
1360{ -
1361 if (d->pos >= d->length) {
evaluated: d->pos >= d->length
TRUEFALSE
yes
Evaluation Count:59811
yes
Evaluation Count:3167225
59811-3167225
1362 if (d->nextReturnedEndOfData) {
evaluated: d->nextReturnedEndOfData
TRUEFALSE
yes
Evaluation Count:8428
yes
Evaluation Count:51383
8428-51383
1363 d->nextReturnedEndOfData = false;
executed (the execution status of this line is deduced): d->nextReturnedEndOfData = false;
-
1364 fetchData();
executed (the execution status of this line is deduced): fetchData();
-
1365 if (d->pos >= d->length) {
evaluated: d->pos >= d->length
TRUEFALSE
yes
Evaluation Count:2098
yes
Evaluation Count:6330
2098-6330
1366 return EndOfDocument;
executed: return EndOfDocument;
Execution Count:2098
2098
1367 } -
1368 return next();
executed: return next();
Execution Count:6330
6330
1369 } -
1370 d->nextReturnedEndOfData = true;
executed (the execution status of this line is deduced): d->nextReturnedEndOfData = true;
-
1371 return EndOfData;
executed: return EndOfData;
Execution Count:51383
51383
1372 } -
1373 -
1374 // QXmlInputSource has no way to signal encoding errors. The best we can do -
1375 // is return EndOfDocument. We do *not* return EndOfData, because the reader -
1376 // will then just call this function again to get the next char. -
1377 QChar c = d->unicode[d->pos++];
executed (the execution status of this line is deduced): QChar c = d->unicode[d->pos++];
-
1378 if (c.unicode() == EndOfData)
partially evaluated: c.unicode() == EndOfData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3167225
0-3167225
1379 c = EndOfDocument;
never executed: c = EndOfDocument;
0
1380 return c;
executed: return c;
Execution Count:3167225
3167225
1381} -
1382 -
1383/*! -
1384 This function sets the position used by next() to the beginning of -
1385 the data returned by data(). This is useful if you want to use the -
1386 input source for more than one parse. -
1387 -
1388 \note In the case that the underlying data source is a QIODevice, -
1389 the current position in the device is not automatically set to the -
1390 start of input. Call QIODevice::seek(0) on the device to do this. -
1391 -
1392 \sa next() -
1393*/ -
1394void QXmlInputSource::reset() -
1395{ -
1396 d->nextReturnedEndOfData = false;
executed (the execution status of this line is deduced): d->nextReturnedEndOfData = false;
-
1397 d->pos = 0;
executed (the execution status of this line is deduced): d->pos = 0;
-
1398}
executed: }
Execution Count:4
4
1399 -
1400/*! -
1401 Returns the data the input source contains or an empty string if the -
1402 input source does not contain any data. -
1403 -
1404 \sa setData(), QXmlInputSource(), fetchData() -
1405*/ -
1406QString QXmlInputSource::data() const -
1407{ -
1408 if (d->nextReturnedEndOfData) {
partially evaluated: d->nextReturnedEndOfData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1409 QXmlInputSource *that = const_cast<QXmlInputSource*>(this);
never executed (the execution status of this line is deduced): QXmlInputSource *that = const_cast<QXmlInputSource*>(this);
-
1410 that->d->nextReturnedEndOfData = false;
never executed (the execution status of this line is deduced): that->d->nextReturnedEndOfData = false;
-
1411 that->fetchData();
never executed (the execution status of this line is deduced): that->fetchData();
-
1412 }
never executed: }
0
1413 return d->str;
executed: return d->str;
Execution Count:4
4
1414} -
1415 -
1416/*! -
1417 Sets the data of the input source to \a dat. -
1418 -
1419 If the input source already contains data, this function deletes -
1420 that data first. -
1421 -
1422 \sa data() -
1423*/ -
1424void QXmlInputSource::setData(const QString& dat) -
1425{ -
1426 d->str = dat;
executed (the execution status of this line is deduced): d->str = dat;
-
1427 d->unicode = dat.unicode();
executed (the execution status of this line is deduced): d->unicode = dat.unicode();
-
1428 d->pos = 0;
executed (the execution status of this line is deduced): d->pos = 0;
-
1429 d->length = d->str.length();
executed (the execution status of this line is deduced): d->length = d->str.length();
-
1430 d->nextReturnedEndOfData = false;
executed (the execution status of this line is deduced): d->nextReturnedEndOfData = false;
-
1431}
executed: }
Execution Count:54104
54104
1432 -
1433/*! -
1434 \overload -
1435 -
1436 The data \a dat is passed through the correct text-codec, before -
1437 it is set. -
1438*/ -
1439void QXmlInputSource::setData(const QByteArray& dat) -
1440{ -
1441 setData(fromRawData(dat));
executed (the execution status of this line is deduced): setData(fromRawData(dat));
-
1442}
executed: }
Execution Count:44909
44909
1443 -
1444/*! -
1445 This function reads more data from the device that was set during -
1446 construction. If the input source already contained data, this -
1447 function deletes that data first. -
1448 -
1449 This object contains no data after a call to this function if the -
1450 object was constructed without a device to read data from or if -
1451 this function was not able to get more data from the device. -
1452 -
1453 There are two occasions where a fetch is done implicitly by -
1454 another function call: during construction (so that the object -
1455 starts out with some initial data where available), and during a -
1456 call to next() (if the data had run out). -
1457 -
1458 You don't normally need to use this function if you use next(). -
1459 -
1460 \sa data(), next(), QXmlInputSource() -
1461*/ -
1462 -
1463void QXmlInputSource::fetchData() -
1464{ -
1465 enum
executed (the execution status of this line is deduced): enum
-
1466 {
executed (the execution status of this line is deduced): {
-
1467 BufferSize = 1024
executed (the execution status of this line is deduced): BufferSize = 1024
-
1468 };
executed (the execution status of this line is deduced): };
-
1469 -
1470 QByteArray rawData;
executed (the execution status of this line is deduced): QByteArray rawData;
-
1471 -
1472 if (d->inputDevice || d->inputStream) {
evaluated: d->inputDevice
TRUEFALSE
yes
Evaluation Count:6659
yes
Evaluation Count:1769
partially evaluated: d->inputStream
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1769
0-6659
1473 QIODevice *device = d->inputDevice ? d->inputDevice : d->inputStream->device();
partially evaluated: d->inputDevice
TRUEFALSE
yes
Evaluation Count:6659
no
Evaluation Count:0
0-6659
1474 -
1475 if (!device) {
partially evaluated: !device
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6659
0-6659
1476 if (d->inputStream && d->inputStream->string()) {
never evaluated: d->inputStream
never evaluated: d->inputStream->string()
0
1477 QString *s = d->inputStream->string();
never executed (the execution status of this line is deduced): QString *s = d->inputStream->string();
-
1478 rawData = QByteArray((const char *) s->constData(), s->size() * sizeof(QChar));
never executed (the execution status of this line is deduced): rawData = QByteArray((const char *) s->constData(), s->size() * sizeof(QChar));
-
1479 }
never executed: }
0
1480 } else if (device->isOpen() || device->open(QIODevice::ReadOnly)) {
never executed: }
evaluated: device->isOpen()
TRUEFALSE
yes
Evaluation Count:6643
yes
Evaluation Count:16
partially evaluated: device->open(QIODevice::ReadOnly)
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-6643
1481 rawData.resize(BufferSize);
executed (the execution status of this line is deduced): rawData.resize(BufferSize);
-
1482 qint64 size = device->read(rawData.data(), BufferSize);
executed (the execution status of this line is deduced): qint64 size = device->read(rawData.data(), BufferSize);
-
1483 -
1484 if (size != -1) {
evaluated: size != -1
TRUEFALSE
yes
Evaluation Count:6655
yes
Evaluation Count:4
4-6655
1485 // We don't want to give fromRawData() less than four bytes if we can avoid it. -
1486 while (size < 4) {
evaluated: size < 4
TRUEFALSE
yes
Evaluation Count:11517
yes
Evaluation Count:6326
6326-11517
1487 if (!device->waitForReadyRead(-1))
evaluated: !device->waitForReadyRead(-1)
TRUEFALSE
yes
Evaluation Count:329
yes
Evaluation Count:11188
329-11188
1488 break;
executed: break;
Execution Count:329
329
1489 int ret = device->read(rawData.data() + size, BufferSize - size);
executed (the execution status of this line is deduced): int ret = device->read(rawData.data() + size, BufferSize - size);
-
1490 if (ret <= 0)
partially evaluated: ret <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11188
0-11188
1491 break;
never executed: break;
0
1492 size += ret;
executed (the execution status of this line is deduced): size += ret;
-
1493 }
executed: }
Execution Count:11188
11188
1494 }
executed: }
Execution Count:6655
6655
1495 -
1496 rawData.resize(qMax(qint64(0), size));
executed (the execution status of this line is deduced): rawData.resize(qMax(qint64(0), size));
-
1497 }
executed: }
Execution Count:6659
6659
1498 -
1499 /* We do this inside the "if (d->inputDevice ..." scope -
1500 * because if we're not using a stream or device, that is, -
1501 * the user set a QString manually, we don't want to set -
1502 * d->str. */ -
1503 setData(fromRawData(rawData));
executed (the execution status of this line is deduced): setData(fromRawData(rawData));
-
1504 }
executed: }
Execution Count:6659
6659
1505}
executed: }
Execution Count:8428
8428
1506 -
1507#ifndef QT_NO_TEXTCODEC -
1508static QString extractEncodingDecl(const QString &text, bool *needMoreText) -
1509{ -
1510 *needMoreText = false;
executed (the execution status of this line is deduced): *needMoreText = false;
-
1511 -
1512 int l = text.length();
executed (the execution status of this line is deduced): int l = text.length();
-
1513 QString snip = QString::fromLatin1("<?xml").left(l);
executed (the execution status of this line is deduced): QString snip = QString::fromLatin1("<?xml").left(l);
-
1514 if (l > 0 && !text.startsWith(snip))
evaluated: l > 0
TRUEFALSE
yes
Evaluation Count:3223
yes
Evaluation Count:6
evaluated: !text.startsWith(snip)
TRUEFALSE
yes
Evaluation Count:1761
yes
Evaluation Count:1462
6-3223
1515 return QString();
executed: return QString();
Execution Count:1761
1761
1516 -
1517 int endPos = text.indexOf(QLatin1Char('>'));
executed (the execution status of this line is deduced): int endPos = text.indexOf(QLatin1Char('>'));
-
1518 if (endPos == -1) {
evaluated: endPos == -1
TRUEFALSE
yes
Evaluation Count:1276
yes
Evaluation Count:192
192-1276
1519 *needMoreText = l < 255; // we won't look forever
executed (the execution status of this line is deduced): *needMoreText = l < 255;
-
1520 return QString();
executed: return QString();
Execution Count:1276
1276
1521 } -
1522 -
1523 int pos = text.indexOf(QLatin1String("encoding"));
executed (the execution status of this line is deduced): int pos = text.indexOf(QLatin1String("encoding"));
-
1524 if (pos == -1 || pos >= endPos)
evaluated: pos == -1
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:133
partially evaluated: pos >= endPos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:133
0-133
1525 return QString();
executed: return QString();
Execution Count:59
59
1526 -
1527 while (pos < endPos) {
partially evaluated: pos < endPos
TRUEFALSE
yes
Evaluation Count:1330
no
Evaluation Count:0
0-1330
1528 ushort uc = text.at(pos).unicode();
executed (the execution status of this line is deduced): ushort uc = text.at(pos).unicode();
-
1529 if (uc == '\'' || uc == '"')
evaluated: uc == '\''
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1328
evaluated: uc == '"'
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:1197
2-1328
1530 break;
executed: break;
Execution Count:133
133
1531 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
1532 }
executed: }
Execution Count:1197
1197
1533 -
1534 if (pos == endPos)
partially evaluated: pos == endPos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:133
0-133
1535 return QString();
never executed: return QString();
0
1536 -
1537 QString encoding;
executed (the execution status of this line is deduced): QString encoding;
-
1538 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
1539 while (pos < endPos) {
partially evaluated: pos < endPos
TRUEFALSE
yes
Evaluation Count:914
no
Evaluation Count:0
0-914
1540 ushort uc = text.at(pos).unicode();
executed (the execution status of this line is deduced): ushort uc = text.at(pos).unicode();
-
1541 if (uc == '\'' || uc == '"')
evaluated: uc == '\''
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:912
evaluated: uc == '"'
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:781
2-912
1542 break;
executed: break;
Execution Count:133
133
1543 encoding.append(uc);
executed (the execution status of this line is deduced): encoding.append(uc);
-
1544 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
1545 }
executed: }
Execution Count:781
781
1546 -
1547 return encoding;
executed: return encoding;
Execution Count:133
133
1548} -
1549#endif // QT_NO_TEXTCODEC -
1550 -
1551/*! -
1552 This function reads the XML file from \a data and tries to -
1553 recognize the encoding. It converts the raw data \a data into a -
1554 QString and returns it. It tries its best to get the correct -
1555 encoding for the XML file. -
1556 -
1557 If \a beginning is true, this function assumes that the data -
1558 starts at the beginning of a new XML document and looks for an -
1559 encoding declaration. If \a beginning is false, it converts the -
1560 raw data using the encoding determined from prior calls. -
1561*/ -
1562QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning) -
1563{ -
1564#ifdef QT_NO_TEXTCODEC -
1565 Q_UNUSED(beginning); -
1566 return QString::fromLatin1(data.constData(), data.size()); -
1567#else -
1568 if (data.size() == 0)
evaluated: data.size() == 0
TRUEFALSE
yes
Evaluation Count:329
yes
Evaluation Count:51239
329-51239
1569 return QString();
executed: return QString();
Execution Count:329
329
1570 if (beginning) {
partially evaluated: beginning
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51239
0-51239
1571 delete d->encMapper;
never executed (the execution status of this line is deduced): delete d->encMapper;
-
1572 d->encMapper = 0;
never executed (the execution status of this line is deduced): d->encMapper = 0;
-
1573 }
never executed: }
0
1574 -
1575 int mib = 106; // UTF-8
executed (the execution status of this line is deduced): int mib = 106;
-
1576 -
1577 // This is the initial UTF codec we will read the encoding declaration with -
1578 if (d->encMapper == 0) {
evaluated: d->encMapper == 0
TRUEFALSE
yes
Evaluation Count:1953
yes
Evaluation Count:49286
1953-49286
1579 d->encodingDeclBytes.clear();
executed (the execution status of this line is deduced): d->encodingDeclBytes.clear();
-
1580 d->encodingDeclChars.clear();
executed (the execution status of this line is deduced): d->encodingDeclChars.clear();
-
1581 d->lookingForEncodingDecl = true;
executed (the execution status of this line is deduced): d->lookingForEncodingDecl = true;
-
1582 -
1583 // look for byte order mark and read the first 5 characters -
1584 if (data.size() >= 4) {
evaluated: data.size() >= 4
TRUEFALSE
yes
Evaluation Count:1459
yes
Evaluation Count:494
494-1459
1585 uchar ch1 = data.at(0);
executed (the execution status of this line is deduced): uchar ch1 = data.at(0);
-
1586 uchar ch2 = data.at(1);
executed (the execution status of this line is deduced): uchar ch2 = data.at(1);
-
1587 uchar ch3 = data.at(2);
executed (the execution status of this line is deduced): uchar ch3 = data.at(2);
-
1588 uchar ch4 = data.at(3);
executed (the execution status of this line is deduced): uchar ch4 = data.at(3);
-
1589 -
1590 if ((ch1 == 0 && ch2 == 0 && ch3 == 0xfe && ch4 == 0xff) ||
evaluated: ch1 == 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1449
partially evaluated: ch2 == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
never evaluated: ch3 == 0xfe
never evaluated: ch4 == 0xff
0-1449
1591 (ch1 == 0xff && ch2 == 0xfe && ch3 == 0 && ch4 == 0))
evaluated: ch1 == 0xff
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:1435
partially evaluated: ch2 == 0xfe
TRUEFALSE
yes
Evaluation Count:24
no
Evaluation Count:0
partially evaluated: ch3 == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
never evaluated: ch4 == 0
0-1435
1592 mib = 1017; // UTF-32 with byte order mark
never executed: mib = 1017;
0
1593 else if (ch1 == 0x3c && ch2 == 0x00 && ch3 == 0x00 && ch4 == 0x00)
evaluated: ch1 == 0x3c
TRUEFALSE
yes
Evaluation Count:1421
yes
Evaluation Count:38
evaluated: ch2 == 0x00
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:1390
evaluated: ch3 == 0x00
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:21
partially evaluated: ch4 == 0x00
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-1421
1594 mib = 1019; // UTF-32LE
executed: mib = 1019;
Execution Count:10
10
1595 else if (ch1 == 0x00 && ch2 == 0x00 && ch3 == 0x00 && ch4 == 0x3c)
evaluated: ch1 == 0x00
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1439
partially evaluated: ch2 == 0x00
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
never evaluated: ch3 == 0x00
never evaluated: ch4 == 0x3c
0-1439
1596 mib = 1018; // UTF-32BE
never executed: mib = 1018;
0
1597 } -
1598 if (mib == 106 && data.size() >= 2) {
evaluated: mib == 106
TRUEFALSE
yes
Evaluation Count:1943
yes
Evaluation Count:10
evaluated: data.size() >= 2
TRUEFALSE
yes
Evaluation Count:1781
yes
Evaluation Count:162
10-1943
1599 uchar ch1 = data.at(0);
executed (the execution status of this line is deduced): uchar ch1 = data.at(0);
-
1600 uchar ch2 = data.at(1);
executed (the execution status of this line is deduced): uchar ch2 = data.at(1);
-
1601 -
1602 if ((ch1 == 0xfe && ch2 == 0xff) || (ch1 == 0xff && ch2 == 0xfe))
evaluated: ch1 == 0xfe
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1778
partially evaluated: ch2 == 0xff
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
evaluated: ch1 == 0xff
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:1748
partially evaluated: ch2 == 0xfe
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-1778
1603 mib = 1015; // UTF-16 with byte order mark
executed: mib = 1015;
Execution Count:33
33
1604 else if (ch1 == 0x3c && ch2 == 0x00)
evaluated: ch1 == 0x3c
TRUEFALSE
yes
Evaluation Count:1737
yes
Evaluation Count:11
evaluated: ch2 == 0x00
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:1716
11-1737
1605 mib = 1014; // UTF-16LE
executed: mib = 1014;
Execution Count:21
21
1606 else if (ch1 == 0x00 && ch2 == 0x3c)
evaluated: ch1 == 0x00
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1717
partially evaluated: ch2 == 0x3c
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-1717
1607 mib = 1013; // UTF-16BE
executed: mib = 1013;
Execution Count:10
10
1608 } -
1609 -
1610 QTextCodec *codec = QTextCodec::codecForMib(mib);
executed (the execution status of this line is deduced): QTextCodec *codec = QTextCodec::codecForMib(mib);
-
1611 Q_ASSERT(codec);
executed (the execution status of this line is deduced): qt_noop();
-
1612 -
1613 d->encMapper = codec->makeDecoder();
executed (the execution status of this line is deduced): d->encMapper = codec->makeDecoder();
-
1614 }
executed: }
Execution Count:1953
1953
1615 -
1616 QString input = d->encMapper->toUnicode(data.constData(), data.size());
executed (the execution status of this line is deduced): QString input = d->encMapper->toUnicode(data.constData(), data.size());
-
1617 -
1618 if (d->lookingForEncodingDecl) {
evaluated: d->lookingForEncodingDecl
TRUEFALSE
yes
Evaluation Count:3229
yes
Evaluation Count:48010
3229-48010
1619 d->encodingDeclChars += input;
executed (the execution status of this line is deduced): d->encodingDeclChars += input;
-
1620 -
1621 bool needMoreText;
executed (the execution status of this line is deduced): bool needMoreText;
-
1622 QString encoding = extractEncodingDecl(d->encodingDeclChars, &needMoreText);
executed (the execution status of this line is deduced): QString encoding = extractEncodingDecl(d->encodingDeclChars, &needMoreText);
-
1623 -
1624 if (!encoding.isEmpty()) {
evaluated: !encoding.isEmpty()
TRUEFALSE
yes
Evaluation Count:133
yes
Evaluation Count:3096
133-3096
1625 if (QTextCodec *codec = QTextCodec::codecForName(encoding.toLatin1())) {
partially evaluated: QTextCodec *codec = QTextCodec::codecForName(encoding.toLatin1())
TRUEFALSE
yes
Evaluation Count:133
no
Evaluation Count:0
0-133
1626 /* If the encoding is the same, we don't have to do toUnicode() all over again. */ -
1627 if(codec->mibEnum() != mib) {
evaluated: codec->mibEnum() != mib
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:98
35-98
1628 delete d->encMapper;
executed (the execution status of this line is deduced): delete d->encMapper;
-
1629 d->encMapper = codec->makeDecoder();
executed (the execution status of this line is deduced): d->encMapper = codec->makeDecoder();
-
1630 -
1631 /* The variable input can potentially be large, so we deallocate -
1632 * it before calling toUnicode() in order to avoid having two -
1633 * large QStrings in memory simultaneously. */ -
1634 input.clear();
executed (the execution status of this line is deduced): input.clear();
-
1635 -
1636 // prime the decoder with the data so far -
1637 d->encMapper->toUnicode(d->encodingDeclBytes.constData(), d->encodingDeclBytes.size());
executed (the execution status of this line is deduced): d->encMapper->toUnicode(d->encodingDeclBytes.constData(), d->encodingDeclBytes.size());
-
1638 // now feed it the new data -
1639 input = d->encMapper->toUnicode(data.constData(), data.size());
executed (the execution status of this line is deduced): input = d->encMapper->toUnicode(data.constData(), data.size());
-
1640 }
executed: }
Execution Count:35
35
1641 }
executed: }
Execution Count:133
133
1642 }
executed: }
Execution Count:133
133
1643 -
1644 d->encodingDeclBytes += data;
executed (the execution status of this line is deduced): d->encodingDeclBytes += data;
-
1645 d->lookingForEncodingDecl = needMoreText;
executed (the execution status of this line is deduced): d->lookingForEncodingDecl = needMoreText;
-
1646 }
executed: }
Execution Count:3229
3229
1647 -
1648 return input;
executed: return input;
Execution Count:51239
51239
1649#endif -
1650} -
1651 -
1652 -
1653/********************************************* -
1654 * -
1655 * QXmlDefaultHandler -
1656 * -
1657 *********************************************/ -
1658 -
1659/*! -
1660 \class QXmlContentHandler -
1661 \reentrant -
1662 \brief The QXmlContentHandler class provides an interface to -
1663 report the logical content of XML data. -
1664 -
1665 \inmodule QtXml -
1666 \ingroup xml-tools -
1667 -
1668 If the application needs to be informed of basic parsing events, -
1669 it can implement this interface and activate it using -
1670 QXmlReader::setContentHandler(). The reader can then report basic -
1671 document-related events like the start and end of elements and -
1672 character data through this interface. -
1673 -
1674 The order of events in this interface is very important, and -
1675 mirrors the order of information in the document itself. For -
1676 example, all of an element's content (character data, processing -
1677 instructions, and sub-elements) appears, in order, between the -
1678 startElement() event and the corresponding endElement() event. -
1679 -
1680 The class QXmlDefaultHandler provides a default implementation for -
1681 this interface; subclassing from the QXmlDefaultHandler class is -
1682 very convenient if you only want to be informed of some parsing -
1683 events. -
1684 -
1685 The startDocument() function is called at the start of the -
1686 document, and endDocument() is called at the end. Before parsing -
1687 begins setDocumentLocator() is called. For each element -
1688 startElement() is called, with endElement() being called at the -
1689 end of each element. The characters() function is called with -
1690 chunks of character data; ignorableWhitespace() is called with -
1691 chunks of whitespace and processingInstruction() is called with -
1692 processing instructions. If an entity is skipped skippedEntity() -
1693 is called. At the beginning of prefix-URI scopes -
1694 startPrefixMapping() is called. -
1695 -
1696 \sa QXmlDTDHandler, QXmlDeclHandler, QXmlEntityResolver, QXmlErrorHandler, -
1697 QXmlLexicalHandler, {Introduction to SAX2} -
1698*/ -
1699 -
1700/*! -
1701 \fn QXmlContentHandler::~QXmlContentHandler() -
1702 -
1703 Destroys the content handler. -
1704*/ -
1705 -
1706/*! -
1707 \fn void QXmlContentHandler::setDocumentLocator(QXmlLocator* locator) -
1708 -
1709 The reader calls this function before it starts parsing the -
1710 document. The argument \a locator is a pointer to a QXmlLocator -
1711 which allows the application to get the parsing position within -
1712 the document. -
1713 -
1714 Do not destroy the \a locator; it is destroyed when the reader is -
1715 destroyed. (Do not use the \a locator after the reader is -
1716 destroyed). -
1717*/ -
1718 -
1719/*! -
1720 \fn bool QXmlContentHandler::startDocument() -
1721 -
1722 The reader calls this function when it starts parsing the -
1723 document. The reader calls this function just once, after the call -
1724 to setDocumentLocator(), and before any other functions in this -
1725 class or in the QXmlDTDHandler class are called. -
1726 -
1727 If this function returns false the reader stops parsing and -
1728 reports an error. The reader uses the function errorString() to -
1729 get the error message. -
1730 -
1731 \sa endDocument() -
1732*/ -
1733 -
1734/*! -
1735 \fn bool QXmlContentHandler::endDocument() -
1736 -
1737 The reader calls this function after it has finished parsing. It -
1738 is called just once, and is the last handler function called. It -
1739 is called after the reader has read all input or has abandoned -
1740 parsing because of a fatal error. -
1741 -
1742 If this function returns false the reader stops parsing and -
1743 reports an error. The reader uses the function errorString() to -
1744 get the error message. -
1745 -
1746 \sa startDocument() -
1747*/ -
1748 -
1749/*! -
1750 \fn bool QXmlContentHandler::startPrefixMapping(const QString& prefix, const QString& uri) -
1751 -
1752 The reader calls this function to signal the begin of a prefix-URI -
1753 namespace mapping scope. This information is not necessary for -
1754 normal namespace processing since the reader automatically -
1755 replaces prefixes for element and attribute names. -
1756 -
1757 Note that startPrefixMapping() and endPrefixMapping() calls are -
1758 not guaranteed to be properly nested relative to each other: all -
1759 startPrefixMapping() events occur before the corresponding -
1760 startElement() event, and all endPrefixMapping() events occur -
1761 after the corresponding endElement() event, but their order is not -
1762 otherwise guaranteed. -
1763 -
1764 The argument \a prefix is the namespace prefix being declared and -
1765 the argument \a uri is the namespace URI the prefix is mapped to. -
1766 -
1767 If this function returns false the reader stops parsing and -
1768 reports an error. The reader uses the function errorString() to -
1769 get the error message. -
1770 -
1771 \sa endPrefixMapping(), {Namespace Support via Features} -
1772*/ -
1773 -
1774/*! -
1775 \fn bool QXmlContentHandler::endPrefixMapping(const QString& prefix) -
1776 -
1777 The reader calls this function to signal the end of a prefix -
1778 mapping for the prefix \a prefix. -
1779 -
1780 If this function returns false the reader stops parsing and -
1781 reports an error. The reader uses the function errorString() to -
1782 get the error message. -
1783 -
1784 \sa startPrefixMapping(), {Namespace Support via Features} -
1785*/ -
1786 -
1787/*! -
1788 \fn bool QXmlContentHandler::startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) -
1789 -
1790 The reader calls this function when it has parsed a start element -
1791 tag. -
1792 -
1793 There is a corresponding endElement() call when the corresponding -
1794 end element tag is read. The startElement() and endElement() calls -
1795 are always nested correctly. Empty element tags (e.g. \c{<x/>}) -
1796 cause a startElement() call to be immediately followed by an -
1797 endElement() call. -
1798 -
1799 The attribute list provided only contains attributes with explicit -
1800 values. The attribute list contains attributes used for namespace -
1801 declaration (i.e. attributes starting with xmlns) only if the -
1802 namespace-prefix property of the reader is true. -
1803 -
1804 The argument \a namespaceURI is the namespace URI, or -
1805 an empty string if the element has no namespace URI or if no -
1806 namespace processing is done. \a localName is the local name -
1807 (without prefix), or an empty string if no namespace processing is -
1808 done, \a qName is the qualified name (with prefix) and \a atts are -
1809 the attributes attached to the element. If there are no -
1810 attributes, \a atts is an empty attributes object. -
1811 -
1812 If this function returns false the reader stops parsing and -
1813 reports an error. The reader uses the function errorString() to -
1814 get the error message. -
1815 -
1816 \sa endElement(), {Namespace Support via Features} -
1817*/ -
1818 -
1819/*! -
1820 \fn bool QXmlContentHandler::endElement(const QString& namespaceURI, const QString& localName, const QString& qName) -
1821 -
1822 The reader calls this function when it has parsed an end element -
1823 tag with the qualified name \a qName, the local name \a localName -
1824 and the namespace URI \a namespaceURI. -
1825 -
1826 If this function returns false the reader stops parsing and -
1827 reports an error. The reader uses the function errorString() to -
1828 get the error message. -
1829 -
1830 \sa startElement(), {Namespace Support via Features} -
1831*/ -
1832 -
1833/*! -
1834 \fn bool QXmlContentHandler::characters(const QString& ch) -
1835 -
1836 The reader calls this function when it has parsed a chunk of -
1837 character data (either normal character data or character data -
1838 inside a CDATA section; if you need to distinguish between those -
1839 two types you must use QXmlLexicalHandler::startCDATA() and -
1840 QXmlLexicalHandler::endCDATA()). The character data is reported in -
1841 \a ch. -
1842 -
1843 Some readers report whitespace in element content using the -
1844 ignorableWhitespace() function rather than using this one. -
1845 -
1846 A reader may report the character data of an element in more than -
1847 one chunk; e.g. a reader might want to report "a\<b" in three -
1848 characters() events ("a ", "\<" and " b"). -
1849 -
1850 If this function returns false the reader stops parsing and -
1851 reports an error. The reader uses the function errorString() to -
1852 get the error message. -
1853*/ -
1854 -
1855/*! -
1856 \fn bool QXmlContentHandler::ignorableWhitespace(const QString& ch) -
1857 -
1858 Some readers may use this function to report each chunk of -
1859 whitespace in element content. The whitespace is reported in \a ch. -
1860 -
1861 If this function returns false the reader stops parsing and -
1862 reports an error. The reader uses the function errorString() to -
1863 get the error message. -
1864*/ -
1865 -
1866/*! -
1867 \fn bool QXmlContentHandler::processingInstruction(const QString& target, const QString& data) -
1868 -
1869 The reader calls this function when it has parsed a processing -
1870 instruction. -
1871 -
1872 \a target is the target name of the processing instruction and \a -
1873 data is the data in the processing instruction. -
1874 -
1875 If this function returns false the reader stops parsing and -
1876 reports an error. The reader uses the function errorString() to -
1877 get the error message. -
1878*/ -
1879 -
1880/*! -
1881 \fn bool QXmlContentHandler::skippedEntity(const QString& name) -
1882 -
1883 Some readers may skip entities if they have not seen the -
1884 declarations (e.g. because they are in an external DTD). If they -
1885 do so they report that they skipped the entity called \a name by -
1886 calling this function. -
1887 -
1888 If this function returns false the reader stops parsing and -
1889 reports an error. The reader uses the function errorString() to -
1890 get the error message. -
1891*/ -
1892 -
1893/*! -
1894 \fn QString QXmlContentHandler::errorString() const -
1895 -
1896 The reader calls this function to get an error string, e.g. if any -
1897 of the handler functions returns false. -
1898*/ -
1899 -
1900 -
1901/*! -
1902 \class QXmlErrorHandler -
1903 \reentrant -
1904 \brief The QXmlErrorHandler class provides an interface to report -
1905 errors in XML data. -
1906 -
1907 \inmodule QtXml -
1908 \ingroup xml-tools -
1909 -
1910 If you want your application to report errors to the user or to -
1911 perform customized error handling, you should subclass this class. -
1912 -
1913 You can set the error handler with QXmlReader::setErrorHandler(). -
1914 -
1915 Errors can be reported using warning(), error() and fatalError(), -
1916 with the error text being reported with errorString(). -
1917 -
1918 \sa QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, -
1919 QXmlLexicalHandler, {Introduction to SAX2} -
1920*/ -
1921 -
1922/*! -
1923 \fn QXmlErrorHandler::~QXmlErrorHandler() -
1924 -
1925 Destroys the error handler. -
1926*/ -
1927 -
1928/*! -
1929 \fn bool QXmlErrorHandler::warning(const QXmlParseException& exception) -
1930 -
1931 A reader might use this function to report a warning. Warnings are -
1932 conditions that are not errors or fatal errors as defined by the -
1933 XML 1.0 specification. Details of the warning are stored in \a -
1934 exception. -
1935 -
1936 If this function returns false the reader stops parsing and -
1937 reports an error. The reader uses the function errorString() to -
1938 get the error message. -
1939*/ -
1940 -
1941/*! -
1942 \fn bool QXmlErrorHandler::error(const QXmlParseException& exception) -
1943 -
1944 A reader might use this function to report a recoverable error. A -
1945 recoverable error corresponds to the definiton of "error" in -
1946 section 1.2 of the XML 1.0 specification. Details of the error are -
1947 stored in \a exception. -
1948 -
1949 The reader must continue to provide normal parsing events after -
1950 invoking this function. -
1951 -
1952 If this function returns false the reader stops parsing and -
1953 reports an error. The reader uses the function errorString() to -
1954 get the error message. -
1955*/ -
1956 -
1957/*! -
1958\fn bool QXmlErrorHandler::fatalError(const QXmlParseException& exception) -
1959 -
1960A reader must use this function to report a non-recoverable error. -
1961Details of the error are stored in \a exception. -
1962 -
1963If this function returns true the reader might try to go on -
1964parsing and reporting further errors, but no regular parsing -
1965events are reported. -
1966*/ -
1967 -
1968/*! -
1969 \fn QString QXmlErrorHandler::errorString() const -
1970 -
1971 The reader calls this function to get an error string if any of -
1972 the handler functions returns false. -
1973*/ -
1974 -
1975 -
1976/*! -
1977 \class QXmlDTDHandler -
1978 \reentrant -
1979 \brief The QXmlDTDHandler class provides an interface to report -
1980 DTD content of XML data. -
1981 -
1982 \inmodule QtXml -
1983 \ingroup xml-tools -
1984 -
1985 If an application needs information about notations and unparsed -
1986 entities, it can implement this interface and register an instance -
1987 with QXmlReader::setDTDHandler(). -
1988 -
1989 Note that this interface includes only those DTD events that the -
1990 XML recommendation requires processors to report, i.e. notation -
1991 and unparsed entity declarations using notationDecl() and -
1992 unparsedEntityDecl() respectively. -
1993 -
1994 \sa QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, QXmlErrorHandler, -
1995 QXmlLexicalHandler, {Introduction to SAX2} -
1996*/ -
1997 -
1998/*! -
1999 \fn QXmlDTDHandler::~QXmlDTDHandler() -
2000 -
2001 Destroys the DTD handler. -
2002*/ -
2003 -
2004/*! -
2005 \fn bool QXmlDTDHandler::notationDecl(const QString& name, const QString& publicId, const QString& systemId) -
2006 -
2007 The reader calls this function when it has parsed a notation -
2008 declaration. -
2009 -
2010 The argument \a name is the notation name, \a publicId is the -
2011 notation's public identifier and \a systemId is the notation's -
2012 system identifier. -
2013 -
2014 If this function returns false the reader stops parsing and -
2015 reports an error. The reader uses the function errorString() to -
2016 get the error message. -
2017*/ -
2018 -
2019/*! -
2020 \fn bool QXmlDTDHandler::unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) -
2021 -
2022 The reader calls this function when it finds an unparsed entity -
2023 declaration. -
2024 -
2025 The argument \a name is the unparsed entity's name, \a publicId is -
2026 the entity's public identifier, \a systemId is the entity's system -
2027 identifier and \a notationName is the name of the associated -
2028 notation. -
2029 -
2030 If this function returns false the reader stops parsing and -
2031 reports an error. The reader uses the function errorString() to -
2032 get the error message. -
2033*/ -
2034 -
2035/*! -
2036 \fn QString QXmlDTDHandler::errorString() const -
2037 -
2038 The reader calls this function to get an error string if any of -
2039 the handler functions returns false. -
2040*/ -
2041 -
2042 -
2043/*! -
2044 \class QXmlEntityResolver -
2045 \reentrant -
2046 \brief The QXmlEntityResolver class provides an interface to -
2047 resolve external entities contained in XML data. -
2048 -
2049 \inmodule QtXml -
2050 \ingroup xml-tools -
2051 -
2052 If an application needs to implement customized handling for -
2053 external entities, it must implement this interface, i.e. -
2054 resolveEntity(), and register it with -
2055 QXmlReader::setEntityResolver(). -
2056 -
2057 \sa QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlErrorHandler, -
2058 QXmlLexicalHandler, {Introduction to SAX2} -
2059*/ -
2060 -
2061/*! -
2062 \fn QXmlEntityResolver::~QXmlEntityResolver() -
2063 -
2064 Destroys the entity resolver. -
2065*/ -
2066 -
2067/*! -
2068 \fn bool QXmlEntityResolver::resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret) -
2069 -
2070 The reader calls this function before it opens any external -
2071 entity, except the top-level document entity. The application may -
2072 request the reader to resolve the entity itself (\a ret is 0) or -
2073 to use an entirely different input source (\a ret points to the -
2074 input source). -
2075 -
2076 The reader deletes the input source \a ret when it no longer needs -
2077 it, so you should allocate it on the heap with \c new. -
2078 -
2079 The argument \a publicId is the public identifier of the external -
2080 entity, \a systemId is the system identifier of the external -
2081 entity and \a ret is the return value of this function. If \a ret -
2082 is 0 the reader should resolve the entity itself, if it is -
2083 non-zero it must point to an input source which the reader uses -
2084 instead. -
2085 -
2086 If this function returns false the reader stops parsing and -
2087 reports an error. The reader uses the function errorString() to -
2088 get the error message. -
2089*/ -
2090 -
2091/*! -
2092 \fn QString QXmlEntityResolver::errorString() const -
2093 -
2094 The reader calls this function to get an error string if any of -
2095 the handler functions returns false. -
2096*/ -
2097 -
2098 -
2099/*! -
2100 \class QXmlLexicalHandler -
2101 \reentrant -
2102 \brief The QXmlLexicalHandler class provides an interface to -
2103 report the lexical content of XML data. -
2104 -
2105 \inmodule QtXml -
2106 \ingroup xml-tools -
2107 -
2108 The events in the lexical handler apply to the entire document, -
2109 not just to the document element, and all lexical handler events -
2110 appear between the content handler's startDocument and endDocument -
2111 events. -
2112 -
2113 You can set the lexical handler with -
2114 QXmlReader::setLexicalHandler(). -
2115 -
2116 This interface's design is based on the SAX2 extension -
2117 LexicalHandler. -
2118 -
2119 The interface provides the startDTD(), endDTD(), startEntity(), -
2120 endEntity(), startCDATA(), endCDATA() and comment() functions. -
2121 -
2122 \sa QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, -
2123 QXmlErrorHandler, {Introduction to SAX2} -
2124*/ -
2125 -
2126/*! -
2127 \fn QXmlLexicalHandler::~QXmlLexicalHandler() -
2128 -
2129 Destroys the lexical handler. -
2130*/ -
2131 -
2132/*! -
2133 \fn bool QXmlLexicalHandler::startDTD(const QString& name, const QString& publicId, const QString& systemId) -
2134 -
2135 The reader calls this function to report the start of a DTD -
2136 declaration, if any. It reports the name of the document type in -
2137 \a name, the public identifier in \a publicId and the system -
2138 identifier in \a systemId. -
2139 -
2140 If the public identifier is missing, \a publicId is set to -
2141 an empty string. If the system identifier is missing, \a systemId is -
2142 set to an empty string. Note that it is not valid XML to have a -
2143 public identifier but no system identifier; in such cases a parse -
2144 error will occur. -
2145 -
2146 All declarations reported through QXmlDTDHandler or -
2147 QXmlDeclHandler appear between the startDTD() and endDTD() calls. -
2148 -
2149 If this function returns false the reader stops parsing and -
2150 reports an error. The reader uses the function errorString() to -
2151 get the error message. -
2152 -
2153 \sa endDTD() -
2154*/ -
2155 -
2156/*! -
2157 \fn bool QXmlLexicalHandler::endDTD() -
2158 -
2159 The reader calls this function to report the end of a DTD -
2160 declaration, if any. -
2161 -
2162 If this function returns false the reader stops parsing and -
2163 reports an error. The reader uses the function errorString() to -
2164 get the error message. -
2165 -
2166 \sa startDTD() -
2167*/ -
2168 -
2169/*! -
2170 \fn bool QXmlLexicalHandler::startEntity(const QString& name) -
2171 -
2172 The reader calls this function to report the start of an entity -
2173 called \a name. -
2174 -
2175 Note that if the entity is unknown, the reader reports it through -
2176 QXmlContentHandler::skippedEntity() and not through this -
2177 function. -
2178 -
2179 If this function returns false the reader stops parsing and -
2180 reports an error. The reader uses the function errorString() to -
2181 get the error message. -
2182 -
2183 \sa endEntity(), QXmlSimpleReader::setFeature() -
2184*/ -
2185 -
2186/*! -
2187 \fn bool QXmlLexicalHandler::endEntity(const QString& name) -
2188 -
2189 The reader calls this function to report the end of an entity -
2190 called \a name. -
2191 -
2192 For every startEntity() call, there is a corresponding endEntity() -
2193 call. The calls to startEntity() and endEntity() are properly -
2194 nested. -
2195 -
2196 If this function returns false the reader stops parsing and -
2197 reports an error. The reader uses the function errorString() to -
2198 get the error message. -
2199 -
2200 \sa startEntity(), QXmlContentHandler::skippedEntity(), QXmlSimpleReader::setFeature() -
2201*/ -
2202 -
2203/*! -
2204 \fn bool QXmlLexicalHandler::startCDATA() -
2205 -
2206 The reader calls this function to report the start of a CDATA -
2207 section. The content of the CDATA section is reported through the -
2208 QXmlContentHandler::characters() function. This function is -
2209 intended only to report the boundary. -
2210 -
2211 If this function returns false the reader stops parsing and -
2212 reports an error. The reader uses the function errorString() to -
2213 get the error message. -
2214 -
2215 \sa endCDATA() -
2216*/ -
2217 -
2218/*! -
2219 \fn bool QXmlLexicalHandler::endCDATA() -
2220 -
2221 The reader calls this function to report the end of a CDATA -
2222 section. -
2223 -
2224 If this function returns false the reader stops parsing and reports -
2225 an error. The reader uses the function errorString() to get the error -
2226 message. -
2227 -
2228 \sa startCDATA(), QXmlContentHandler::characters() -
2229*/ -
2230 -
2231/*! -
2232 \fn bool QXmlLexicalHandler::comment(const QString& ch) -
2233 -
2234 The reader calls this function to report an XML comment anywhere -
2235 in the document. It reports the text of the comment in \a ch. -
2236 -
2237 If this function returns false the reader stops parsing and -
2238 reports an error. The reader uses the function errorString() to -
2239 get the error message. -
2240*/ -
2241 -
2242/*! -
2243 \fn QString QXmlLexicalHandler::errorString() const -
2244 -
2245 The reader calls this function to get an error string if any of -
2246 the handler functions returns false. -
2247*/ -
2248 -
2249 -
2250/*! -
2251 \class QXmlDeclHandler -
2252 \reentrant -
2253 \brief The QXmlDeclHandler class provides an interface to report declaration -
2254 content of XML data. -
2255 -
2256 \inmodule QtXml -
2257 \ingroup xml-tools -
2258 -
2259 You can set the declaration handler with -
2260 QXmlReader::setDeclHandler(). -
2261 -
2262 This interface is based on the SAX2 extension DeclHandler. -
2263 -
2264 The interface provides attributeDecl(), internalEntityDecl() and -
2265 externalEntityDecl() functions. -
2266 -
2267 \sa QXmlDTDHandler, QXmlContentHandler, QXmlEntityResolver, QXmlErrorHandler, -
2268 QXmlLexicalHandler, {Introduction to SAX2} -
2269*/ -
2270 -
2271/*! -
2272 \fn QXmlDeclHandler::~QXmlDeclHandler() -
2273 -
2274 Destroys the declaration handler. -
2275*/ -
2276 -
2277/*! -
2278 \fn bool QXmlDeclHandler::attributeDecl(const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value) -
2279 -
2280 The reader calls this function to report an attribute type -
2281 declaration. Only the effective (first) declaration for an -
2282 attribute is reported. -
2283 -
2284 The reader passes the name of the associated element in \a eName -
2285 and the name of the attribute in \a aName. It passes a string that -
2286 represents the attribute type in \a type and a string that -
2287 represents the attribute default in \a valueDefault. This string -
2288 is one of "#IMPLIED", "#REQUIRED", "#FIXED" or an empty string (if -
2289 none of the others applies). The reader passes the attribute's -
2290 default value in \a value. If no default value is specified in the -
2291 XML file, \a value is an empty string. -
2292 -
2293 If this function returns false the reader stops parsing and -
2294 reports an error. The reader uses the function errorString() to -
2295 get the error message. -
2296*/ -
2297 -
2298/*! -
2299 \fn bool QXmlDeclHandler::internalEntityDecl(const QString& name, const QString& value) -
2300 -
2301 The reader calls this function to report an internal entity -
2302 declaration. Only the effective (first) declaration is reported. -
2303 -
2304 The reader passes the name of the entity in \a name and the value -
2305 of the entity in \a value. -
2306 -
2307 If this function returns false the reader stops parsing and -
2308 reports an error. The reader uses the function errorString() to -
2309 get the error message. -
2310*/ -
2311 -
2312/*! -
2313 \fn bool QXmlDeclHandler::externalEntityDecl(const QString& name, const QString& publicId, const QString& systemId) -
2314 -
2315 The reader calls this function to report a parsed external entity -
2316 declaration. Only the effective (first) declaration for each -
2317 entity is reported. -
2318 -
2319 The reader passes the name of the entity in \a name, the public -
2320 identifier in \a publicId and the system identifier in \a -
2321 systemId. If there is no public identifier specified, it passes -
2322 an empty string in \a publicId. -
2323 -
2324 If this function returns false the reader stops parsing and -
2325 reports an error. The reader uses the function errorString() to -
2326 get the error message. -
2327*/ -
2328 -
2329/*! -
2330 \fn QString QXmlDeclHandler::errorString() const -
2331 -
2332 The reader calls this function to get an error string if any of -
2333 the handler functions returns false. -
2334*/ -
2335 -
2336 -
2337/*! -
2338 \class QXmlDefaultHandler -
2339 \reentrant -
2340 \brief The QXmlDefaultHandler class provides a default implementation of all -
2341 the XML handler classes. -
2342 -
2343 \inmodule QtXml -
2344 \ingroup xml-tools -
2345 -
2346 This class gathers together the features of -
2347 the specialized handler classes, making it a convenient -
2348 starting point when implementing custom handlers for -
2349 subclasses of QXmlReader, particularly QXmlSimpleReader. -
2350 The virtual functions from each of the base classes are -
2351 reimplemented in this class, providing sensible default behavior -
2352 for many common cases. By subclassing this class, and -
2353 overriding these functions, you can concentrate -
2354 on implementing the parts of the handler relevant to your -
2355 application. -
2356 -
2357 The XML reader must be told which handler to use for different -
2358 kinds of events during parsing. This means that, although -
2359 QXmlDefaultHandler provides default implementations of functions -
2360 inherited from all its base classes, we can still use specialized -
2361 handlers for particular kinds of events. -
2362 -
2363 For example, QXmlDefaultHandler subclasses both -
2364 QXmlContentHandler and QXmlErrorHandler, so by subclassing -
2365 it we can use the same handler for both of the following -
2366 reader functions: -
2367 -
2368 \snippet rsslisting/listing.cpp 0 -
2369 -
2370 Since the reader will inform the handler of parsing errors, it is -
2371 necessary to reimplement QXmlErrorHandler::fatalError() if, for -
2372 example, we want to stop parsing when such an error occurs: -
2373 -
2374 \snippet rsslisting/handler.cpp 0 -
2375 -
2376 The above function returns false, which tells the reader to stop -
2377 parsing. To continue to use the same reader, -
2378 it is necessary to create a new handler instance, and set up the -
2379 reader to use it in the manner described above. -
2380 -
2381 It is useful to examine some of the functions inherited by -
2382 QXmlDefaultHandler, and consider why they might be -
2383 reimplemented in a custom handler. -
2384 Custom handlers will typically reimplement -
2385 QXmlContentHandler::startDocument() to prepare the handler for -
2386 new content. Document elements and the text within them can be -
2387 processed by reimplementing QXmlContentHandler::startElement(), -
2388 QXmlContentHandler::endElement(), and -
2389 QXmlContentHandler::characters(). -
2390 You may want to reimplement QXmlContentHandler::endDocument() -
2391 to perform some finalization or validation on the content once the -
2392 document has been read completely. -
2393 -
2394 \sa QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, -
2395 QXmlErrorHandler, QXmlLexicalHandler, {Introduction to SAX2} -
2396*/ -
2397 -
2398/*! -
2399 \fn QXmlDefaultHandler::QXmlDefaultHandler() -
2400 -
2401 Constructs a handler for use with subclasses of QXmlReader. -
2402*/ -
2403/*! -
2404 \fn QXmlDefaultHandler::~QXmlDefaultHandler() -
2405 -
2406 Destroys the handler. -
2407*/ -
2408 -
2409/*! -
2410 \reimp -
2411 -
2412 This reimplementation does nothing. -
2413*/ -
2414void QXmlDefaultHandler::setDocumentLocator(QXmlLocator*) -
2415{ -
2416} -
2417 -
2418/*! -
2419 \reimp -
2420 -
2421 This reimplementation does nothing. -
2422*/ -
2423bool QXmlDefaultHandler::startDocument() -
2424{ -
2425 return true;
executed: return true;
Execution Count:397
397
2426} -
2427 -
2428/*! -
2429 \reimp -
2430 -
2431 This reimplementation does nothing. -
2432*/ -
2433bool QXmlDefaultHandler::endDocument() -
2434{ -
2435 return true;
executed: return true;
Execution Count:12
12
2436} -
2437 -
2438/*! -
2439 \reimp -
2440 -
2441 This reimplementation does nothing. -
2442*/ -
2443bool QXmlDefaultHandler::startPrefixMapping(const QString&, const QString&) -
2444{ -
2445 return true;
executed: return true;
Execution Count:17
17
2446} -
2447 -
2448/*! -
2449 \reimp -
2450 -
2451 This reimplementation does nothing. -
2452*/ -
2453bool QXmlDefaultHandler::endPrefixMapping(const QString&) -
2454{ -
2455 return true;
executed: return true;
Execution Count:15
15
2456} -
2457 -
2458/*! -
2459 \reimp -
2460 -
2461 This reimplementation does nothing. -
2462*/ -
2463bool QXmlDefaultHandler::startElement(const QString&, const QString&, -
2464 const QString&, const QXmlAttributes&) -
2465{ -
2466 return true;
executed: return true;
Execution Count:206
206
2467} -
2468 -
2469/*! -
2470 \reimp -
2471 -
2472 This reimplementation does nothing. -
2473*/ -
2474bool QXmlDefaultHandler::endElement(const QString&, const QString&, -
2475 const QString&) -
2476{ -
2477 return true;
executed: return true;
Execution Count:207
207
2478} -
2479 -
2480/*! -
2481 \reimp -
2482 -
2483 This reimplementation does nothing. -
2484*/ -
2485bool QXmlDefaultHandler::characters(const QString&) -
2486{ -
2487 return true;
executed: return true;
Execution Count:394
394
2488} -
2489 -
2490/*! -
2491 \reimp -
2492 -
2493 This reimplementation does nothing. -
2494*/ -
2495bool QXmlDefaultHandler::ignorableWhitespace(const QString&) -
2496{ -
2497 return true;
never executed: return true;
0
2498} -
2499 -
2500/*! -
2501 \reimp -
2502 -
2503 This reimplementation does nothing. -
2504*/ -
2505bool QXmlDefaultHandler::processingInstruction(const QString&, -
2506 const QString&) -
2507{ -
2508 return true;
executed: return true;
Execution Count:6
6
2509} -
2510 -
2511/*! -
2512 \reimp -
2513 -
2514 This reimplementation does nothing. -
2515*/ -
2516bool QXmlDefaultHandler::skippedEntity(const QString&) -
2517{ -
2518 return true;
never executed: return true;
0
2519} -
2520 -
2521/*! -
2522 \reimp -
2523 -
2524 This reimplementation does nothing. -
2525*/ -
2526bool QXmlDefaultHandler::warning(const QXmlParseException&) -
2527{ -
2528 return true;
never executed: return true;
0
2529} -
2530 -
2531/*! -
2532 \reimp -
2533 -
2534 This reimplementation does nothing. -
2535*/ -
2536bool QXmlDefaultHandler::error(const QXmlParseException&) -
2537{ -
2538 return true;
never executed: return true;
0
2539} -
2540 -
2541/*! -
2542 \reimp -
2543 -
2544 This reimplementation does nothing. -
2545*/ -
2546bool QXmlDefaultHandler::fatalError(const QXmlParseException&) -
2547{ -
2548 return true;
executed: return true;
Execution Count:14
14
2549} -
2550 -
2551/*! -
2552 \reimp -
2553 -
2554 This reimplementation does nothing. -
2555*/ -
2556bool QXmlDefaultHandler::notationDecl(const QString&, const QString&, -
2557 const QString&) -
2558{ -
2559 return true;
never executed: return true;
0
2560} -
2561 -
2562/*! -
2563 \reimp -
2564 -
2565 This reimplementation does nothing. -
2566*/ -
2567bool QXmlDefaultHandler::unparsedEntityDecl(const QString&, const QString&, -
2568 const QString&, const QString&) -
2569{ -
2570 return true;
never executed: return true;
0
2571} -
2572 -
2573/*! -
2574 \reimp -
2575 -
2576 Sets \a ret to 0, so that the reader uses the system identifier -
2577 provided in the XML document. -
2578*/ -
2579bool QXmlDefaultHandler::resolveEntity(const QString&, const QString&, -
2580 QXmlInputSource*& ret) -
2581{ -
2582 ret = 0;
never executed (the execution status of this line is deduced): ret = 0;
-
2583 return true;
never executed: return true;
0
2584} -
2585 -
2586/*! -
2587 \reimp -
2588 -
2589 Returns the default error string. -
2590*/ -
2591QString QXmlDefaultHandler::errorString() const -
2592{ -
2593 return QString::fromLatin1(XMLERR_ERRORBYCONSUMER);
executed: return QString::fromLatin1("error triggered by consumer");
Execution Count:1
1
2594} -
2595 -
2596/*! -
2597 \reimp -
2598 -
2599 This reimplementation does nothing. -
2600*/ -
2601bool QXmlDefaultHandler::startDTD(const QString&, const QString&, const QString&) -
2602{ -
2603 return true;
never executed: return true;
0
2604} -
2605 -
2606/*! -
2607 \reimp -
2608 -
2609 This reimplementation does nothing. -
2610*/ -
2611bool QXmlDefaultHandler::endDTD() -
2612{ -
2613 return true;
executed: return true;
Execution Count:124
124
2614} -
2615 -
2616/*! -
2617 \reimp -
2618 -
2619 This reimplementation does nothing. -
2620*/ -
2621bool QXmlDefaultHandler::startEntity(const QString&) -
2622{ -
2623 return true;
never executed: return true;
0
2624} -
2625 -
2626/*! -
2627 \reimp -
2628 -
2629 This reimplementation does nothing. -
2630*/ -
2631bool QXmlDefaultHandler::endEntity(const QString&) -
2632{ -
2633 return true;
never executed: return true;
0
2634} -
2635 -
2636/*! -
2637 \reimp -
2638 -
2639 This reimplementation does nothing. -
2640*/ -
2641bool QXmlDefaultHandler::startCDATA() -
2642{ -
2643 return true;
never executed: return true;
0
2644} -
2645 -
2646/*! -
2647 \reimp -
2648 -
2649 This reimplementation does nothing. -
2650*/ -
2651bool QXmlDefaultHandler::endCDATA() -
2652{ -
2653 return true;
never executed: return true;
0
2654} -
2655 -
2656/*! -
2657 \reimp -
2658 -
2659 This reimplementation does nothing. -
2660*/ -
2661bool QXmlDefaultHandler::comment(const QString&) -
2662{ -
2663 return true;
never executed: return true;
0
2664} -
2665 -
2666/*! -
2667 \reimp -
2668 -
2669 This reimplementation does nothing. -
2670*/ -
2671bool QXmlDefaultHandler::attributeDecl(const QString&, const QString&, const QString&, const QString&, const QString&) -
2672{ -
2673 return true;
never executed: return true;
0
2674} -
2675 -
2676/*! -
2677 \reimp -
2678 -
2679 This reimplementation does nothing. -
2680*/ -
2681bool QXmlDefaultHandler::internalEntityDecl(const QString&, const QString&) -
2682{ -
2683 return true;
executed: return true;
Execution Count:212
212
2684} -
2685 -
2686/*! -
2687 \reimp -
2688 -
2689 This reimplementation does nothing. -
2690*/ -
2691bool QXmlDefaultHandler::externalEntityDecl(const QString&, const QString&, const QString&) -
2692{ -
2693 return true;
never executed: return true;
0
2694} -
2695 -
2696 -
2697/********************************************* -
2698 * -
2699 * QXmlSimpleReaderPrivate -
2700 * -
2701 *********************************************/ -
2702 -
2703inline bool QXmlSimpleReaderPrivate::atEnd() -
2704{ -
2705 return (c.unicode()|0x0001) == 0xffff;
executed: return (c.unicode()|0x0001) == 0xffff;
Execution Count:3885588
3885588
2706} -
2707 -
2708inline void QXmlSimpleReaderPrivate::stringClear() -
2709{ -
2710 stringValueLen = 0; stringArrayPos = 0;
executed (the execution status of this line is deduced): stringValueLen = 0; stringArrayPos = 0;
-
2711}
executed: }
Execution Count:113035
113035
2712inline void QXmlSimpleReaderPrivate::nameClear() -
2713{ -
2714 nameValueLen = 0; nameArrayPos = 0;
executed (the execution status of this line is deduced): nameValueLen = 0; nameArrayPos = 0;
-
2715}
executed: }
Execution Count:118874
118874
2716 -
2717inline void QXmlSimpleReaderPrivate::refClear() -
2718{ -
2719 refValueLen = 0; refArrayPos = 0;
executed (the execution status of this line is deduced): refValueLen = 0; refArrayPos = 0;
-
2720}
executed: }
Execution Count:22875
22875
2721 -
2722QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader) -
2723{ -
2724 q_ptr = reader;
executed (the execution status of this line is deduced): q_ptr = reader;
-
2725 parseStack = 0;
executed (the execution status of this line is deduced): parseStack = 0;
-
2726 -
2727 locator.reset(new QXmlSimpleReaderLocator(reader));
executed (the execution status of this line is deduced): locator.reset(new QXmlSimpleReaderLocator(reader));
-
2728 entityRes = 0;
executed (the execution status of this line is deduced): entityRes = 0;
-
2729 dtdHnd = 0;
executed (the execution status of this line is deduced): dtdHnd = 0;
-
2730 contentHnd = 0;
executed (the execution status of this line is deduced): contentHnd = 0;
-
2731 errorHnd = 0;
executed (the execution status of this line is deduced): errorHnd = 0;
-
2732 lexicalHnd = 0;
executed (the execution status of this line is deduced): lexicalHnd = 0;
-
2733 declHnd = 0;
executed (the execution status of this line is deduced): declHnd = 0;
-
2734 -
2735 // default feature settings -
2736 useNamespaces = true;
executed (the execution status of this line is deduced): useNamespaces = true;
-
2737 useNamespacePrefixes = false;
executed (the execution status of this line is deduced): useNamespacePrefixes = false;
-
2738 reportWhitespaceCharData = true;
executed (the execution status of this line is deduced): reportWhitespaceCharData = true;
-
2739 reportEntities = false;
executed (the execution status of this line is deduced): reportEntities = false;
-
2740}
executed: }
Execution Count:2247
2247
2741 -
2742QXmlSimpleReaderPrivate::~QXmlSimpleReaderPrivate() -
2743{ -
2744 delete parseStack;
executed (the execution status of this line is deduced): delete parseStack;
-
2745}
executed: }
Execution Count:2247
2247
2746 -
2747void QXmlSimpleReaderPrivate::initIncrementalParsing() -
2748{ -
2749 if(parseStack)
partially evaluated: parseStack
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1490
0-1490
2750 parseStack->clear();
never executed: parseStack->clear();
0
2751 else -
2752 parseStack = new QStack<ParseState>;
executed: parseStack = new QStack<ParseState>;
Execution Count:1490
1490
2753} -
2754 -
2755/********************************************* -
2756 * -
2757 * QXmlSimpleReader -
2758 * -
2759 *********************************************/ -
2760 -
2761/*! -
2762 \class QXmlReader -
2763 \reentrant -
2764 \brief The QXmlReader class provides an interface for XML readers (i.e. -
2765 parsers). -
2766 -
2767 \inmodule QtXml -
2768 \ingroup xml-tools -
2769 -
2770 This abstract class provides an interface for all of Qt's XML -
2771 readers. Currently there is only one implementation of a reader -
2772 included in Qt's XML module: QXmlSimpleReader. In future releases -
2773 there might be more readers with different properties available -
2774 (e.g. a validating parser). -
2775 -
2776 The design of the XML classes follows the \l{SAX2 Java interface}, with -
2777 the names adapted to fit Qt naming conventions. It should be very -
2778 easy for anybody who has worked with SAX2 to get started with the -
2779 Qt XML classes. -
2780 -
2781 All readers use the class QXmlInputSource to read the input -
2782 document. Since you are normally interested in particular content -
2783 in the XML document, the reader reports the content through -
2784 special handler classes (QXmlDTDHandler, QXmlDeclHandler, -
2785 QXmlContentHandler, QXmlEntityResolver, QXmlErrorHandler and -
2786 QXmlLexicalHandler), which you must subclass, if you want to -
2787 process the contents. -
2788 -
2789 Since the handler classes only describe interfaces you must -
2790 implement all the functions. We provide the QXmlDefaultHandler -
2791 class to make this easier: it implements a default behavior (do -
2792 nothing) for all functions, so you can subclass it and just -
2793 implement the functions you are interested in. -
2794 -
2795 Features and properties of the reader can be set with setFeature() -
2796 and setProperty() respectively. You can set the reader to use your -
2797 own subclasses with setEntityResolver(), setDTDHandler(), -
2798 setContentHandler(), setErrorHandler(), setLexicalHandler() and -
2799 setDeclHandler(). The parse itself is started with a call to -
2800 parse(). -
2801 -
2802 \sa QXmlSimpleReader -
2803*/ -
2804 -
2805/*! -
2806 \fn QXmlReader::~QXmlReader() -
2807 -
2808 Destroys the reader. -
2809*/ -
2810 -
2811/*! -
2812 \fn bool QXmlReader::feature(const QString& name, bool *ok) const -
2813 -
2814 If the reader has the feature called \a name, the feature's value -
2815 is returned. If no such feature exists the return value is -
2816 undefined. -
2817 -
2818 If \a ok is not 0: \c{*}\a{ok} is set to true if the reader has the -
2819 feature called \a name; otherwise \c{*}\a{ok} is set to false. -
2820 -
2821 \sa setFeature(), hasFeature() -
2822*/ -
2823 -
2824/*! -
2825 \fn void QXmlReader::setFeature(const QString& name, bool value) -
2826 -
2827 Sets the feature called \a name to the given \a value. If the -
2828 reader doesn't have the feature nothing happens. -
2829 -
2830 \sa feature(), hasFeature() -
2831*/ -
2832 -
2833/*! -
2834 \fn bool QXmlReader::hasFeature(const QString& name) const -
2835 -
2836 Returns \c true if the reader has the feature called \a name; -
2837 otherwise returns false. -
2838 -
2839 \sa feature(), setFeature() -
2840*/ -
2841 -
2842/*! -
2843 \fn void* QXmlReader::property(const QString& name, bool *ok) const -
2844 -
2845 If the reader has the property \a name, this function returns the -
2846 value of the property; otherwise the return value is undefined. -
2847 -
2848 If \a ok is not 0: if the reader has the \a name property -
2849 \c{*}\a{ok} is set to true; otherwise \c{*}\a{ok} is set to false. -
2850 -
2851 \sa setProperty(), hasProperty() -
2852*/ -
2853 -
2854/*! -
2855 \fn void QXmlReader::setProperty(const QString& name, void* value) -
2856 -
2857 Sets the property \a name to \a value. If the reader doesn't have -
2858 the property nothing happens. -
2859 -
2860 \sa property(), hasProperty() -
2861*/ -
2862 -
2863/*! -
2864 \fn bool QXmlReader::hasProperty(const QString& name) const -
2865 -
2866 Returns true if the reader has the property \a name; otherwise -
2867 returns false. -
2868 -
2869 \sa property(), setProperty() -
2870*/ -
2871 -
2872/*! -
2873 \fn void QXmlReader::setEntityResolver(QXmlEntityResolver* handler) -
2874 -
2875 Sets the entity resolver to \a handler. -
2876 -
2877 \sa entityResolver() -
2878*/ -
2879 -
2880/*! -
2881 \fn QXmlEntityResolver* QXmlReader::entityResolver() const -
2882 -
2883 Returns the entity resolver or 0 if none was set. -
2884 -
2885 \sa setEntityResolver() -
2886*/ -
2887 -
2888/*! -
2889 \fn void QXmlReader::setDTDHandler(QXmlDTDHandler* handler) -
2890 -
2891 Sets the DTD handler to \a handler. -
2892 -
2893 \sa DTDHandler() -
2894*/ -
2895 -
2896/*! -
2897 \fn QXmlDTDHandler* QXmlReader::DTDHandler() const -
2898 -
2899 Returns the DTD handler or 0 if none was set. -
2900 -
2901 \sa setDTDHandler() -
2902*/ -
2903 -
2904/*! -
2905 \fn void QXmlReader::setContentHandler(QXmlContentHandler* handler) -
2906 -
2907 Sets the content handler to \a handler. -
2908 -
2909 \sa contentHandler() -
2910*/ -
2911 -
2912/*! -
2913 \fn QXmlContentHandler* QXmlReader::contentHandler() const -
2914 -
2915 Returns the content handler or 0 if none was set. -
2916 -
2917 \sa setContentHandler() -
2918*/ -
2919 -
2920/*! -
2921 \fn void QXmlReader::setErrorHandler(QXmlErrorHandler* handler) -
2922 -
2923 Sets the error handler to \a handler. Clears the error handler if -
2924 \a handler is 0. -
2925 -
2926 \sa errorHandler() -
2927*/ -
2928 -
2929/*! -
2930 \fn QXmlErrorHandler* QXmlReader::errorHandler() const -
2931 -
2932 Returns the error handler or 0 if none is set. -
2933 -
2934 \sa setErrorHandler() -
2935*/ -
2936 -
2937/*! -
2938 \fn void QXmlReader::setLexicalHandler(QXmlLexicalHandler* handler) -
2939 -
2940 Sets the lexical handler to \a handler. -
2941 -
2942 \sa lexicalHandler() -
2943*/ -
2944 -
2945/*! -
2946 \fn QXmlLexicalHandler* QXmlReader::lexicalHandler() const -
2947 -
2948 Returns the lexical handler or 0 if none was set. -
2949 -
2950 \sa setLexicalHandler() -
2951*/ -
2952 -
2953/*! -
2954 \fn void QXmlReader::setDeclHandler(QXmlDeclHandler* handler) -
2955 -
2956 Sets the declaration handler to \a handler. -
2957 -
2958 \sa declHandler() -
2959*/ -
2960 -
2961/*! -
2962 \fn QXmlDeclHandler* QXmlReader::declHandler() const -
2963 -
2964 Returns the declaration handler or 0 if none was set. -
2965 -
2966 \sa setDeclHandler() -
2967*/ -
2968 -
2969/*! -
2970 \fn bool QXmlReader::parse(const QXmlInputSource &input) -
2971 -
2972 \obsolete -
2973 -
2974 Parses the given \a input. -
2975*/ -
2976 -
2977/*! -
2978 \fn bool QXmlReader::parse(const QXmlInputSource *input) -
2979 -
2980 Reads an XML document from \a input and parses it. Returns true if -
2981 the parsing was successful; otherwise returns false. -
2982*/ -
2983 -
2984 -
2985/*! -
2986 \class QXmlSimpleReader -
2987 \nonreentrant -
2988 \brief The QXmlSimpleReader class provides an implementation of a -
2989 simple XML parser. -
2990 -
2991 \inmodule QtXml -
2992 \ingroup xml-tools -
2993 -
2994 -
2995 This XML reader is suitable for a wide range of applications. It -
2996 is able to parse well-formed XML and can report the namespaces of -
2997 elements to a content handler; however, it does not parse any -
2998 external entities. For historical reasons, Attribute Value -
2999 Normalization and End-of-Line Handling as described in the XML 1.0 -
3000 specification is not performed. -
3001 -
3002 The easiest pattern of use for this class is to create a reader -
3003 instance, define an input source, specify the handlers to be used -
3004 by the reader, and parse the data. -
3005 -
3006 For example, we could use a QFile to supply the input. Here, we -
3007 create a reader, and define an input source to be used by the -
3008 reader: -
3009 -
3010 \snippet simpleparse/main.cpp 0 -
3011 -
3012 A handler lets us perform actions when the reader encounters -
3013 certain types of content, or if errors in the input are found. The -
3014 reader must be told which handler to use for each type of -
3015 event. For many common applications, we can create a custom -
3016 handler by subclassing QXmlDefaultHandler, and use this to handle -
3017 both error and content events: -
3018 -
3019 \snippet simpleparse/main.cpp 1 -
3020 -
3021 If you don't set at least the content and error handlers, the -
3022 parser will fall back on its default behavior---and will do -
3023 nothing. -
3024 -
3025 The most convenient way to handle the input is to read it in a -
3026 single pass using the parse() function with an argument that -
3027 specifies the input source: -
3028 -
3029 \snippet simpleparse/main.cpp 2 -
3030 -
3031 If you can't parse the entire input in one go (for example, it is -
3032 huge, or is being delivered over a network connection), data can -
3033 be fed to the parser in pieces. This is achieved by telling -
3034 parse() to work incrementally, and making subsequent calls to the -
3035 parseContinue() function, until all the data has been processed. -
3036 -
3037 A common way to perform incremental parsing is to connect the \c -
3038 readyRead() signal of a \l{QNetworkReply} {network reply} a slot, -
3039 and handle the incoming data there. See QNetworkAccessManager. -
3040 -
3041 Aspects of the parsing behavior can be adapted using setFeature() -
3042 and setProperty(). -
3043 -
3044 \snippet code/src_xml_sax_qxml.cpp 0 -
3045 -
3046 QXmlSimpleReader is not reentrant. If you want to use the class -
3047 in threaded code, lock the code using QXmlSimpleReader with a -
3048 locking mechanism, such as a QMutex. -
3049*/ -
3050 -
3051static inline bool is_S(QChar ch) -
3052{ -
3053 ushort uc = ch.unicode();
executed (the execution status of this line is deduced): ushort uc = ch.unicode();
-
3054 return (uc == ' ' || uc == '\t' || uc == '\n' || uc == '\r');
executed: return (uc == ' ' || uc == '\t' || uc == '\n' || uc == '\r');
Execution Count:316336
316336
3055} -
3056 -
3057enum NameChar { NameBeginning, NameNotBeginning, NotName }; -
3058 -
3059static const char Begi = (char)NameBeginning; -
3060static const char NtBg = (char)NameNotBeginning; -
3061static const char NotN = (char)NotName; -
3062 -
3063static const char nameCharTable[128] = -
3064{ -
3065// 0x00 -
3066 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
3067 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
3068// 0x10 -
3069 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
3070 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
3071// 0x20 (0x2D is '-', 0x2E is '.') -
3072 NotN, NotN, NotN, NotN, NotN, NotN, NotN, NotN, -
3073 NotN, NotN, NotN, NotN, NotN, NtBg, NtBg, NotN, -
3074// 0x30 (0x30..0x39 are '0'..'9', 0x3A is ':') -
3075 NtBg, NtBg, NtBg, NtBg, NtBg, NtBg, NtBg, NtBg, -
3076 NtBg, NtBg, Begi, NotN, NotN, NotN, NotN, NotN, -
3077// 0x40 (0x41..0x5A are 'A'..'Z') -
3078 NotN, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
3079 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
3080// 0x50 (0x5F is '_') -
3081 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
3082 Begi, Begi, Begi, NotN, NotN, NotN, NotN, Begi, -
3083// 0x60 (0x61..0x7A are 'a'..'z') -
3084 NotN, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
3085 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
3086// 0x70 -
3087 Begi, Begi, Begi, Begi, Begi, Begi, Begi, Begi, -
3088 Begi, Begi, Begi, NotN, NotN, NotN, NotN, NotN -
3089}; -
3090 -
3091static inline NameChar fastDetermineNameChar(QChar ch) -
3092{ -
3093 ushort uc = ch.unicode();
executed (the execution status of this line is deduced): ushort uc = ch.unicode();
-
3094 if (!(uc & ~0x7f)) // uc < 128
evaluated: !(uc & ~0x7f)
TRUEFALSE
yes
Evaluation Count:954653
yes
Evaluation Count:40753
40753-954653
3095 return (NameChar)nameCharTable[uc];
executed: return (NameChar)nameCharTable[uc];
Execution Count:954653
954653
3096 -
3097 QChar::Category cat = ch.category();
executed (the execution status of this line is deduced): QChar::Category cat = ch.category();
-
3098 // ### some these categories might be slightly wrong -
3099 if ((cat >= QChar::Letter_Uppercase && cat <= QChar::Letter_Other)
evaluated: cat >= QChar::Letter_Uppercase
TRUEFALSE
yes
Evaluation Count:40652
yes
Evaluation Count:101
evaluated: cat <= QChar::Letter_Other
TRUEFALSE
yes
Evaluation Count:40546
yes
Evaluation Count:106
101-40652
3100 || cat == QChar::Number_Letter)
partially evaluated: cat == QChar::Number_Letter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:207
0-207
3101 return NameBeginning;
executed: return NameBeginning;
Execution Count:40546
40546
3102 if ((cat >= QChar::Number_DecimalDigit && cat <= QChar::Number_Other)
evaluated: cat >= QChar::Number_DecimalDigit
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:77
evaluated: cat <= QChar::Number_Other
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:117
13-130
3103 || (cat >= QChar::Mark_NonSpacing && cat <= QChar::Mark_Enclosing))
partially evaluated: cat >= QChar::Mark_NonSpacing
TRUEFALSE
yes
Evaluation Count:194
no
Evaluation Count:0
evaluated: cat <= QChar::Mark_Enclosing
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:117
0-194
3104 return NameNotBeginning;
executed: return NameNotBeginning;
Execution Count:90
90
3105 return NotName;
executed: return NotName;
Execution Count:117
117
3106} -
3107 -
3108static NameChar determineNameChar(QChar ch) -
3109{ -
3110 return fastDetermineNameChar(ch);
executed: return fastDetermineNameChar(ch);
Execution Count:89970
89970
3111} -
3112 -
3113/*! -
3114 Constructs a simple XML reader. -
3115 -
3116*/ -
3117QXmlSimpleReader::QXmlSimpleReader() -
3118 : d_ptr(new QXmlSimpleReaderPrivate(this)) -
3119{ -
3120}
executed: }
Execution Count:2247
2247
3121 -
3122/*! -
3123 Destroys the simple XML reader. -
3124*/ -
3125QXmlSimpleReader::~QXmlSimpleReader() -
3126{ -
3127} -
3128 -
3129/*! -
3130 \reimp -
3131*/ -
3132bool QXmlSimpleReader::feature(const QString& name, bool *ok) const -
3133{ -
3134 const QXmlSimpleReaderPrivate *d = d_func();
executed (the execution status of this line is deduced): const QXmlSimpleReaderPrivate *d = d_func();
-
3135 -
3136 if (ok != 0)
partially evaluated: ok != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:403
0-403
3137 *ok = true;
never executed: *ok = true;
0
3138 if (name == QLatin1String("http://xml.org/sax/features/namespaces")) {
evaluated: name == QLatin1String("http://xml.org/sax/features/namespaces")
TRUEFALSE
yes
Evaluation Count:385
yes
Evaluation Count:18
18-385
3139 return d->useNamespaces;
executed: return d->useNamespaces;
Execution Count:385
385
3140 } else if (name == QLatin1String("http://xml.org/sax/features/namespace-prefixes")) {
partially evaluated: name == QLatin1String("http://xml.org/sax/features/namespace-prefixes")
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
3141 return d->useNamespacePrefixes;
executed: return d->useNamespacePrefixes;
Execution Count:18
18
3142 } else if (name == QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData") // For compat with Qt 4
never evaluated: name == QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData")
0
3143 || name == QLatin1String("http://qt-project.org/xml/features/report-whitespace-only-CharData")) {
never evaluated: name == QLatin1String("http://qt-project.org/xml/features/report-whitespace-only-CharData")
0
3144 return d->reportWhitespaceCharData;
never executed: return d->reportWhitespaceCharData;
0
3145 } else if (name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity") // For compat with Qt 4
never evaluated: name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity")
0
3146 || name == QLatin1String("http://qt-project.org/xml/features/report-start-end-entity")) {
never evaluated: name == QLatin1String("http://qt-project.org/xml/features/report-start-end-entity")
0
3147 return d->reportEntities;
never executed: return d->reportEntities;
0
3148 } else { -
3149 qWarning("Unknown feature %s", name.toLatin1().data());
never executed (the execution status of this line is deduced): QMessageLogger("sax/qxml.cpp", 3149, __PRETTY_FUNCTION__).warning("Unknown feature %s", name.toLatin1().data());
-
3150 if (ok != 0)
never evaluated: ok != 0
0
3151 *ok = false;
never executed: *ok = false;
0
3152 }
never executed: }
0
3153 return false;
never executed: return false;
0
3154} -
3155 -
3156/*! -
3157 Turns on the feature \a name if \a enable is true; otherwise turns it off. -
3158 -
3159 The \a name parameter must be one of the following strings: -
3160 \table -
3161 \header \li Feature \li Default \li Notes -
3162 \row \li \e http://xml.org/sax/features/namespaces -
3163 \li true -
3164 \li If enabled, namespaces are reported to the content handler. -
3165 \row \li \e http://xml.org/sax/features/namespace-prefixes -
3166 \li false -
3167 \li If enabled, the original prefixed names -
3168 and attributes used for namespace declarations are -
3169 reported. -
3170 \row \li \e http://trolltech.com/xml/features/report-whitespace-only-CharData -
3171 \li true -
3172 \li Obsolete, use the following string instead. -
3173 If enabled, CharData that consist of -
3174 only whitespace characters are reported -
3175 using QXmlContentHandler::characters(). If disabled, whitespace is silently -
3176 discarded. -
3177 \row \li \e http://qt-project.org/xml/features/report-whitespace-only-CharData -
3178 \li true -
3179 \li If enabled, CharData that consist of -
3180 only whitespace characters are reported -
3181 using QXmlContentHandler::characters(). If disabled, whitespace is silently -
3182 discarded. -
3183 \row \li \e http://trolltech.com/xml/features/report-start-end-entity -
3184 \li false -
3185 \li Obsolete, use the following string instead. -
3186 If enabled, the parser reports -
3187 QXmlContentHandler::startEntity() and -
3188 QXmlContentHandler::endEntity() events, so character data -
3189 might be reported in chunks. -
3190 If disabled, the parser does not report these events, but -
3191 silently substitutes the entities, and reports the character -
3192 data in one chunk. -
3193 \row \li \e http://qt-project.org/xml/features/report-start-end-entity -
3194 \li false -
3195 \li If enabled, the parser reports -
3196 QXmlContentHandler::startEntity() and -
3197 QXmlContentHandler::endEntity() events, so character data -
3198 might be reported in chunks. -
3199 If disabled, the parser does not report these events, but -
3200 silently substitutes the entities, and reports the character -
3201 data in one chunk. -
3202 \endtable -
3203 -
3204 \sa feature(), hasFeature(), {SAX2 Features} -
3205*/ -
3206void QXmlSimpleReader::setFeature(const QString& name, bool enable) -
3207{ -
3208 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3209 if (name == QLatin1String("http://xml.org/sax/features/namespaces")) {
evaluated: name == QLatin1String("http://xml.org/sax/features/namespaces")
TRUEFALSE
yes
Evaluation Count:379
yes
Evaluation Count:762
379-762
3210 d->useNamespaces = enable;
executed (the execution status of this line is deduced): d->useNamespaces = enable;
-
3211 } else if (name == QLatin1String("http://xml.org/sax/features/namespace-prefixes")) {
executed: }
Execution Count:379
evaluated: name == QLatin1String("http://xml.org/sax/features/namespace-prefixes")
TRUEFALSE
yes
Evaluation Count:379
yes
Evaluation Count:383
379-383
3212 d->useNamespacePrefixes = enable;
executed (the execution status of this line is deduced): d->useNamespacePrefixes = enable;
-
3213 } else if (name == QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData") // For compat with Qt 4
executed: }
Execution Count:379
evaluated: name == QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData")
TRUEFALSE
yes
Evaluation Count:381
yes
Evaluation Count:2
2-381
3214 || name == QLatin1String("http://qt-project.org/xml/features/report-whitespace-only-CharData")) {
partially evaluated: name == QLatin1String("http://qt-project.org/xml/features/report-whitespace-only-CharData")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3215 d->reportWhitespaceCharData = enable;
executed (the execution status of this line is deduced): d->reportWhitespaceCharData = enable;
-
3216 } else if (name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity") // For compat with Qt 4
executed: }
Execution Count:381
partially evaluated: name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity")
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-381
3217 || name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity")) {
never evaluated: name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity")
0
3218 d->reportEntities = enable;
executed (the execution status of this line is deduced): d->reportEntities = enable;
-
3219 } else {
executed: }
Execution Count:2
2
3220 qWarning("Unknown feature %s", name.toLatin1().data());
never executed (the execution status of this line is deduced): QMessageLogger("sax/qxml.cpp", 3220, __PRETTY_FUNCTION__).warning("Unknown feature %s", name.toLatin1().data());
-
3221 }
never executed: }
0
3222} -
3223 -
3224/*! \reimp -
3225*/ -
3226bool QXmlSimpleReader::hasFeature(const QString& name) const -
3227{ -
3228 if (name == QLatin1String("http://xml.org/sax/features/namespaces")
partially evaluated: name == QLatin1String("http://xml.org/sax/features/namespaces")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
3229 || name == QLatin1String("http://xml.org/sax/features/namespace-prefixes")
partially evaluated: name == QLatin1String("http://xml.org/sax/features/namespace-prefixes")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
3230 || name == QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData") // For compat with Qt 4
evaluated: name == QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData")
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
3231 || name == QLatin1String("http://qt-project.org/xml/features/report-whitespace-only-CharData")
partially evaluated: name == QLatin1String("http://qt-project.org/xml/features/report-whitespace-only-CharData")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3232 || name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity") // For compat with Qt 4
partially evaluated: name == QLatin1String("http://trolltech.com/xml/features/report-start-end-entity")
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
3233 || name == QLatin1String("http://qt-project.org/xml/features/report-start-end-entity")) {
never evaluated: name == QLatin1String("http://qt-project.org/xml/features/report-start-end-entity")
0
3234 return true;
executed: return true;
Execution Count:6
6
3235 } else { -
3236 return false;
never executed: return false;
0
3237 } -
3238} -
3239 -
3240/*! \reimp -
3241*/ -
3242void* QXmlSimpleReader::property(const QString&, bool *ok) const -
3243{ -
3244 if (ok != 0)
never evaluated: ok != 0
0
3245 *ok = false;
never executed: *ok = false;
0
3246 return 0;
never executed: return 0;
0
3247} -
3248 -
3249/*! \reimp -
3250*/ -
3251void QXmlSimpleReader::setProperty(const QString&, void*) -
3252{ -
3253} -
3254 -
3255/*! -
3256 \reimp -
3257*/ -
3258bool QXmlSimpleReader::hasProperty(const QString&) const -
3259{ -
3260 return false;
never executed: return false;
0
3261} -
3262 -
3263/*! -
3264 \reimp -
3265*/ -
3266void QXmlSimpleReader::setEntityResolver(QXmlEntityResolver* handler) -
3267{ -
3268 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3269 d->entityRes = handler;
executed (the execution status of this line is deduced): d->entityRes = handler;
-
3270}
executed: }
Execution Count:1847
1847
3271 -
3272/*! -
3273 \reimp -
3274*/ -
3275QXmlEntityResolver* QXmlSimpleReader::entityResolver() const -
3276{ -
3277 const QXmlSimpleReaderPrivate *d = d_func();
executed (the execution status of this line is deduced): const QXmlSimpleReaderPrivate *d = d_func();
-
3278 return d->entityRes;
executed: return d->entityRes;
Execution Count:2
2
3279} -
3280 -
3281/*! -
3282 \reimp -
3283*/ -
3284void QXmlSimpleReader::setDTDHandler(QXmlDTDHandler* handler) -
3285{ -
3286 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3287 d->dtdHnd = handler;
executed (the execution status of this line is deduced): d->dtdHnd = handler;
-
3288}
executed: }
Execution Count:2230
2230
3289 -
3290/*! -
3291 \reimp -
3292*/ -
3293QXmlDTDHandler* QXmlSimpleReader::DTDHandler() const -
3294{ -
3295 const QXmlSimpleReaderPrivate *d = d_func();
never executed (the execution status of this line is deduced): const QXmlSimpleReaderPrivate *d = d_func();
-
3296 return d->dtdHnd;
never executed: return d->dtdHnd;
0
3297} -
3298 -
3299/*! -
3300 \reimp -
3301*/ -
3302void QXmlSimpleReader::setContentHandler(QXmlContentHandler* handler) -
3303{ -
3304 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3305 d->contentHnd = handler;
executed (the execution status of this line is deduced): d->contentHnd = handler;
-
3306}
executed: }
Execution Count:2244
2244
3307 -
3308/*! -
3309 \reimp -
3310*/ -
3311QXmlContentHandler* QXmlSimpleReader::contentHandler() const -
3312{ -
3313 const QXmlSimpleReaderPrivate *d = d_func();
executed (the execution status of this line is deduced): const QXmlSimpleReaderPrivate *d = d_func();
-
3314 return d->contentHnd;
executed: return d->contentHnd;
Execution Count:2
2
3315} -
3316 -
3317/*! -
3318 \reimp -
3319*/ -
3320void QXmlSimpleReader::setErrorHandler(QXmlErrorHandler* handler) -
3321{ -
3322 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3323 d->errorHnd = handler;
executed (the execution status of this line is deduced): d->errorHnd = handler;
-
3324}
executed: }
Execution Count:2235
2235
3325 -
3326/*! -
3327 \reimp -
3328*/ -
3329QXmlErrorHandler* QXmlSimpleReader::errorHandler() const -
3330{ -
3331 const QXmlSimpleReaderPrivate *d = d_func();
executed (the execution status of this line is deduced): const QXmlSimpleReaderPrivate *d = d_func();
-
3332 return d->errorHnd;
executed: return d->errorHnd;
Execution Count:2
2
3333} -
3334 -
3335/*! -
3336 \reimp -
3337*/ -
3338void QXmlSimpleReader::setLexicalHandler(QXmlLexicalHandler* handler) -
3339{ -
3340 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3341 d->lexicalHnd = handler;
executed (the execution status of this line is deduced): d->lexicalHnd = handler;
-
3342}
executed: }
Execution Count:2232
2232
3343 -
3344/*! -
3345 \reimp -
3346*/ -
3347QXmlLexicalHandler* QXmlSimpleReader::lexicalHandler() const -
3348{ -
3349 const QXmlSimpleReaderPrivate *d = d_func();
executed (the execution status of this line is deduced): const QXmlSimpleReaderPrivate *d = d_func();
-
3350 return d->lexicalHnd;
executed: return d->lexicalHnd;
Execution Count:2
2
3351} -
3352 -
3353/*! -
3354 \reimp -
3355*/ -
3356void QXmlSimpleReader::setDeclHandler(QXmlDeclHandler* handler) -
3357{ -
3358 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3359 d->declHnd = handler;
executed (the execution status of this line is deduced): d->declHnd = handler;
-
3360}
executed: }
Execution Count:2232
2232
3361 -
3362/*! -
3363 \reimp -
3364*/ -
3365QXmlDeclHandler* QXmlSimpleReader::declHandler() const -
3366{ -
3367 const QXmlSimpleReaderPrivate *d = d_func();
executed (the execution status of this line is deduced): const QXmlSimpleReaderPrivate *d = d_func();
-
3368 return d->declHnd;
executed: return d->declHnd;
Execution Count:2
2
3369} -
3370 -
3371 -
3372 -
3373/*! -
3374 \reimp -
3375*/ -
3376bool QXmlSimpleReader::parse(const QXmlInputSource& input) -
3377{ -
3378 return parse(&input, false);
executed: return parse(&input, false);
Execution Count:359
359
3379} -
3380 -
3381/*! -
3382 Reads an XML document from \a input and parses it in one pass (non-incrementally). -
3383 Returns true if the parsing was successful; otherwise returns false. -
3384*/ -
3385bool QXmlSimpleReader::parse(const QXmlInputSource* input) -
3386{ -
3387 return parse(input, false);
executed: return parse(input, false);
Execution Count:391
391
3388} -
3389 -
3390/*! -
3391 Reads an XML document from \a input and parses it. Returns true -
3392 if the parsing is completed successfully; otherwise returns false, -
3393 indicating that an error occurred. -
3394 -
3395 If \a incremental is false, this function will return false if the XML -
3396 file is not read completely. The parsing cannot be continued in this -
3397 case. -
3398 -
3399 If \a incremental is true, the parser does not return false if -
3400 it reaches the end of the \a input before reaching the end -
3401 of the XML file. Instead, it stores the state of the parser so that -
3402 parsing can be continued later when more data is available. -
3403 In such a case, you can use the function parseContinue() to -
3404 continue with parsing. This class stores a pointer to the input -
3405 source \a input and the parseContinue() function tries to read from -
3406 that input source. Therefore, you should not delete the input -
3407 source \a input until you no longer need to call parseContinue(). -
3408 -
3409 If this function is called with \a incremental set to true -
3410 while an incremental parse is in progress, a new parsing -
3411 session will be started, and the previous session will be lost. -
3412 -
3413 \sa parseContinue(), QTcpSocket -
3414*/ -
3415bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental) -
3416{ -
3417 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3418 -
3419 if (incremental) {
evaluated: incremental
TRUEFALSE
yes
Evaluation Count:1490
yes
Evaluation Count:755
755-1490
3420 d->initIncrementalParsing();
executed (the execution status of this line is deduced): d->initIncrementalParsing();
-
3421 } else {
executed: }
Execution Count:1490
1490
3422 delete d->parseStack;
executed (the execution status of this line is deduced): delete d->parseStack;
-
3423 d->parseStack = 0;
executed (the execution status of this line is deduced): d->parseStack = 0;
-
3424 }
executed: }
Execution Count:755
755
3425 d->init(input);
executed (the execution status of this line is deduced): d->init(input);
-
3426 -
3427 // call the handler -
3428 if (d->contentHnd) {
evaluated: d->contentHnd
TRUEFALSE
yes
Evaluation Count:2242
yes
Evaluation Count:3
3-2242
3429 d->contentHnd->setDocumentLocator(d->locator.data());
executed (the execution status of this line is deduced): d->contentHnd->setDocumentLocator(d->locator.data());
-
3430 if (!d->contentHnd->startDocument()) {
partially evaluated: !d->contentHnd->startDocument()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2242
0-2242
3431 d->reportParseError(d->contentHnd->errorString());
never executed (the execution status of this line is deduced): d->reportParseError(d->contentHnd->errorString());
-
3432 d->tags.clear();
never executed (the execution status of this line is deduced): d->tags.clear();
-
3433 return false;
never executed: return false;
0
3434 } -
3435 }
executed: }
Execution Count:2242
2242
3436 qt_xml_skipped_entity_in_content = false;
executed (the execution status of this line is deduced): qt_xml_skipped_entity_in_content = false;
-
3437 return d->parseBeginOrContinue(0, incremental);
executed: return d->parseBeginOrContinue(0, incremental);
Execution Count:2245
2245
3438} -
3439 -
3440/*! -
3441 Continues incremental parsing, taking input from the -
3442 QXmlInputSource that was specified with the most recent -
3443 call to parse(). To use this function, you \e must have called -
3444 parse() with the incremental argument set to true. -
3445 -
3446 Returns false if a parsing error occurs; otherwise returns true, -
3447 even if the end of the XML file has not been reached. You can -
3448 continue parsing at a later stage by calling this function again -
3449 when there is more data available to parse. -
3450 -
3451 Calling this function when there is no data available in the input -
3452 source indicates to the reader that the end of the XML file has -
3453 been reached. If the input supplied up to this point was -
3454 not well-formed then a parsing error occurs, and false is returned. -
3455 If the input supplied was well-formed, true is returned. -
3456 It is important to end the input in this way because it allows you -
3457 to reuse the reader to parse other XML files. -
3458 -
3459 Calling this function after the end of file has been reached, but -
3460 without available data will cause false to be returned whether the -
3461 previous input was well-formed or not. -
3462 -
3463 \sa parse(), QXmlInputSource::data(), QXmlInputSource::next() -
3464*/ -
3465bool QXmlSimpleReader::parseContinue() -
3466{ -
3467 Q_D(QXmlSimpleReader);
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate * const d = d_func();
-
3468 if (d->parseStack == 0 || d->parseStack->isEmpty())
evaluated: d->parseStack == 0
TRUEFALSE
yes
Evaluation Count:1490
yes
Evaluation Count:44908
partially evaluated: d->parseStack->isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44908
0-44908
3469 return false;
executed: return false;
Execution Count:1490
1490
3470 d->initData();
executed (the execution status of this line is deduced): d->initData();
-
3471 int state = d->parseStack->pop().state;
executed (the execution status of this line is deduced): int state = d->parseStack->pop().state;
-
3472 return d->parseBeginOrContinue(state, true);
executed: return d->parseBeginOrContinue(state, true);
Execution Count:44908
44908
3473} -
3474 -
3475/* -
3476 Common part of parse() and parseContinue() -
3477*/ -
3478bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental) -
3479{ -
3480 bool atEndOrig = atEnd();
executed (the execution status of this line is deduced): bool atEndOrig = atEnd();
-
3481 -
3482 if (state==0) {
evaluated: state==0
TRUEFALSE
yes
Evaluation Count:36186
yes
Evaluation Count:10967
10967-36186
3483 if (!parseProlog()) {
evaluated: !parseProlog()
TRUEFALSE
yes
Evaluation Count:34025
yes
Evaluation Count:2161
2161-34025
3484 if (incremental && error.isNull()) {
evaluated: incremental
TRUEFALSE
yes
Evaluation Count:33941
yes
Evaluation Count:84
partially evaluated: error.isNull()
TRUEFALSE
yes
Evaluation Count:33941
no
Evaluation Count:0
0-33941
3485 pushParseState(0, 0);
executed (the execution status of this line is deduced): pushParseState(0, 0);
-
3486 return true;
executed: return true;
Execution Count:33941
33941
3487 } else { -
3488 tags.clear();
executed (the execution status of this line is deduced): tags.clear();
-
3489 return false;
executed: return false;
Execution Count:84
84
3490 } -
3491 } -
3492 state = 1;
executed (the execution status of this line is deduced): state = 1;
-
3493 }
executed: }
Execution Count:2161
2161
3494 if (state==1) {
evaluated: state==1
TRUEFALSE
yes
Evaluation Count:10614
yes
Evaluation Count:2514
2514-10614
3495 if (!parseElement()) {
evaluated: !parseElement()
TRUEFALSE
yes
Evaluation Count:8517
yes
Evaluation Count:2097
2097-8517
3496 if (incremental && error.isNull()) {
evaluated: incremental
TRUEFALSE
yes
Evaluation Count:8453
yes
Evaluation Count:64
partially evaluated: error.isNull()
TRUEFALSE
yes
Evaluation Count:8453
no
Evaluation Count:0
0-8453
3497 pushParseState(0, 1);
executed (the execution status of this line is deduced): pushParseState(0, 1);
-
3498 return true;
executed: return true;
Execution Count:8453
8453
3499 } else { -
3500 tags.clear();
executed (the execution status of this line is deduced): tags.clear();
-
3501 return false;
executed: return false;
Execution Count:64
64
3502 } -
3503 } -
3504 state = 2;
executed (the execution status of this line is deduced): state = 2;
-
3505 }
executed: }
Execution Count:2097
2097
3506 // parse Misc* -
3507 while (!atEnd()) {
evaluated: !atEnd()
TRUEFALSE
yes
Evaluation Count:2559
yes
Evaluation Count:2528
2528-2559
3508 if (!parseMisc()) {
evaluated: !parseMisc()
TRUEFALSE
yes
Evaluation Count:2083
yes
Evaluation Count:476
476-2083
3509 if (incremental && error.isNull()) {
evaluated: incremental
TRUEFALSE
yes
Evaluation Count:2073
yes
Evaluation Count:10
partially evaluated: error.isNull()
TRUEFALSE
yes
Evaluation Count:2073
no
Evaluation Count:0
0-2073
3510 pushParseState(0, 2);
executed (the execution status of this line is deduced): pushParseState(0, 2);
-
3511 return true;
executed: return true;
Execution Count:2073
2073
3512 } else { -
3513 tags.clear();
executed (the execution status of this line is deduced): tags.clear();
-
3514 return false;
executed: return false;
Execution Count:10
10
3515 } -
3516 } -
3517 }
executed: }
Execution Count:476
476
3518 if (!atEndOrig && incremental) {
evaluated: !atEndOrig
TRUEFALSE
yes
Evaluation Count:1038
yes
Evaluation Count:1490
evaluated: incremental
TRUEFALSE
yes
Evaluation Count:441
yes
Evaluation Count:597
441-1490
3519 // we parsed something at all, so be prepared to come back later -
3520 pushParseState(0, 2);
executed (the execution status of this line is deduced): pushParseState(0, 2);
-
3521 return true;
executed: return true;
Execution Count:441
441
3522 } -
3523 // is stack empty? -
3524 if (!tags.isEmpty() && !error.isNull()) {
partially evaluated: !tags.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2087
never evaluated: !error.isNull()
0-2087
3525 reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected end of file"));
-
3526 tags.clear();
never executed (the execution status of this line is deduced): tags.clear();
-
3527 return false;
never executed: return false;
0
3528 } -
3529 // call the handler -
3530 if (contentHnd) {
evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:2086
yes
Evaluation Count:1
1-2086
3531 delete parseStack;
executed (the execution status of this line is deduced): delete parseStack;
-
3532 parseStack = 0;
executed (the execution status of this line is deduced): parseStack = 0;
-
3533 if (!contentHnd->endDocument()) {
partially evaluated: !contentHnd->endDocument()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2086
0-2086
3534 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
3535 return false;
never executed: return false;
0
3536 } -
3537 }
executed: }
Execution Count:2086
2086
3538 return true;
executed: return true;
Execution Count:2087
2087
3539} -
3540 -
3541// -
3542// The following private parse functions have another semantics for the return -
3543// value: They return true iff parsing has finished successfully (i.e. the end -
3544// of the XML file must be reached!). If one of these functions return false, -
3545// there is only an error when d->error.isNULL() is also false. -
3546// -
3547 -
3548/* -
3549 For the incremental parsing, it is very important that the parse...() -
3550 functions have a certain structure. Since it might be hard to understand how -
3551 they work, here is a description of the layout of these functions: -
3552 -
3553 bool QXmlSimpleReader::parse...() -
3554 { -
3555(1) const signed char Init = 0; -
3556 ... -
3557 -
3558(2) const signed char Inp... = 0; -
3559 ... -
3560 -
3561(3) static const signed char table[3][2] = { -
3562 ... -
3563 }; -
3564 signed char state; -
3565 signed char input; -
3566 -
3567(4) if (d->parseStack == 0 || d->parseStack->isEmpty()) { -
3568(4a) ... -
3569 } else { -
3570(4b) ... -
3571 } -
3572 -
3573 for (; ;) { -
3574(5) switch (state) { -
3575 ... -
3576 } -
3577 -
3578(6) -
3579(6a) if (atEnd()) { -
3580 unexpectedEof(&QXmlSimpleReader::parseNmtoken, state); -
3581 return false; -
3582 } -
3583(6b) if (determineNameChar(c) != NotName) { -
3584 ... -
3585 } -
3586(7) state = table[state][input]; -
3587 -
3588(8) switch (state) { -
3589 ... -
3590 } -
3591 } -
3592 } -
3593 -
3594 Explanation: -
3595 ad 1: constants for the states (used in the transition table) -
3596 ad 2: constants for the input (used in the transition table) -
3597 ad 3: the transition table for the state machine -
3598 ad 4: test if we are in a parseContinue() step -
3599 a) if no, do inititalizations -
3600 b) if yes, restore the state and call parse functions recursively -
3601 ad 5: Do some actions according to the state; from the logical execution -
3602 order, this code belongs after 8 (see there for an explanation) -
3603 ad 6: Check the character that is at the actual "cursor" position: -
3604 a) If we reached the EOF, report either error or push the state (in the -
3605 case of incremental parsing). -
3606 b) Otherwise, set the input character constant for the transition -
3607 table. -
3608 ad 7: Get the new state according to the input that was read. -
3609 ad 8: Do some actions according to the state. The last line in every case -
3610 statement reads new data (i.e. it move the cursor). This can also be -
3611 done by calling another parse...() function. If you need processing for -
3612 this state after that, you have to put it into the switch statement 5. -
3613 This ensures that you have a well defined re-entry point, when you ran -
3614 out of data. -
3615*/ -
3616 -
3617/* -
3618 Parses the prolog [22]. -
3619*/ -
3620 -
3621bool QXmlSimpleReaderPrivate::parseProlog() -
3622{ -
3623 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
3624 const signed char EatWS = 1; // eat white spaces
executed (the execution status of this line is deduced): const signed char EatWS = 1;
-
3625 const signed char Lt = 2; // '<' read
executed (the execution status of this line is deduced): const signed char Lt = 2;
-
3626 const signed char Em = 3; // '!' read
executed (the execution status of this line is deduced): const signed char Em = 3;
-
3627 const signed char DocType = 4; // read doctype
executed (the execution status of this line is deduced): const signed char DocType = 4;
-
3628 const signed char Comment = 5; // read comment
executed (the execution status of this line is deduced): const signed char Comment = 5;
-
3629 const signed char CommentR = 6; // same as Comment, but already reported
executed (the execution status of this line is deduced): const signed char CommentR = 6;
-
3630 const signed char PInstr = 7; // read PI
executed (the execution status of this line is deduced): const signed char PInstr = 7;
-
3631 const signed char PInstrR = 8; // same as PInstr, but already reported
executed (the execution status of this line is deduced): const signed char PInstrR = 8;
-
3632 const signed char Done = 9;
executed (the execution status of this line is deduced): const signed char Done = 9;
-
3633 -
3634 const signed char InpWs = 0;
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
3635 const signed char InpLt = 1; // <
executed (the execution status of this line is deduced): const signed char InpLt = 1;
-
3636 const signed char InpQm = 2; // ?
executed (the execution status of this line is deduced): const signed char InpQm = 2;
-
3637 const signed char InpEm = 3; // !
executed (the execution status of this line is deduced): const signed char InpEm = 3;
-
3638 const signed char InpD = 4; // D
executed (the execution status of this line is deduced): const signed char InpD = 4;
-
3639 const signed char InpDash = 5; // -
executed (the execution status of this line is deduced): const signed char InpDash = 5;
-
3640 const signed char InpUnknown = 6;
executed (the execution status of this line is deduced): const signed char InpUnknown = 6;
-
3641 -
3642 static const signed char table[9][7] = { -
3643 /* InpWs InpLt InpQm InpEm InpD InpDash InpUnknown */ -
3644 { EatWS, Lt, -1, -1, -1, -1, -1 }, // Init -
3645 { -1, Lt, -1, -1, -1, -1, -1 }, // EatWS -
3646 { -1, -1, PInstr,Em, Done, -1, Done }, // Lt -
3647 { -1, -1, -1, -1, DocType, Comment, -1 }, // Em -
3648 { EatWS, Lt, -1, -1, -1, -1, -1 }, // DocType -
3649 { EatWS, Lt, -1, -1, -1, -1, -1 }, // Comment -
3650 { EatWS, Lt, -1, -1, -1, -1, -1 }, // CommentR -
3651 { EatWS, Lt, -1, -1, -1, -1, -1 }, // PInstr -
3652 { EatWS, Lt, -1, -1, -1, -1, -1 } // PInstrR -
3653 }; -
3654 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
3655 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
3656 -
3657 if (parseStack == 0 || parseStack->isEmpty()) {
evaluated: parseStack == 0
TRUEFALSE
yes
Evaluation Count:755
yes
Evaluation Count:35431
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1490
yes
Evaluation Count:33941
755-35431
3658 xmldecl_possible = true;
executed (the execution status of this line is deduced): xmldecl_possible = true;
-
3659 doctype_read = false;
executed (the execution status of this line is deduced): doctype_read = false;
-
3660 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
3661 } else {
executed: }
Execution Count:2245
2245
3662 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
3663#if defined(QT_QXML_DEBUG) -
3664 qDebug("QXmlSimpleReader: parseProlog (cont) in state %d", state); -
3665#endif -
3666 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:32278
yes
Evaluation Count:1663
1663-32278
3667 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
3668 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:923
yes
Evaluation Count:31355
923-31355
3669 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
3670#if defined(QT_QXML_DEBUG) -
3671 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
3672#endif -
3673 }
executed: }
Execution Count:923
923
3674 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:29925
yes
Evaluation Count:2353
2353-29925
3675 parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
-
3676 return false;
executed: return false;
Execution Count:29925
29925
3677 } -
3678 }
executed: }
Execution Count:2353
2353
3679 }
executed: }
Execution Count:4016
4016
3680 -
3681 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
3682 switch (state) { -
3683 case DocType: -
3684 if (doctype_read) {
partially evaluated: doctype_read
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2338
0-2338
3685 reportParseError(QLatin1String(XMLERR_MORETHANONEDOCTYPE));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("more than one document type definition"));
-
3686 return false;
never executed: return false;
0
3687 } else { -
3688 doctype_read = false;
executed (the execution status of this line is deduced): doctype_read = false;
-
3689 }
executed: }
Execution Count:2338
2338
3690 break;
executed: break;
Execution Count:2338
2338
3691 case Comment: -
3692 if (lexicalHnd) {
evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:348
yes
Evaluation Count:5
5-348
3693 if (!lexicalHnd->comment(string())) {
partially evaluated: !lexicalHnd->comment(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:348
0-348
3694 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
3695 return false;
never executed: return false;
0
3696 } -
3697 }
executed: }
Execution Count:348
348
3698 state = CommentR;
executed (the execution status of this line is deduced): state = CommentR;
-
3699 break;
executed: break;
Execution Count:353
353
3700 case PInstr: -
3701 // call the handler -
3702 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:263
no
Evaluation Count:0
0-263
3703 if (xmldecl_possible && !xmlVersion.isEmpty()) {
evaluated: xmldecl_possible
TRUEFALSE
yes
Evaluation Count:238
yes
Evaluation Count:25
evaluated: !xmlVersion.isEmpty()
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:13
13-238
3704 QString value(QLatin1String("version='"));
executed (the execution status of this line is deduced): QString value(QLatin1String("version='"));
-
3705 value += xmlVersion;
executed (the execution status of this line is deduced): value += xmlVersion;
-
3706 value += QLatin1Char('\'');
executed (the execution status of this line is deduced): value += QLatin1Char('\'');
-
3707 if (!encoding.isEmpty()) {
evaluated: !encoding.isEmpty()
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:82
82-143
3708 value += QLatin1String(" encoding='");
executed (the execution status of this line is deduced): value += QLatin1String(" encoding='");
-
3709 value += encoding;
executed (the execution status of this line is deduced): value += encoding;
-
3710 value += QLatin1Char('\'');
executed (the execution status of this line is deduced): value += QLatin1Char('\'');
-
3711 }
executed: }
Execution Count:143
143
3712 if (standalone == QXmlSimpleReaderPrivate::Yes) {
evaluated: standalone == QXmlSimpleReaderPrivate::Yes
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:202
23-202
3713 value += QLatin1String(" standalone='yes'");
executed (the execution status of this line is deduced): value += QLatin1String(" standalone='yes'");
-
3714 } else if (standalone == QXmlSimpleReaderPrivate::No) {
executed: }
Execution Count:23
evaluated: standalone == QXmlSimpleReaderPrivate::No
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:172
23-172
3715 value += QLatin1String(" standalone='no'");
executed (the execution status of this line is deduced): value += QLatin1String(" standalone='no'");
-
3716 }
executed: }
Execution Count:30
30
3717 if (!contentHnd->processingInstruction(QLatin1String("xml"), value)) {
partially evaluated: !contentHnd->processingInstruction(QLatin1String("xml"), value)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:225
0-225
3718 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
3719 return false;
never executed: return false;
0
3720 } -
3721 } else {
executed: }
Execution Count:225
225
3722 if (!contentHnd->processingInstruction(name(), string())) {
partially evaluated: !contentHnd->processingInstruction(name(), string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38
0-38
3723 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
3724 return false;
never executed: return false;
0
3725 } -
3726 }
executed: }
Execution Count:38
38
3727 } -
3728 // XML declaration only on first position possible -
3729 xmldecl_possible = false;
executed (the execution status of this line is deduced): xmldecl_possible = false;
-
3730 state = PInstrR;
executed (the execution status of this line is deduced): state = PInstrR;
-
3731 break;
executed: break;
Execution Count:263
263
3732 case Done: -
3733 return true;
executed: return true;
Execution Count:2161
2161
3734 case -1: -
3735 reportParseError(QLatin1String(XMLERR_ERRORPARSINGELEMENT));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing element"));
-
3736 return false;
executed: return false;
Execution Count:6
6
3737 } -
3738 -
3739 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:1665
yes
Evaluation Count:14132
1665-14132
3740 unexpectedEof(&QXmlSimpleReaderPrivate::parseProlog, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseProlog, state);
-
3741 return false;
executed: return false;
Execution Count:1665
1665
3742 } -
3743 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:2502
yes
Evaluation Count:11630
2502-11630
3744 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
3745 } else if (c == QLatin1Char('<')) {
executed: }
Execution Count:2502
evaluated: c == QLatin1Char('<')
TRUEFALSE
yes
Evaluation Count:4692
yes
Evaluation Count:6938
2502-6938
3746 input = InpLt;
executed (the execution status of this line is deduced): input = InpLt;
-
3747 } else if (c == QLatin1Char('?')) {
executed: }
Execution Count:4692
evaluated: c == QLatin1Char('?')
TRUEFALSE
yes
Evaluation Count:287
yes
Evaluation Count:6651
287-6651
3748 input = InpQm;
executed (the execution status of this line is deduced): input = InpQm;
-
3749 } else if (c == QLatin1Char('!')) {
executed: }
Execution Count:287
evaluated: c == QLatin1Char('!')
TRUEFALSE
yes
Evaluation Count:2243
yes
Evaluation Count:4408
287-4408
3750 input = InpEm;
executed (the execution status of this line is deduced): input = InpEm;
-
3751 } else if (c == QLatin1Char('D')) {
executed: }
Execution Count:2243
evaluated: c == QLatin1Char('D')
TRUEFALSE
yes
Evaluation Count:1887
yes
Evaluation Count:2521
1887-2521
3752 input = InpD;
executed (the execution status of this line is deduced): input = InpD;
-
3753 } else if (c == QLatin1Char('-')) {
executed: }
Execution Count:1887
evaluated: c == QLatin1Char('-')
TRUEFALSE
yes
Evaluation Count:354
yes
Evaluation Count:2167
354-2167
3754 input = InpDash;
executed (the execution status of this line is deduced): input = InpDash;
-
3755 } else {
executed: }
Execution Count:354
354
3756 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
3757 }
executed: }
Execution Count:2167
2167
3758 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
3759 -
3760 switch (state) { -
3761 case EatWS: -
3762 // XML declaration only on first position possible -
3763 xmldecl_possible = false;
executed (the execution status of this line is deduced): xmldecl_possible = false;
-
3764 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:746
yes
Evaluation Count:1756
746-1756
3765 parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
-
3766 return false;
executed: return false;
Execution Count:746
746
3767 } -
3768 break;
executed: break;
Execution Count:1756
1756
3769 case Lt: -
3770 next();
executed (the execution status of this line is deduced): next();
-
3771 break;
executed: break;
Execution Count:4692
4692
3772 case Em: -
3773 // XML declaration only on first position possible -
3774 xmldecl_possible = false;
executed (the execution status of this line is deduced): xmldecl_possible = false;
-
3775 next();
executed (the execution status of this line is deduced): next();
-
3776 break;
executed: break;
Execution Count:2243
2243
3777 case DocType: -
3778 if (!parseDoctype()) {
evaluated: !parseDoctype()
TRUEFALSE
yes
Evaluation Count:1541
yes
Evaluation Count:346
346-1541
3779 parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
-
3780 return false;
executed: return false;
Execution Count:1541
1541
3781 } -
3782 break;
executed: break;
Execution Count:346
346
3783 case Comment: -
3784 case CommentR: -
3785 if (!parseComment()) {
evaluated: !parseComment()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:344
10-344
3786 parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
-
3787 return false;
executed: return false;
Execution Count:10
10
3788 } -
3789 break;
executed: break;
Execution Count:344
344
3790 case PInstr: -
3791 case PInstrR: -
3792 parsePI_xmldecl = xmldecl_possible;
executed (the execution status of this line is deduced): parsePI_xmldecl = xmldecl_possible;
-
3793 if (!parsePI()) {
evaluated: !parsePI()
TRUEFALSE
yes
Evaluation Count:132
yes
Evaluation Count:155
132-155
3794 parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseProlog, state);
-
3795 return false;
executed: return false;
Execution Count:132
132
3796 } -
3797 break;
executed: break;
Execution Count:155
155
3798 } -
3799 }
executed: }
Execution Count:11703
11703
3800 return false;
never executed: return false;
0
3801} -
3802 -
3803/* -
3804 Parse an element [39]. -
3805 -
3806 Precondition: the opening '<' is already read. -
3807*/ -
3808bool QXmlSimpleReaderPrivate::parseElement() -
3809{ -
3810 const int Init = 0;
executed (the execution status of this line is deduced): const int Init = 0;
-
3811 const int ReadName = 1;
executed (the execution status of this line is deduced): const int ReadName = 1;
-
3812 const int Ws1 = 2;
executed (the execution status of this line is deduced): const int Ws1 = 2;
-
3813 const int STagEnd = 3;
executed (the execution status of this line is deduced): const int STagEnd = 3;
-
3814 const int STagEnd2 = 4;
executed (the execution status of this line is deduced): const int STagEnd2 = 4;
-
3815 const int ETagBegin = 5;
executed (the execution status of this line is deduced): const int ETagBegin = 5;
-
3816 const int ETagBegin2 = 6;
executed (the execution status of this line is deduced): const int ETagBegin2 = 6;
-
3817 const int Ws2 = 7;
executed (the execution status of this line is deduced): const int Ws2 = 7;
-
3818 const int EmptyTag = 8;
executed (the execution status of this line is deduced): const int EmptyTag = 8;
-
3819 const int Attrib = 9;
executed (the execution status of this line is deduced): const int Attrib = 9;
-
3820 const int AttribPro = 10; // like Attrib, but processAttribute was already called
executed (the execution status of this line is deduced): const int AttribPro = 10;
-
3821 const int Ws3 = 11;
executed (the execution status of this line is deduced): const int Ws3 = 11;
-
3822 const int Done = 12;
executed (the execution status of this line is deduced): const int Done = 12;
-
3823 -
3824 const int InpWs = 0; // whitespace
executed (the execution status of this line is deduced): const int InpWs = 0;
-
3825 const int InpNameBe = 1; // NameBeginning
executed (the execution status of this line is deduced): const int InpNameBe = 1;
-
3826 const int InpGt = 2; // >
executed (the execution status of this line is deduced): const int InpGt = 2;
-
3827 const int InpSlash = 3; // /
executed (the execution status of this line is deduced): const int InpSlash = 3;
-
3828 const int InpUnknown = 4;
executed (the execution status of this line is deduced): const int InpUnknown = 4;
-
3829 -
3830 static const int table[12][5] = { -
3831 /* InpWs InpNameBe InpGt InpSlash InpUnknown */ -
3832 { -1, ReadName, -1, -1, -1 }, // Init -
3833 { Ws1, Attrib, STagEnd, EmptyTag, -1 }, // ReadName -
3834 { -1, Attrib, STagEnd, EmptyTag, -1 }, // Ws1 -
3835 { STagEnd2, STagEnd2, STagEnd2, STagEnd2, STagEnd2 }, // STagEnd -
3836 { -1, -1, -1, ETagBegin, -1 }, // STagEnd2 -
3837 { -1, ETagBegin2, -1, -1, -1 }, // ETagBegin -
3838 { Ws2, -1, Done, -1, -1 }, // ETagBegin2 -
3839 { -1, -1, Done, -1, -1 }, // Ws2 -
3840 { -1, -1, Done, -1, -1 }, // EmptyTag -
3841 { Ws3, Attrib, STagEnd, EmptyTag, -1 }, // Attrib -
3842 { Ws3, Attrib, STagEnd, EmptyTag, -1 }, // AttribPro -
3843 { -1, Attrib, STagEnd, EmptyTag, -1 } // Ws3 -
3844 }; -
3845 int state;
executed (the execution status of this line is deduced): int state;
-
3846 int input;
executed (the execution status of this line is deduced): int input;
-
3847 -
3848 if (parseStack == 0 || parseStack->isEmpty()) {
evaluated: parseStack == 0
TRUEFALSE
yes
Evaluation Count:40857
yes
Evaluation Count:11462
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1814
yes
Evaluation Count:9648
1814-40857
3849 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
3850 } else {
executed: }
Execution Count:42671
42671
3851 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
3852#if defined(QT_QXML_DEBUG) -
3853 qDebug("QXmlSimpleReader: parseElement (cont) in state %d", state); -
3854#endif -
3855 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:8425
yes
Evaluation Count:1223
1223-8425
3856 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
3857 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:8289
136-8289
3858 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
3859#if defined(QT_QXML_DEBUG) -
3860 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
3861#endif -
3862 }
executed: }
Execution Count:136
136
3863 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:4859
yes
Evaluation Count:3566
3566-4859
3864 parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
-
3865 return false;
executed: return false;
Execution Count:4859
4859
3866 } -
3867 }
executed: }
Execution Count:3566
3566
3868 }
executed: }
Execution Count:4789
4789
3869 -
3870 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
3871 switch (state) { -
3872 case ReadName: -
3873 // store it on the stack -
3874 tags.push(name());
executed (the execution status of this line is deduced): tags.push(name());
-
3875 // empty the attributes -
3876 attList.clear();
executed (the execution status of this line is deduced): attList.clear();
-
3877 if (useNamespaces)
evaluated: useNamespaces
TRUEFALSE
yes
Evaluation Count:4841
yes
Evaluation Count:37826
4841-37826
3878 namespaceSupport.pushContext();
executed: namespaceSupport.pushContext();
Execution Count:4841
4841
3879 break;
executed: break;
Execution Count:42667
42667
3880 case ETagBegin2: -
3881 if (!processElementETagBegin2())
evaluated: !processElementETagBegin2()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:40745
4-40745
3882 return false;
executed: return false;
Execution Count:4
4
3883 break;
executed: break;
Execution Count:40745
40745
3884 case Attrib: -
3885 if (!processElementAttribute())
partially evaluated: !processElementAttribute()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28792
0-28792
3886 return false;
never executed: return false;
0
3887 state = AttribPro;
executed (the execution status of this line is deduced): state = AttribPro;
-
3888 break;
executed: break;
Execution Count:28792
28792
3889 case Done: -
3890 return true;
executed: return true;
Execution Count:42592
42592
3891 case -1: -
3892 reportParseError(QLatin1String(XMLERR_ERRORPARSINGELEMENT));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing element"));
-
3893 return false;
executed: return false;
Execution Count:14
14
3894 } -
3895 -
3896 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:1223
yes
Evaluation Count:308012
1223-308012
3897 unexpectedEof(&QXmlSimpleReaderPrivate::parseElement, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseElement, state);
-
3898 return false;
executed: return false;
Execution Count:1223
1223
3899 } -
3900 if (fastDetermineNameChar(c) == NameBeginning) {
evaluated: fastDetermineNameChar(c) == NameBeginning
TRUEFALSE
yes
Evaluation Count:131397
yes
Evaluation Count:176615
131397-176615
3901 input = InpNameBe;
executed (the execution status of this line is deduced): input = InpNameBe;
-
3902 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:131397
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:83391
yes
Evaluation Count:93224
83391-131397
3903 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
3904 } else if (is_S(c)) {
executed: }
Execution Count:83391
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:42598
yes
Evaluation Count:50626
42598-83391
3905 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
3906 } else if (c == QLatin1Char('/')) {
executed: }
Execution Count:42598
evaluated: c == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:42613
yes
Evaluation Count:8013
8013-42613
3907 input = InpSlash;
executed (the execution status of this line is deduced): input = InpSlash;
-
3908 } else {
executed: }
Execution Count:42613
42613
3909 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
3910 }
executed: }
Execution Count:8013
8013
3911 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
3912 -
3913 switch (state) { -
3914 case ReadName: -
3915 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
3916 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:1145
yes
Evaluation Count:41522
1145-41522
3917 parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
-
3918 return false;
executed: return false;
Execution Count:1145
1145
3919 } -
3920 break;
executed: break;
Execution Count:41522
41522
3921 case Ws1: -
3922 case Ws2: -
3923 case Ws3: -
3924 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:28858
134-28858
3925 parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
-
3926 return false;
executed: return false;
Execution Count:134
134
3927 } -
3928 break;
executed: break;
Execution Count:28858
28858
3929 case STagEnd: -
3930 // call the handler -
3931 if (contentHnd) {
evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:40792
yes
Evaluation Count:4
4-40792
3932 const QString &tagsTop = tags.top();
executed (the execution status of this line is deduced): const QString &tagsTop = tags.top();
-
3933 if (useNamespaces) {
evaluated: useNamespaces
TRUEFALSE
yes
Evaluation Count:4578
yes
Evaluation Count:36214
4578-36214
3934 QString uri, lname;
executed (the execution status of this line is deduced): QString uri, lname;
-
3935 namespaceSupport.processName(tagsTop, false, uri, lname);
executed (the execution status of this line is deduced): namespaceSupport.processName(tagsTop, false, uri, lname);
-
3936 if (!contentHnd->startElement(uri, lname, tagsTop, attList)) {
evaluated: !contentHnd->startElement(uri, lname, tagsTop, attList)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4577
1-4577
3937 reportParseError(contentHnd->errorString());
executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
3938 return false;
executed: return false;
Execution Count:1
1
3939 } -
3940 } else {
executed: }
Execution Count:4577
4577
3941 if (!contentHnd->startElement(QString(), QString(), tagsTop, attList)) {
partially evaluated: !contentHnd->startElement(QString(), QString(), tagsTop, attList)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36214
0-36214
3942 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
3943 return false;
never executed: return false;
0
3944 } -
3945 }
executed: }
Execution Count:36214
36214
3946 } -
3947 next();
executed (the execution status of this line is deduced): next();
-
3948 break;
executed: break;
Execution Count:40795
40795
3949 case STagEnd2: -
3950 if (!parseContent()) {
evaluated: !parseContent()
TRUEFALSE
yes
Evaluation Count:919
yes
Evaluation Count:39876
919-39876
3951 parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
-
3952 return false;
executed: return false;
Execution Count:919
919
3953 } -
3954 break;
executed: break;
Execution Count:39876
39876
3955 case ETagBegin: -
3956 next();
executed (the execution status of this line is deduced): next();
-
3957 break;
executed: break;
Execution Count:40750
40750
3958 case ETagBegin2: -
3959 // get the name of the tag -
3960 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
3961 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:1072
yes
Evaluation Count:39677
1072-39677
3962 parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
-
3963 return false;
executed: return false;
Execution Count:1072
1072
3964 } -
3965 break;
executed: break;
Execution Count:39677
39677
3966 case EmptyTag: -
3967 if (tags.isEmpty()) {
partially evaluated: tags.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1850
0-1850
3968 reportParseError(QLatin1String(XMLERR_TAGMISMATCH));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("tag mismatch"));
-
3969 return false;
never executed: return false;
0
3970 } -
3971 if (!processElementEmptyTag())
partially evaluated: !processElementEmptyTag()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1850
0-1850
3972 return false;
never executed: return false;
0
3973 next();
executed (the execution status of this line is deduced): next();
-
3974 break;
executed: break;
Execution Count:1850
1850
3975 case Attrib: -
3976 case AttribPro: -
3977 // get name and value of attribute -
3978 if (!parseAttribute()) {
evaluated: !parseAttribute()
TRUEFALSE
yes
Evaluation Count:356
yes
Evaluation Count:28451
356-28451
3979 parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElement, state);
-
3980 return false;
executed: return false;
Execution Count:356
356
3981 } -
3982 break;
executed: break;
Execution Count:28451
28451
3983 case Done: -
3984 next();
executed (the execution status of this line is deduced): next();
-
3985 break;
executed: break;
Execution Count:42592
42592
3986 } -
3987 }
executed: }
Execution Count:304385
304385
3988 return false;
never executed: return false;
0
3989} -
3990 -
3991/* -
3992 Helper to break down the size of the code in the case statement. -
3993 Return false on error, otherwise true. -
3994*/ -
3995bool QXmlSimpleReaderPrivate::processElementEmptyTag() -
3996{ -
3997 QString uri, lname;
executed (the execution status of this line is deduced): QString uri, lname;
-
3998 // pop the stack and call the handler -
3999 if (contentHnd) {
evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:1841
yes
Evaluation Count:9
9-1841
4000 if (useNamespaces) {
evaluated: useNamespaces
TRUEFALSE
yes
Evaluation Count:229
yes
Evaluation Count:1612
229-1612
4001 // report startElement first... -
4002 namespaceSupport.processName(tags.top(), false, uri, lname);
executed (the execution status of this line is deduced): namespaceSupport.processName(tags.top(), false, uri, lname);
-
4003 if (!contentHnd->startElement(uri, lname, tags.top(), attList)) {
partially evaluated: !contentHnd->startElement(uri, lname, tags.top(), attList)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:229
0-229
4004 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4005 return false;
never executed: return false;
0
4006 } -
4007 // ... followed by endElement... -
4008 if (!contentHnd->endElement(uri, lname, tags.pop())) {
partially evaluated: !contentHnd->endElement(uri, lname, tags.pop())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:229
0-229
4009 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4010 return false;
never executed: return false;
0
4011 } -
4012 // ... followed by endPrefixMapping -
4013 QStringList prefixesBefore, prefixesAfter;
executed (the execution status of this line is deduced): QStringList prefixesBefore, prefixesAfter;
-
4014 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:229
no
Evaluation Count:0
0-229
4015 prefixesBefore = namespaceSupport.prefixes();
executed (the execution status of this line is deduced): prefixesBefore = namespaceSupport.prefixes();
-
4016 }
executed: }
Execution Count:229
229
4017 namespaceSupport.popContext();
executed (the execution status of this line is deduced): namespaceSupport.popContext();
-
4018 // call the handler for prefix mapping -
4019 prefixesAfter = namespaceSupport.prefixes();
executed (the execution status of this line is deduced): prefixesAfter = namespaceSupport.prefixes();
-
4020 for (QStringList::Iterator it = prefixesBefore.begin(); it != prefixesBefore.end(); ++it) {
evaluated: it != prefixesBefore.end()
TRUEFALSE
yes
Evaluation Count:239
yes
Evaluation Count:229
229-239
4021 if (!prefixesAfter.contains(*it)) {
evaluated: !prefixesAfter.contains(*it)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:233
6-233
4022 if (!contentHnd->endPrefixMapping(*it)) {
partially evaluated: !contentHnd->endPrefixMapping(*it)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
4023 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4024 return false;
never executed: return false;
0
4025 } -
4026 }
executed: }
Execution Count:6
6
4027 }
executed: }
Execution Count:239
239
4028 } else {
executed: }
Execution Count:229
229
4029 // report startElement first... -
4030 if (!contentHnd->startElement(QString(), QString(), tags.top(), attList)) {
partially evaluated: !contentHnd->startElement(QString(), QString(), tags.top(), attList)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1612
0-1612
4031 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4032 return false;
never executed: return false;
0
4033 } -
4034 // ... followed by endElement -
4035 if (!contentHnd->endElement(QString(), QString(), tags.pop())) {
partially evaluated: !contentHnd->endElement(QString(), QString(), tags.pop())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1612
0-1612
4036 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4037 return false;
never executed: return false;
0
4038 } -
4039 }
executed: }
Execution Count:1612
1612
4040 } else { -
4041 tags.pop_back();
executed (the execution status of this line is deduced): tags.pop_back();
-
4042 namespaceSupport.popContext();
executed (the execution status of this line is deduced): namespaceSupport.popContext();
-
4043 }
executed: }
Execution Count:9
9
4044 return true;
executed: return true;
Execution Count:1850
1850
4045} -
4046/* -
4047 Helper to break down the size of the code in the case statement. -
4048 Return false on error, otherwise true. -
4049*/ -
4050bool QXmlSimpleReaderPrivate::processElementETagBegin2() -
4051{ -
4052 const QString &name = QXmlSimpleReaderPrivate::name();
executed (the execution status of this line is deduced): const QString &name = QXmlSimpleReaderPrivate::name();
-
4053 -
4054 // pop the stack and compare it with the name -
4055 if (tags.pop() != name) {
evaluated: tags.pop() != name
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:40745
4-40745
4056 reportParseError(QLatin1String(XMLERR_TAGMISMATCH));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("tag mismatch"));
-
4057 return false;
executed: return false;
Execution Count:4
4
4058 } -
4059 // call the handler -
4060 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:40745
no
Evaluation Count:0
0-40745
4061 QString uri, lname;
executed (the execution status of this line is deduced): QString uri, lname;
-
4062 -
4063 if (useNamespaces)
evaluated: useNamespaces
TRUEFALSE
yes
Evaluation Count:4531
yes
Evaluation Count:36214
4531-36214
4064 namespaceSupport.processName(name, false, uri, lname);
executed: namespaceSupport.processName(name, false, uri, lname);
Execution Count:4531
4531
4065 if (!contentHnd->endElement(uri, lname, name)) {
partially evaluated: !contentHnd->endElement(uri, lname, name)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40745
0-40745
4066 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4067 return false;
never executed: return false;
0
4068 } -
4069 }
executed: }
Execution Count:40745
40745
4070 if (useNamespaces) {
evaluated: useNamespaces
TRUEFALSE
yes
Evaluation Count:4531
yes
Evaluation Count:36214
4531-36214
4071 NamespaceMap prefixesBefore, prefixesAfter;
executed (the execution status of this line is deduced): NamespaceMap prefixesBefore, prefixesAfter;
-
4072 if (contentHnd)
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:4531
no
Evaluation Count:0
0-4531
4073 prefixesBefore = namespaceSupport.d->ns;
executed: prefixesBefore = namespaceSupport.d->ns;
Execution Count:4531
4531
4074 -
4075 namespaceSupport.popContext();
executed (the execution status of this line is deduced): namespaceSupport.popContext();
-
4076 // call the handler for prefix mapping -
4077 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:4531
no
Evaluation Count:0
0-4531
4078 prefixesAfter = namespaceSupport.d->ns;
executed (the execution status of this line is deduced): prefixesAfter = namespaceSupport.d->ns;
-
4079 if (prefixesBefore.size() != prefixesAfter.size()) {
evaluated: prefixesBefore.size() != prefixesAfter.size()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:4515
16-4515
4080 for (NamespaceMap::const_iterator it = prefixesBefore.constBegin(); it != prefixesBefore.constEnd(); ++it) {
evaluated: it != prefixesBefore.constEnd()
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:16
16-39
4081 if (!it.key().isEmpty() && !prefixesAfter.contains(it.key())) {
evaluated: !it.key().isEmpty()
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:12
evaluated: !prefixesAfter.contains(it.key())
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:18
9-27
4082 if (!contentHnd->endPrefixMapping(it.key())) {
partially evaluated: !contentHnd->endPrefixMapping(it.key())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
4083 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4084 return false;
never executed: return false;
0
4085 } -
4086 }
executed: }
Execution Count:9
9
4087 }
executed: }
Execution Count:39
39
4088 }
executed: }
Execution Count:16
16
4089 }
executed: }
Execution Count:4531
4531
4090 }
executed: }
Execution Count:4531
4531
4091 return true;
executed: return true;
Execution Count:40745
40745
4092} -
4093/* -
4094 Helper to break down the size of the code in the case statement. -
4095 Return false on error, otherwise true. -
4096*/ -
4097bool QXmlSimpleReaderPrivate::processElementAttribute() -
4098{ -
4099 QString uri, lname, prefix;
executed (the execution status of this line is deduced): QString uri, lname, prefix;
-
4100 const QString &name = QXmlSimpleReaderPrivate::name();
executed (the execution status of this line is deduced): const QString &name = QXmlSimpleReaderPrivate::name();
-
4101 const QString &string = QXmlSimpleReaderPrivate::string();
executed (the execution status of this line is deduced): const QString &string = QXmlSimpleReaderPrivate::string();
-
4102 -
4103 // add the attribute to the list -
4104 if (useNamespaces) {
evaluated: useNamespaces
TRUEFALSE
yes
Evaluation Count:12053
yes
Evaluation Count:16739
12053-16739
4105 // is it a namespace declaration? -
4106 namespaceSupport.splitName(name, prefix, lname);
executed (the execution status of this line is deduced): namespaceSupport.splitName(name, prefix, lname);
-
4107 if (prefix == QLatin1String("xmlns")) {
evaluated: prefix == QLatin1String("xmlns")
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:12034
19-12034
4108 // namespace declaration -
4109 namespaceSupport.setPrefix(lname, string);
executed (the execution status of this line is deduced): namespaceSupport.setPrefix(lname, string);
-
4110 if (useNamespacePrefixes) {
partially evaluated: useNamespacePrefixes
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
4111 // according to http://www.w3.org/2000/xmlns/, the "prefix" -
4112 // xmlns maps to the namespace name -
4113 // http://www.w3.org/2000/xmlns/ -
4114 attList.append(name, QLatin1String("http://www.w3.org/2000/xmlns/"), lname, string);
never executed (the execution status of this line is deduced): attList.append(name, QLatin1String("http://www.w3.org/2000/xmlns/"), lname, string);
-
4115 }
never executed: }
0
4116 // call the handler for prefix mapping -
4117 if (contentHnd) {
evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:2
2-17
4118 if (!contentHnd->startPrefixMapping(lname, string)) {
partially evaluated: !contentHnd->startPrefixMapping(lname, string)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
4119 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4120 return false;
never executed: return false;
0
4121 } -
4122 }
executed: }
Execution Count:17
17
4123 } else {
executed: }
Execution Count:19
19
4124 // no namespace delcaration -
4125 namespaceSupport.processName(name, true, uri, lname);
executed (the execution status of this line is deduced): namespaceSupport.processName(name, true, uri, lname);
-
4126 attList.append(name, uri, lname, string);
executed (the execution status of this line is deduced): attList.append(name, uri, lname, string);
-
4127 }
executed: }
Execution Count:12034
12034
4128 } else { -
4129 // no namespace support -
4130 attList.append(name, uri, lname, string);
executed (the execution status of this line is deduced): attList.append(name, uri, lname, string);
-
4131 }
executed: }
Execution Count:16739
16739
4132 return true;
executed: return true;
Execution Count:28792
28792
4133} -
4134 -
4135/* -
4136 Parse a content [43]. -
4137 -
4138 A content is only used between tags. If a end tag is found the < is already -
4139 read and the head stand on the '/' of the end tag '</name>'. -
4140*/ -
4141bool QXmlSimpleReaderPrivate::parseContent() -
4142{ -
4143 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
4144 const signed char ChD = 1; // CharData
executed (the execution status of this line is deduced): const signed char ChD = 1;
-
4145 const signed char ChD1 = 2; // CharData help state
executed (the execution status of this line is deduced): const signed char ChD1 = 2;
-
4146 const signed char ChD2 = 3; // CharData help state
executed (the execution status of this line is deduced): const signed char ChD2 = 3;
-
4147 const signed char Ref = 4; // Reference
executed (the execution status of this line is deduced): const signed char Ref = 4;
-
4148 const signed char Lt = 5; // '<' read
executed (the execution status of this line is deduced): const signed char Lt = 5;
-
4149 const signed char PInstr = 6; // PI
executed (the execution status of this line is deduced): const signed char PInstr = 6;
-
4150 const signed char PInstrR = 7; // same as PInstr, but already reported
executed (the execution status of this line is deduced): const signed char PInstrR = 7;
-
4151 const signed char Elem = 8; // Element
executed (the execution status of this line is deduced): const signed char Elem = 8;
-
4152 const signed char Em = 9; // '!' read
executed (the execution status of this line is deduced): const signed char Em = 9;
-
4153 const signed char Com = 10; // Comment
executed (the execution status of this line is deduced): const signed char Com = 10;
-
4154 const signed char ComR = 11; // same as Com, but already reported
executed (the execution status of this line is deduced): const signed char ComR = 11;
-
4155 const signed char CDS = 12; // CDSect
executed (the execution status of this line is deduced): const signed char CDS = 12;
-
4156 const signed char CDS1 = 13; // read a CDSect
executed (the execution status of this line is deduced): const signed char CDS1 = 13;
-
4157 const signed char CDS2 = 14; // read a CDSect (help state)
executed (the execution status of this line is deduced): const signed char CDS2 = 14;
-
4158 const signed char CDS3 = 15; // read a CDSect (help state)
executed (the execution status of this line is deduced): const signed char CDS3 = 15;
-
4159 const signed char Done = 16; // finished reading content
executed (the execution status of this line is deduced): const signed char Done = 16;
-
4160 -
4161 const signed char InpLt = 0; // <
executed (the execution status of this line is deduced): const signed char InpLt = 0;
-
4162 const signed char InpGt = 1; // >
executed (the execution status of this line is deduced): const signed char InpGt = 1;
-
4163 const signed char InpSlash = 2; // /
executed (the execution status of this line is deduced): const signed char InpSlash = 2;
-
4164 const signed char InpQMark = 3; // ?
executed (the execution status of this line is deduced): const signed char InpQMark = 3;
-
4165 const signed char InpEMark = 4; // !
executed (the execution status of this line is deduced): const signed char InpEMark = 4;
-
4166 const signed char InpAmp = 5; // &
executed (the execution status of this line is deduced): const signed char InpAmp = 5;
-
4167 const signed char InpDash = 6; // -
executed (the execution status of this line is deduced): const signed char InpDash = 6;
-
4168 const signed char InpOpenB = 7; // [
executed (the execution status of this line is deduced): const signed char InpOpenB = 7;
-
4169 const signed char InpCloseB = 8; //]
executed (the execution status of this line is deduced): const signed char InpCloseB = 8;
-
4170 const signed char InpUnknown = 9;
executed (the execution status of this line is deduced): const signed char InpUnknown = 9;
-
4171 -
4172 static const signed char mapCLT2FSMChar[] = { -
4173 InpUnknown, // white space -
4174 InpUnknown, // % -
4175 InpAmp, // & -
4176 InpGt, // > -
4177 InpLt, // < -
4178 InpSlash, // / -
4179 InpQMark, // ? -
4180 InpEMark, // ! -
4181 InpDash, // - -
4182 InpCloseB, //] -
4183 InpOpenB, // [ -
4184 InpUnknown, // = -
4185 InpUnknown, // " -
4186 InpUnknown, // ' -
4187 InpUnknown // unknown -
4188 }; -
4189 -
4190 static const signed char table[16][10] = { -
4191 /* InpLt InpGt InpSlash InpQMark InpEMark InpAmp InpDash InpOpenB InpCloseB InpUnknown */ -
4192 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD1, ChD }, // Init -
4193 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD1, ChD }, // ChD -
4194 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD2, ChD }, // ChD1 -
4195 { Lt, -1, ChD, ChD, ChD, Ref, ChD, ChD, ChD2, ChD }, // ChD2 -
4196 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD, ChD }, // Ref (same as Init) -
4197 { -1, -1, Done, PInstr, Em, -1, -1, -1, -1, Elem }, // Lt -
4198 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD, ChD }, // PInstr (same as Init) -
4199 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD, ChD }, // PInstrR -
4200 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD, ChD }, // Elem (same as Init) -
4201 { -1, -1, -1, -1, -1, -1, Com, CDS, -1, -1 }, // Em -
4202 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD, ChD }, // Com (same as Init) -
4203 { Lt, ChD, ChD, ChD, ChD, Ref, ChD, ChD, ChD, ChD }, // ComR -
4204 { CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS2, CDS1 }, // CDS -
4205 { CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS2, CDS1 }, // CDS1 -
4206 { CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS3, CDS1 }, // CDS2 -
4207 { CDS1, Init, CDS1, CDS1, CDS1, CDS1, CDS1, CDS1, CDS3, CDS1 } // CDS3 -
4208 }; -
4209 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
4210 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
4211 -
4212 if (parseStack == 0 || parseStack->isEmpty()) {
evaluated: parseStack == 0
TRUEFALSE
yes
Evaluation Count:39161
yes
Evaluation Count:5718
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1634
yes
Evaluation Count:4084
1634-39161
4213 contentCharDataRead = false;
executed (the execution status of this line is deduced): contentCharDataRead = false;
-
4214 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
4215 } else {
executed: }
Execution Count:40795
40795
4216 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
4217#if defined(QT_QXML_DEBUG) -
4218 qDebug("QXmlSimpleReader: parseContent (cont) in state %d", state); -
4219#endif -
4220 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:2638
yes
Evaluation Count:1446
1446-2638
4221 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
4222 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
partially evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2638
0-2638
4223 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
4224#if defined(QT_QXML_DEBUG) -
4225 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
4226#endif -
4227 }
never executed: }
0
4228 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:1813
yes
Evaluation Count:825
825-1813
4229 parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
-
4230 return false;
executed: return false;
Execution Count:1813
1813
4231 } -
4232 }
executed: }
Execution Count:825
825
4233 }
executed: }
Execution Count:2271
2271
4234 -
4235 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
4236 switch (state) { -
4237 case Ref: -
4238 if (!contentCharDataRead)
evaluated: !contentCharDataRead
TRUEFALSE
yes
Evaluation Count:2703
yes
Evaluation Count:14316
2703-14316
4239 contentCharDataRead = parseReference_charDataRead;
executed: contentCharDataRead = parseReference_charDataRead;
Execution Count:2703
2703
4240 break;
executed: break;
Execution Count:17019
17019
4241 case PInstr: -
4242 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:31
no
Evaluation Count:0
0-31
4243 if (!contentHnd->processingInstruction(name(),string())) {
partially evaluated: !contentHnd->processingInstruction(name(),string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
4244 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4245 return false;
never executed: return false;
0
4246 } -
4247 }
executed: }
Execution Count:31
31
4248 state = PInstrR;
executed (the execution status of this line is deduced): state = PInstrR;
-
4249 break;
executed: break;
Execution Count:31
31
4250 case Com: -
4251 if (lexicalHnd) {
evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:1593
yes
Evaluation Count:56
56-1593
4252 if (!lexicalHnd->comment(string())) {
partially evaluated: !lexicalHnd->comment(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1593
0-1593
4253 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
4254 return false;
never executed: return false;
0
4255 } -
4256 }
executed: }
Execution Count:1593
1593
4257 state = ComR;
executed (the execution status of this line is deduced): state = ComR;
-
4258 break;
executed: break;
Execution Count:1649
1649
4259 case CDS: -
4260 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
4261 break;
executed: break;
Execution Count:243
243
4262 case CDS2: -
4263 if (!atEnd() && c != QLatin1Char(']'))
evaluated: !atEnd()
TRUEFALSE
yes
Evaluation Count:275
yes
Evaluation Count:17
evaluated: c != QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:238
17-275
4264 stringAddC(QLatin1Char(']'));
executed: stringAddC(QLatin1Char(']'));
Execution Count:37
37
4265 break;
executed: break;
Execution Count:292
292
4266 case CDS3: -
4267 // test if this skipping was legal -
4268 if (!atEnd()) {
evaluated: !atEnd()
TRUEFALSE
yes
Evaluation Count:249
yes
Evaluation Count:11
11-249
4269 if (c == QLatin1Char('>')) {
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:238
yes
Evaluation Count:11
11-238
4270 // the end of the CDSect -
4271 if (lexicalHnd) {
partially evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
0-238
4272 if (!lexicalHnd->startCDATA()) {
partially evaluated: !lexicalHnd->startCDATA()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:238
0-238
4273 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
4274 return false;
never executed: return false;
0
4275 } -
4276 }
executed: }
Execution Count:238
238
4277 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
0-238
4278 if (!contentHnd->characters(string())) {
partially evaluated: !contentHnd->characters(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:238
0-238
4279 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4280 return false;
never executed: return false;
0
4281 } -
4282 }
executed: }
Execution Count:238
238
4283 if (lexicalHnd) {
partially evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
0-238
4284 if (!lexicalHnd->endCDATA()) {
partially evaluated: !lexicalHnd->endCDATA()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:238
0-238
4285 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
4286 return false;
never executed: return false;
0
4287 } -
4288 }
executed: }
Execution Count:238
238
4289 } else if (c == QLatin1Char(']')) {
executed: }
Execution Count:238
partially evaluated: c == QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-238
4290 // three or more ']' -
4291 stringAddC(QLatin1Char(']'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char(']'));
-
4292 } else {
executed: }
Execution Count:11
11
4293 // after ']]' comes another character -
4294 stringAddC(QLatin1Char(']'));
never executed (the execution status of this line is deduced): stringAddC(QLatin1Char(']'));
-
4295 stringAddC(QLatin1Char(']'));
never executed (the execution status of this line is deduced): stringAddC(QLatin1Char(']'));
-
4296 }
never executed: }
0
4297 } -
4298 break;
executed: break;
Execution Count:260
260
4299 case Done: -
4300 // call the handler for CharData -
4301 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:40750
no
Evaluation Count:0
0-40750
4302 if (contentCharDataRead) {
partially evaluated: contentCharDataRead
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40750
0-40750
4303 if (reportWhitespaceCharData || !string().simplified().isEmpty()) {
never evaluated: reportWhitespaceCharData
never evaluated: !string().simplified().isEmpty()
0
4304 if (!contentHnd->characters(string())) {
never evaluated: !contentHnd->characters(string())
0
4305 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4306 return false;
never executed: return false;
0
4307 } -
4308 }
never executed: }
0
4309 }
never executed: }
0
4310 }
executed: }
Execution Count:40750
40750
4311 // Done -
4312 return true;
executed: return true;
Execution Count:40750
40750
4313 case -1: -
4314 // Error -
4315 reportParseError(QLatin1String(XMLERR_ERRORPARSINGCONTENT));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing content"));
-
4316 return false;
executed: return false;
Execution Count:3
3
4317 } -
4318 -
4319 // get input (use lookup-table instead of nested ifs for performance -
4320 // reasons) -
4321 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:1451
yes
Evaluation Count:1575069
1451-1575069
4322 unexpectedEof(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseContent, state);
-
4323 return false;
executed: return false;
Execution Count:1451
1451
4324 } -
4325 if (c.row()) {
evaluated: c.row()
TRUEFALSE
yes
Evaluation Count:368293
yes
Evaluation Count:1206776
368293-1206776
4326 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
4327 } else {
executed: }
Execution Count:368293
368293
4328 input = mapCLT2FSMChar[charLookupTable[c.cell()]];
executed (the execution status of this line is deduced): input = mapCLT2FSMChar[charLookupTable[c.cell()]];
-
4329 }
executed: }
Execution Count:1206776
1206776
4330 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
4331 -
4332 switch (state) { -
4333 case Init: -
4334 // skip the ending '>' of a CDATASection -
4335 next();
executed (the execution status of this line is deduced): next();
-
4336 break;
executed: break;
Execution Count:238
238
4337 case ChD: -
4338 // on first call: clear string -
4339 if (!contentCharDataRead) {
evaluated: !contentCharDataRead
TRUEFALSE
yes
Evaluation Count:76983
yes
Evaluation Count:1285610
76983-1285610
4340 contentCharDataRead = true;
executed (the execution status of this line is deduced): contentCharDataRead = true;
-
4341 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
4342 }
executed: }
Execution Count:76983
76983
4343 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
4344 if (reportEntities) {
evaluated: reportEntities
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:1362489
104-1362489
4345 if (!reportEndEntities())
partially evaluated: !reportEndEntities()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
4346 return false;
never executed: return false;
0
4347 }
executed: }
Execution Count:104
104
4348 next();
executed (the execution status of this line is deduced): next();
-
4349 break;
executed: break;
Execution Count:1362593
1362593
4350 case ChD1: -
4351 // on first call: clear string -
4352 if (!contentCharDataRead) {
evaluated: !contentCharDataRead
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:3778
51-3778
4353 contentCharDataRead = true;
executed (the execution status of this line is deduced): contentCharDataRead = true;
-
4354 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
4355 }
executed: }
Execution Count:51
51
4356 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
4357 if (reportEntities) {
partially evaluated: reportEntities
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3829
0-3829
4358 if (!reportEndEntities())
never evaluated: !reportEndEntities()
0
4359 return false;
never executed: return false;
0
4360 }
never executed: }
0
4361 next();
executed (the execution status of this line is deduced): next();
-
4362 break;
executed: break;
Execution Count:3829
3829
4363 case ChD2: -
4364 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
4365 if (reportEntities) {
partially evaluated: reportEntities
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:188
0-188
4366 if (!reportEndEntities())
never evaluated: !reportEndEntities()
0
4367 return false;
never executed: return false;
0
4368 }
never executed: }
0
4369 next();
executed (the execution status of this line is deduced): next();
-
4370 break;
executed: break;
Execution Count:188
188
4371 case Ref: -
4372 if (!contentCharDataRead) {
evaluated: !contentCharDataRead
TRUEFALSE
yes
Evaluation Count:2527
yes
Evaluation Count:14369
2527-14369
4373 // reference may be CharData; so clear string to be safe -
4374 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
4375 parseReference_context = InContent;
executed (the execution status of this line is deduced): parseReference_context = InContent;
-
4376 if (!parseReference()) {
evaluated: !parseReference()
TRUEFALSE
yes
Evaluation Count:292
yes
Evaluation Count:2235
292-2235
4377 parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
-
4378 return false;
executed: return false;
Execution Count:292
292
4379 } -
4380 } else {
executed: }
Execution Count:2235
2235
4381 if (reportEntities) {
evaluated: reportEntities
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:14365
4-14365
4382 // report character data in chunks -
4383 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
4384 if (reportWhitespaceCharData || !string().simplified().isEmpty()) {
evaluated: reportWhitespaceCharData
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: !string().simplified().isEmpty()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
4385 if (!contentHnd->characters(string())) {
partially evaluated: !contentHnd->characters(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
4386 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4387 return false;
never executed: return false;
0
4388 } -
4389 }
executed: }
Execution Count:4
4
4390 }
executed: }
Execution Count:4
4
4391 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
4392 }
executed: }
Execution Count:4
4
4393 parseReference_context = InContent;
executed (the execution status of this line is deduced): parseReference_context = InContent;
-
4394 if (!parseReference()) {
evaluated: !parseReference()
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:14189
180-14189
4395 parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
-
4396 return false;
executed: return false;
Execution Count:180
180
4397 } -
4398 }
executed: }
Execution Count:14189
14189
4399 break;
executed: break;
Execution Count:16424
16424
4400 case Lt: -
4401 // call the handler for CharData -
4402 if (contentHnd) {
evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:83182
yes
Evaluation Count:10
10-83182
4403 if (contentCharDataRead) {
evaluated: contentCharDataRead
TRUEFALSE
yes
Evaluation Count:78743
yes
Evaluation Count:4439
4439-78743
4404 if (reportWhitespaceCharData || !string().simplified().isEmpty()) {
evaluated: reportWhitespaceCharData
TRUEFALSE
yes
Evaluation Count:5948
yes
Evaluation Count:72795
evaluated: !string().simplified().isEmpty()
TRUEFALSE
yes
Evaluation Count:36277
yes
Evaluation Count:36518
5948-72795
4405 if (!contentHnd->characters(string())) {
partially evaluated: !contentHnd->characters(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:42225
0-42225
4406 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4407 return false;
never executed: return false;
0
4408 } -
4409 }
executed: }
Execution Count:42225
42225
4410 }
executed: }
Execution Count:78743
78743
4411 }
executed: }
Execution Count:83182
83182
4412 contentCharDataRead = false;
executed (the execution status of this line is deduced): contentCharDataRead = false;
-
4413 next();
executed (the execution status of this line is deduced): next();
-
4414 break;
executed: break;
Execution Count:83192
83192
4415 case PInstr: -
4416 case PInstrR: -
4417 parsePI_xmldecl = false;
executed (the execution status of this line is deduced): parsePI_xmldecl = false;
-
4418 if (!parsePI()) {
evaluated: !parsePI()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:4
4-35
4419 parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
-
4420 return false;
executed: return false;
Execution Count:35
35
4421 } -
4422 break;
executed: break;
Execution Count:4
4
4423 case Elem: -
4424 if (!parseElement()) {
evaluated: !parseElement()
TRUEFALSE
yes
Evaluation Count:282
yes
Evaluation Count:40228
282-40228
4425 parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
-
4426 return false;
executed: return false;
Execution Count:282
282
4427 } -
4428 break;
executed: break;
Execution Count:40228
40228
4429 case Em: -
4430 next();
executed (the execution status of this line is deduced): next();
-
4431 break;
executed: break;
Execution Count:1893
1893
4432 case Com: -
4433 case ComR: -
4434 if (!parseComment()) {
evaluated: !parseComment()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:1613
38-1613
4435 parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
-
4436 return false;
executed: return false;
Execution Count:38
38
4437 } -
4438 break;
executed: break;
Execution Count:1613
1613
4439 case CDS: -
4440 parseString_s = QLatin1String("[CDATA[");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("[CDATA[");
-
4441 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:207
35-207
4442 parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseContent, state);
-
4443 return false;
executed: return false;
Execution Count:35
35
4444 } -
4445 break;
executed: break;
Execution Count:207
207
4446 case CDS1: -
4447 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
4448 next();
executed (the execution status of this line is deduced): next();
-
4449 break;
executed: break;
Execution Count:22521
22521
4450 case CDS2: -
4451 // skip ']' -
4452 next();
executed (the execution status of this line is deduced): next();
-
4453 break;
executed: break;
Execution Count:275
275
4454 case CDS3: -
4455 // skip ']'... -
4456 next();
executed (the execution status of this line is deduced): next();
-
4457 break;
executed: break;
Execution Count:249
249
4458 } -
4459 }
executed: }
Execution Count:1574207
1574207
4460 return false;
never executed: return false;
0
4461} -
4462 -
4463bool QXmlSimpleReaderPrivate::reportEndEntities() -
4464{ -
4465 int count = (int)xmlRefStack.count();
executed (the execution status of this line is deduced): int count = (int)xmlRefStack.count();
-
4466 while (count != 0 && xmlRefStack.top().isEmpty()) {
evaluated: count != 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:100
evaluated: xmlRefStack.top().isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
2-100
4467 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
4468 if (reportWhitespaceCharData || !string().simplified().isEmpty()) {
evaluated: reportWhitespaceCharData
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: !string().simplified().isEmpty()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
4469 if (!contentHnd->characters(string())) {
partially evaluated: !contentHnd->characters(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
4470 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4471 return false;
never executed: return false;
0
4472 } -
4473 }
executed: }
Execution Count:2
2
4474 }
executed: }
Execution Count:2
2
4475 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
4476 if (lexicalHnd) {
partially evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
4477 if (!lexicalHnd->endEntity(xmlRefStack.top().name)) {
partially evaluated: !lexicalHnd->endEntity(xmlRefStack.top().name)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
4478 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
4479 return false;
never executed: return false;
0
4480 } -
4481 }
executed: }
Execution Count:2
2
4482 xmlRefStack.pop_back();
executed (the execution status of this line is deduced): xmlRefStack.pop_back();
-
4483 count--;
executed (the execution status of this line is deduced): count--;
-
4484 }
executed: }
Execution Count:2
2
4485 return true;
executed: return true;
Execution Count:104
104
4486} -
4487 -
4488/* -
4489 Parse Misc [27]. -
4490*/ -
4491bool QXmlSimpleReaderPrivate::parseMisc() -
4492{ -
4493 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
4494 const signed char Lt = 1; // '<' was read
executed (the execution status of this line is deduced): const signed char Lt = 1;
-
4495 const signed char Comment = 2; // read comment
executed (the execution status of this line is deduced): const signed char Comment = 2;
-
4496 const signed char eatWS = 3; // eat whitespaces
executed (the execution status of this line is deduced): const signed char eatWS = 3;
-
4497 const signed char PInstr = 4; // read PI
executed (the execution status of this line is deduced): const signed char PInstr = 4;
-
4498 const signed char Comment2 = 5; // read comment
executed (the execution status of this line is deduced): const signed char Comment2 = 5;
-
4499 -
4500 const signed char InpWs = 0; // S
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
4501 const signed char InpLt = 1; // <
executed (the execution status of this line is deduced): const signed char InpLt = 1;
-
4502 const signed char InpQm = 2; // ?
executed (the execution status of this line is deduced): const signed char InpQm = 2;
-
4503 const signed char InpEm = 3; // !
executed (the execution status of this line is deduced): const signed char InpEm = 3;
-
4504 const signed char InpUnknown = 4;
executed (the execution status of this line is deduced): const signed char InpUnknown = 4;
-
4505 -
4506 static const signed char table[3][5] = { -
4507 /* InpWs InpLt InpQm InpEm InpUnknown */ -
4508 { eatWS, Lt, -1, -1, -1 }, // Init -
4509 { -1, -1, PInstr,Comment, -1 }, // Lt -
4510 { -1, -1, -1, -1, Comment2 } // Comment -
4511 }; -
4512 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
4513 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
4514 -
4515 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:450
yes
Evaluation Count:2109
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1526
yes
Evaluation Count:583
450-2109
4516 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
4517 } else {
executed: }
Execution Count:1976
1976
4518 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
4519#if defined(QT_QXML_DEBUG) -
4520 qDebug("QXmlSimpleReader: parseMisc (cont) in state %d", state); -
4521#endif -
4522 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:579
yes
Evaluation Count:4
4-579
4523 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
4524 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:515
yes
Evaluation Count:64
64-515
4525 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
4526#if defined(QT_QXML_DEBUG) -
4527 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
4528#endif -
4529 }
executed: }
Execution Count:515
515
4530 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:549
yes
Evaluation Count:30
30-549
4531 parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
-
4532 return false;
executed: return false;
Execution Count:549
549
4533 } -
4534 }
executed: }
Execution Count:30
30
4535 }
executed: }
Execution Count:34
34
4536 -
4537 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
4538 switch (state) { -
4539 case eatWS: -
4540 return true;
executed: return true;
Execution Count:441
441
4541 case PInstr: -
4542 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
4543 if (!contentHnd->processingInstruction(name(),string())) {
partially evaluated: !contentHnd->processingInstruction(name(),string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
4544 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
4545 return false;
never executed: return false;
0
4546 } -
4547 }
executed: }
Execution Count:11
11
4548 return true;
executed: return true;
Execution Count:11
11
4549 case Comment2: -
4550 if (lexicalHnd) {
partially evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:24
no
Evaluation Count:0
0-24
4551 if (!lexicalHnd->comment(string())) {
partially evaluated: !lexicalHnd->comment(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
4552 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
4553 return false;
never executed: return false;
0
4554 } -
4555 }
executed: }
Execution Count:24
24
4556 return true;
executed: return true;
Execution Count:24
24
4557 case -1: -
4558 // Error -
4559 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
4560 return false;
executed: return false;
Execution Count:8
8
4561 } -
4562 -
4563 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2042
4-2042
4564 unexpectedEof(&QXmlSimpleReaderPrivate::parseMisc, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseMisc, state);
-
4565 return false;
executed: return false;
Execution Count:4
4
4566 } -
4567 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:1931
yes
Evaluation Count:111
111-1931
4568 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
4569 } else if (c == QLatin1Char('<')) {
executed: }
Execution Count:1931
evaluated: c == QLatin1Char('<')
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:70
41-1931
4570 input = InpLt;
executed (the execution status of this line is deduced): input = InpLt;
-
4571 } else if (c == QLatin1Char('?')) {
executed: }
Execution Count:41
evaluated: c == QLatin1Char('?')
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:58
12-58
4572 input = InpQm;
executed (the execution status of this line is deduced): input = InpQm;
-
4573 } else if (c == QLatin1Char('!')) {
executed: }
Execution Count:12
evaluated: c == QLatin1Char('!')
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:33
12-33
4574 input = InpEm;
executed (the execution status of this line is deduced): input = InpEm;
-
4575 } else {
executed: }
Execution Count:25
25
4576 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
4577 }
executed: }
Execution Count:33
33
4578 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
4579 -
4580 switch (state) { -
4581 case eatWS: -
4582 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:1502
yes
Evaluation Count:429
429-1502
4583 parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
-
4584 return false;
executed: return false;
Execution Count:1502
1502
4585 } -
4586 break;
executed: break;
Execution Count:429
429
4587 case Lt: -
4588 next();
executed (the execution status of this line is deduced): next();
-
4589 break;
executed: break;
Execution Count:41
41
4590 case PInstr: -
4591 parsePI_xmldecl = false;
executed (the execution status of this line is deduced): parsePI_xmldecl = false;
-
4592 if (!parsePI()) {
evaluated: !parsePI()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-10
4593 parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
-
4594 return false;
executed: return false;
Execution Count:10
10
4595 } -
4596 break;
executed: break;
Execution Count:2
2
4597 case Comment: -
4598 next();
executed (the execution status of this line is deduced): next();
-
4599 break;
executed: break;
Execution Count:25
25
4600 case Comment2: -
4601 if (!parseComment()) {
evaluated: !parseComment()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:15
10-15
4602 parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMisc, state);
-
4603 return false;
executed: return false;
Execution Count:10
10
4604 } -
4605 break;
executed: break;
Execution Count:15
15
4606 } -
4607 }
executed: }
Execution Count:520
520
4608 return false;
never executed: return false;
0
4609} -
4610 -
4611/* -
4612 Parse a processing instruction [16]. -
4613 -
4614 If xmldec is true, it tries to parse a PI or a XML declaration [23]. -
4615 -
4616 Precondition: the beginning '<' of the PI is already read and the head stand -
4617 on the '?' of '<?'. -
4618 -
4619 If this funktion was successful, the head-position is on the first -
4620 character after the PI. -
4621*/ -
4622bool QXmlSimpleReaderPrivate::parsePI() -
4623{ -
4624 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
4625 const signed char QmI = 1; // ? was read
executed (the execution status of this line is deduced): const signed char QmI = 1;
-
4626 const signed char Name = 2; // read Name
executed (the execution status of this line is deduced): const signed char Name = 2;
-
4627 const signed char XMLDecl = 3; // read XMLDecl
executed (the execution status of this line is deduced): const signed char XMLDecl = 3;
-
4628 const signed char Ws1 = 4; // eat ws after "xml" of XMLDecl
executed (the execution status of this line is deduced): const signed char Ws1 = 4;
-
4629 const signed char PInstr = 5; // read PI
executed (the execution status of this line is deduced): const signed char PInstr = 5;
-
4630 const signed char Ws2 = 6; // eat ws after Name of PI
executed (the execution status of this line is deduced): const signed char Ws2 = 6;
-
4631 const signed char Version = 7; // read versionInfo
executed (the execution status of this line is deduced): const signed char Version = 7;
-
4632 const signed char Ws3 = 8; // eat ws after versionInfo
executed (the execution status of this line is deduced): const signed char Ws3 = 8;
-
4633 const signed char EorSD = 9; // read EDecl or SDDecl
executed (the execution status of this line is deduced): const signed char EorSD = 9;
-
4634 const signed char Ws4 = 10; // eat ws after EDecl or SDDecl
executed (the execution status of this line is deduced): const signed char Ws4 = 10;
-
4635 const signed char SD = 11; // read SDDecl
executed (the execution status of this line is deduced): const signed char SD = 11;
-
4636 const signed char Ws5 = 12; // eat ws after SDDecl
executed (the execution status of this line is deduced): const signed char Ws5 = 12;
-
4637 const signed char ADone = 13; // almost done
executed (the execution status of this line is deduced): const signed char ADone = 13;
-
4638 const signed char Char = 14; // Char was read
executed (the execution status of this line is deduced): const signed char Char = 14;
-
4639 const signed char Qm = 15; // Qm was read
executed (the execution status of this line is deduced): const signed char Qm = 15;
-
4640 const signed char Done = 16; // finished reading content
executed (the execution status of this line is deduced): const signed char Done = 16;
-
4641 -
4642 const signed char InpWs = 0; // whitespace
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
4643 const signed char InpNameBe = 1; // NameBeginning
executed (the execution status of this line is deduced): const signed char InpNameBe = 1;
-
4644 const signed char InpGt = 2; // >
executed (the execution status of this line is deduced): const signed char InpGt = 2;
-
4645 const signed char InpQm = 3; // ?
executed (the execution status of this line is deduced): const signed char InpQm = 3;
-
4646 const signed char InpUnknown = 4;
executed (the execution status of this line is deduced): const signed char InpUnknown = 4;
-
4647 -
4648 static const signed char table[16][5] = { -
4649 /* InpWs, InpNameBe InpGt InpQm InpUnknown */ -
4650 { -1, -1, -1, QmI, -1 }, // Init -
4651 { -1, Name, -1, -1, -1 }, // QmI -
4652 { -1, -1, -1, -1, -1 }, // Name (this state is left not through input) -
4653 { Ws1, -1, -1, -1, -1 }, // XMLDecl -
4654 { -1, Version, -1, -1, -1 }, // Ws1 -
4655 { Ws2, -1, -1, Qm, -1 }, // PInstr -
4656 { Char, Char, Char, Qm, Char }, // Ws2 -
4657 { Ws3, -1, -1, ADone, -1 }, // Version -
4658 { -1, EorSD, -1, ADone, -1 }, // Ws3 -
4659 { Ws4, -1, -1, ADone, -1 }, // EorSD -
4660 { -1, SD, -1, ADone, -1 }, // Ws4 -
4661 { Ws5, -1, -1, ADone, -1 }, // SD -
4662 { -1, -1, -1, ADone, -1 }, // Ws5 -
4663 { -1, -1, Done, -1, -1 }, // ADone -
4664 { Char, Char, Char, Qm, Char }, // Char -
4665 { Char, Char, Done, Qm, Char }, // Qm -
4666 }; -
4667 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
4668 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
4669 -
4670 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:1386
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:1242
144-1386
4671 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
4672 } else {
executed: }
Execution Count:339
339
4673 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
4674#if defined(QT_QXML_DEBUG) -
4675 qDebug("QXmlSimpleReader: parsePI (cont) in state %d", state); -
4676#endif -
4677 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:997
yes
Evaluation Count:245
245-997
4678 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
4679 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:910
87-910
4680 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
4681#if defined(QT_QXML_DEBUG) -
4682 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
4683#endif -
4684 }
executed: }
Execution Count:87
87
4685 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:639
yes
Evaluation Count:358
358-639
4686 parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
-
4687 return false;
executed: return false;
Execution Count:639
639
4688 } -
4689 }
executed: }
Execution Count:358
358
4690 }
executed: }
Execution Count:603
603
4691 -
4692 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
4693 switch (state) { -
4694 case Name: -
4695 // test what name was read and determine the next state -
4696 // (not very beautiful, I admit) -
4697 if (name().toLower() == QLatin1String("xml")) {
evaluated: name().toLower() == QLatin1String("xml")
TRUEFALSE
yes
Evaluation Count:255
yes
Evaluation Count:83
83-255
4698 if (parsePI_xmldecl && name() == QLatin1String("xml")) {
evaluated: parsePI_xmldecl
TRUEFALSE
yes
Evaluation Count:235
yes
Evaluation Count:20
evaluated: name() == QLatin1String("xml")
TRUEFALSE
yes
Evaluation Count:233
yes
Evaluation Count:2
2-235
4699 state = XMLDecl;
executed (the execution status of this line is deduced): state = XMLDecl;
-
4700 } else {
executed: }
Execution Count:233
233
4701 reportParseError(QLatin1String(XMLERR_INVALIDNAMEFORPI));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("invalid name for processing instruction"));
-
4702 return false;
executed: return false;
Execution Count:22
22
4703 } -
4704 } else { -
4705 state = PInstr;
executed (the execution status of this line is deduced): state = PInstr;
-
4706 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
4707 }
executed: }
Execution Count:83
83
4708 break;
executed: break;
Execution Count:316
316
4709 case Version: -
4710 // get version (syntax like an attribute) -
4711 if (name() != QLatin1String("version")) {
evaluated: name() != QLatin1String("version")
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:242
3-242
4712 reportParseError(QLatin1String(XMLERR_VERSIONEXPECTED));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("version expected while reading the XML declaration"));
-
4713 return false;
executed: return false;
Execution Count:3
3
4714 } -
4715 xmlVersion = string();
executed (the execution status of this line is deduced): xmlVersion = string();
-
4716 break;
executed: break;
Execution Count:242
242
4717 case EorSD: -
4718 // get the EDecl or SDDecl (syntax like an attribute) -
4719 if (name() == QLatin1String("standalone")) {
evaluated: name() == QLatin1String("standalone")
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:181
18-181
4720 if (string()== QLatin1String("yes")) {
evaluated: string()== QLatin1String("yes")
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:1
1-17
4721 standalone = QXmlSimpleReaderPrivate::Yes;
executed (the execution status of this line is deduced): standalone = QXmlSimpleReaderPrivate::Yes;
-
4722 } else if (string() == QLatin1String("no")) {
executed: }
Execution Count:17
partially evaluated: string() == QLatin1String("no")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-17
4723 standalone = QXmlSimpleReaderPrivate::No;
never executed (the execution status of this line is deduced): standalone = QXmlSimpleReaderPrivate::No;
-
4724 } else {
never executed: }
0
4725 reportParseError(QLatin1String(XMLERR_WRONGVALUEFORSDECL));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("wrong value for standalone declaration"));
-
4726 return false;
executed: return false;
Execution Count:1
1
4727 } -
4728 } else if (name() == QLatin1String("encoding")) {
evaluated: name() == QLatin1String("encoding")
TRUEFALSE
yes
Evaluation Count:179
yes
Evaluation Count:2
2-179
4729 encoding = string();
executed (the execution status of this line is deduced): encoding = string();
-
4730 } else {
executed: }
Execution Count:179
179
4731 reportParseError(QLatin1String(XMLERR_EDECLORSDDECLEXPECTED));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("encoding declaration or standalone declaration expected while reading the XML declaration"));
-
4732 return false;
executed: return false;
Execution Count:2
2
4733 } -
4734 break;
executed: break;
Execution Count:196
196
4735 case SD: -
4736 if (name() != QLatin1String("standalone")) {
partially evaluated: name() != QLatin1String("standalone")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:52
0-52
4737 reportParseError(QLatin1String(XMLERR_SDDECLEXPECTED));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("standalone declaration expected while reading the XML declaration"));
-
4738 return false;
never executed: return false;
0
4739 } -
4740 if (string() == QLatin1String("yes")) {
evaluated: string() == QLatin1String("yes")
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:39
13-39
4741 standalone = QXmlSimpleReaderPrivate::Yes;
executed (the execution status of this line is deduced): standalone = QXmlSimpleReaderPrivate::Yes;
-
4742 } else if (string() == QLatin1String("no")) {
executed: }
Execution Count:13
partially evaluated: string() == QLatin1String("no")
TRUEFALSE
yes
Evaluation Count:39
no
Evaluation Count:0
0-39
4743 standalone = QXmlSimpleReaderPrivate::No;
executed (the execution status of this line is deduced): standalone = QXmlSimpleReaderPrivate::No;
-
4744 } else {
executed: }
Execution Count:39
39
4745 reportParseError(QLatin1String(XMLERR_WRONGVALUEFORSDECL));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("wrong value for standalone declaration"));
-
4746 return false;
never executed: return false;
0
4747 } -
4748 break;
executed: break;
Execution Count:52
52
4749 case Qm: -
4750 // test if the skipping was legal -
4751 if (!atEnd() && c != QLatin1Char('>'))
evaluated: !atEnd()
TRUEFALSE
yes
Evaluation Count:101
yes
Evaluation Count:19
evaluated: c != QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:80
19-101
4752 stringAddC(QLatin1Char('?'));
executed: stringAddC(QLatin1Char('?'));
Execution Count:21
21
4753 break;
executed: break;
Execution Count:120
120
4754 case Done: -
4755 return true;
executed: return true;
Execution Count:305
305
4756 case -1: -
4757 // Error -
4758 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
4759 return false;
executed: return false;
Execution Count:3
3
4760 } -
4761 -
4762 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:248
yes
Evaluation Count:2816
248-2816
4763 unexpectedEof(&QXmlSimpleReaderPrivate::parsePI, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parsePI, state);
-
4764 return false;
executed: return false;
Execution Count:248
248
4765 } -
4766 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:639
yes
Evaluation Count:2177
639-2177
4767 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
4768 } else if (determineNameChar(c) == NameBeginning) {
executed: }
Execution Count:639
evaluated: determineNameChar(c) == NameBeginning
TRUEFALSE
yes
Evaluation Count:1139
yes
Evaluation Count:1038
639-1139
4769 input = InpNameBe;
executed (the execution status of this line is deduced): input = InpNameBe;
-
4770 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:1139
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:319
yes
Evaluation Count:719
319-1139
4771 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
4772 } else if (c == QLatin1Char('?')) {
executed: }
Execution Count:319
evaluated: c == QLatin1Char('?')
TRUEFALSE
yes
Evaluation Count:665
yes
Evaluation Count:54
54-665
4773 input = InpQm;
executed (the execution status of this line is deduced): input = InpQm;
-
4774 } else {
executed: }
Execution Count:665
665
4775 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
4776 }
executed: }
Execution Count:54
54
4777 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
4778 -
4779 switch (state) { -
4780 case QmI: -
4781 next();
executed (the execution status of this line is deduced): next();
-
4782 break;
executed: break;
Execution Count:339
339
4783 case Name: -
4784 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
4785 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:83
yes
Evaluation Count:255
83-255
4786 parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
-
4787 return false;
executed: return false;
Execution Count:83
83
4788 } -
4789 break;
executed: break;
Execution Count:255
255
4790 case Ws1: -
4791 case Ws2: -
4792 case Ws3: -
4793 case Ws4: -
4794 case Ws5: -
4795 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:451
86-451
4796 parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
-
4797 return false;
executed: return false;
Execution Count:86
86
4798 } -
4799 break;
executed: break;
Execution Count:451
451
4800 case Version: -
4801 if (!parseAttribute()) {
evaluated: !parseAttribute()
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:143
90-143
4802 parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
-
4803 return false;
executed: return false;
Execution Count:90
90
4804 } -
4805 break;
executed: break;
Execution Count:143
143
4806 case EorSD: -
4807 if (!parseAttribute()) {
evaluated: !parseAttribute()
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:94
63-94
4808 parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
-
4809 return false;
executed: return false;
Execution Count:63
63
4810 } -
4811 break;
executed: break;
Execution Count:94
94
4812 case SD: -
4813 // get the SDDecl (syntax like an attribute) -
4814 if (standalone != QXmlSimpleReaderPrivate::Unknown) {
partially evaluated: standalone != QXmlSimpleReaderPrivate::Unknown
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:42
0-42
4815 // already parsed the standalone declaration -
4816 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
4817 return false;
never executed: return false;
0
4818 } -
4819 if (!parseAttribute()) {
evaluated: !parseAttribute()
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:6
6-36
4820 parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePI, state);
-
4821 return false;
executed: return false;
Execution Count:36
36
4822 } -
4823 break;
executed: break;
Execution Count:6
6
4824 case ADone: -
4825 next();
executed (the execution status of this line is deduced): next();
-
4826 break;
executed: break;
Execution Count:225
225
4827 case Char: -
4828 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
4829 next();
executed (the execution status of this line is deduced): next();
-
4830 break;
executed: break;
Execution Count:536
536
4831 case Qm: -
4832 // skip the '?' -
4833 next();
executed (the execution status of this line is deduced): next();
-
4834 break;
executed: break;
Execution Count:101
101
4835 case Done: -
4836 next();
executed (the execution status of this line is deduced): next();
-
4837 break;
executed: break;
Execution Count:305
305
4838 } -
4839 }
executed: }
Execution Count:2458
2458
4840 return false;
never executed: return false;
0
4841} -
4842 -
4843/* -
4844 Parse a document type definition (doctypedecl [28]). -
4845 -
4846 Precondition: the beginning '<!' of the doctype is already read the head -
4847 stands on the 'D' of '<!DOCTYPE'. -
4848 -
4849 If this function was successful, the head-position is on the first -
4850 character after the document type definition. -
4851*/ -
4852bool QXmlSimpleReaderPrivate::parseDoctype() -
4853{ -
4854 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
4855 const signed char Doctype = 1; // read the doctype
executed (the execution status of this line is deduced): const signed char Doctype = 1;
-
4856 const signed char Ws1 = 2; // eat_ws
executed (the execution status of this line is deduced): const signed char Ws1 = 2;
-
4857 const signed char Doctype2 = 3; // read the doctype, part 2
executed (the execution status of this line is deduced): const signed char Doctype2 = 3;
-
4858 const signed char Ws2 = 4; // eat_ws
executed (the execution status of this line is deduced): const signed char Ws2 = 4;
-
4859 const signed char Sys = 5; // read SYSTEM or PUBLIC
executed (the execution status of this line is deduced): const signed char Sys = 5;
-
4860 const signed char Ws3 = 6; // eat_ws
executed (the execution status of this line is deduced): const signed char Ws3 = 6;
-
4861 const signed char MP = 7; // markupdecl or PEReference
executed (the execution status of this line is deduced): const signed char MP = 7;
-
4862 const signed char MPR = 8; // same as MP, but already reported
executed (the execution status of this line is deduced): const signed char MPR = 8;
-
4863 const signed char PER = 9; // PERReference
executed (the execution status of this line is deduced): const signed char PER = 9;
-
4864 const signed char Mup = 10; // markupdecl
executed (the execution status of this line is deduced): const signed char Mup = 10;
-
4865 const signed char Ws4 = 11; // eat_ws
executed (the execution status of this line is deduced): const signed char Ws4 = 11;
-
4866 const signed char MPE = 12; // end of markupdecl or PEReference
executed (the execution status of this line is deduced): const signed char MPE = 12;
-
4867 const signed char Done = 13;
executed (the execution status of this line is deduced): const signed char Done = 13;
-
4868 -
4869 const signed char InpWs = 0;
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
4870 const signed char InpD = 1; // 'D'
executed (the execution status of this line is deduced): const signed char InpD = 1;
-
4871 const signed char InpS = 2; // 'S' or 'P'
executed (the execution status of this line is deduced): const signed char InpS = 2;
-
4872 const signed char InpOB = 3; // [
executed (the execution status of this line is deduced): const signed char InpOB = 3;
-
4873 const signed char InpCB = 4; //]
executed (the execution status of this line is deduced): const signed char InpCB = 4;
-
4874 const signed char InpPer = 5; // %
executed (the execution status of this line is deduced): const signed char InpPer = 5;
-
4875 const signed char InpGt = 6; // >
executed (the execution status of this line is deduced): const signed char InpGt = 6;
-
4876 const signed char InpUnknown = 7;
executed (the execution status of this line is deduced): const signed char InpUnknown = 7;
-
4877 -
4878 static const signed char table[13][8] = { -
4879 /* InpWs, InpD InpS InpOB InpCB InpPer InpGt InpUnknown */ -
4880 { -1, Doctype, -1, -1, -1, -1, -1, -1 }, // Init -
4881 { Ws1, -1, -1, -1, -1, -1, -1, -1 }, // Doctype -
4882 { -1, Doctype2, Doctype2, -1, -1, -1, -1, Doctype2 }, // Ws1 -
4883 { Ws2, -1, Sys, MP, -1, -1, Done, -1 }, // Doctype2 -
4884 { -1, -1, Sys, MP, -1, -1, Done, -1 }, // Ws2 -
4885 { Ws3, -1, -1, MP, -1, -1, Done, -1 }, // Sys -
4886 { -1, -1, -1, MP, -1, -1, Done, -1 }, // Ws3 -
4887 { -1, -1, -1, -1, MPE, PER, -1, Mup }, // MP -
4888 { -1, -1, -1, -1, MPE, PER, -1, Mup }, // MPR -
4889 { Ws4, -1, -1, -1, MPE, PER, -1, Mup }, // PER -
4890 { Ws4, -1, -1, -1, MPE, PER, -1, Mup }, // Mup -
4891 { -1, -1, -1, -1, MPE, PER, -1, Mup }, // Ws4 -
4892 { -1, -1, -1, -1, -1, -1, Done, -1 } // MPE -
4893 }; -
4894 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
4895 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
4896 -
4897 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:397
yes
Evaluation Count:31694
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1490
yes
Evaluation Count:30204
397-31694
4898 startDTDwasReported = false;
executed (the execution status of this line is deduced): startDTDwasReported = false;
-
4899 systemId.clear();
executed (the execution status of this line is deduced): systemId.clear();
-
4900 publicId.clear();
executed (the execution status of this line is deduced): publicId.clear();
-
4901 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
4902 } else {
executed: }
Execution Count:1887
1887
4903 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
4904#if defined(QT_QXML_DEBUG) -
4905 qDebug("QXmlSimpleReader: parseDoctype (cont) in state %d", state); -
4906#endif -
4907 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:28944
yes
Evaluation Count:1260
1260-28944
4908 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
4909 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:4229
yes
Evaluation Count:24715
4229-24715
4910 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
4911#if defined(QT_QXML_DEBUG) -
4912 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
4913#endif -
4914 }
executed: }
Execution Count:4229
4229
4915 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:20449
yes
Evaluation Count:8495
8495-20449
4916 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
4917 return false;
executed: return false;
Execution Count:20449
20449
4918 } -
4919 }
executed: }
Execution Count:8495
8495
4920 }
executed: }
Execution Count:9755
9755
4921 -
4922 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
4923 switch (state) { -
4924 case Doctype2: -
4925 doctype = name();
executed (the execution status of this line is deduced): doctype = name();
-
4926 break;
executed: break;
Execution Count:1887
1887
4927 case MP: -
4928 if (!startDTDwasReported && lexicalHnd ) {
partially evaluated: !startDTDwasReported
TRUEFALSE
yes
Evaluation Count:1570
no
Evaluation Count:0
evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:1569
yes
Evaluation Count:1
0-1570
4929 startDTDwasReported = true;
executed (the execution status of this line is deduced): startDTDwasReported = true;
-
4930 if (!lexicalHnd->startDTD(doctype, publicId, systemId)) {
partially evaluated: !lexicalHnd->startDTD(doctype, publicId, systemId)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1569
0-1569
4931 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
4932 return false;
never executed: return false;
0
4933 } -
4934 }
executed: }
Execution Count:1569
1569
4935 state = MPR;
executed (the execution status of this line is deduced): state = MPR;
-
4936 break;
executed: break;
Execution Count:1570
1570
4937 case Done: -
4938 return true;
executed: return true;
Execution Count:1836
1836
4939 case -1: -
4940 // Error -
4941 reportParseError(QLatin1String(XMLERR_ERRORPARSINGDOCTYPE));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing document type definition"));
-
4942 return false;
executed: return false;
Execution Count:2
2
4943 } -
4944 -
4945 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:1260
yes
Evaluation Count:19301
1260-19301
4946 unexpectedEof(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
4947 return false;
executed: return false;
Execution Count:1260
1260
4948 } -
4949 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:6991
yes
Evaluation Count:12310
6991-12310
4950 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
4951 } else if (c == QLatin1Char('D')) {
executed: }
Execution Count:6991
evaluated: c == QLatin1Char('D')
TRUEFALSE
yes
Evaluation Count:1887
yes
Evaluation Count:10423
1887-10423
4952 input = InpD;
executed (the execution status of this line is deduced): input = InpD;
-
4953 } else if (c == QLatin1Char('S')) {
executed: }
Execution Count:1887
evaluated: c == QLatin1Char('S')
TRUEFALSE
yes
Evaluation Count:331
yes
Evaluation Count:10092
331-10092
4954 input = InpS;
executed (the execution status of this line is deduced): input = InpS;
-
4955 } else if (c == QLatin1Char('P')) {
executed: }
Execution Count:331
evaluated: c == QLatin1Char('P')
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:10005
87-10005
4956 input = InpS;
executed (the execution status of this line is deduced): input = InpS;
-
4957 } else if (c == QLatin1Char('[')) {
executed: }
Execution Count:87
evaluated: c == QLatin1Char('[')
TRUEFALSE
yes
Evaluation Count:1570
yes
Evaluation Count:8435
87-8435
4958 input = InpOB;
executed (the execution status of this line is deduced): input = InpOB;
-
4959 } else if (c == QLatin1Char(']')) {
executed: }
Execution Count:1570
evaluated: c == QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:1521
yes
Evaluation Count:6914
1521-6914
4960 input = InpCB;
executed (the execution status of this line is deduced): input = InpCB;
-
4961 } else if (c == QLatin1Char('%')) {
executed: }
Execution Count:1521
evaluated: c == QLatin1Char('%')
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:6863
51-6863
4962 input = InpPer;
executed (the execution status of this line is deduced): input = InpPer;
-
4963 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:51
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:1836
yes
Evaluation Count:5027
51-5027
4964 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
4965 } else {
executed: }
Execution Count:1836
1836
4966 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
4967 }
executed: }
Execution Count:5027
5027
4968 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
4969 -
4970 switch (state) { -
4971 case Doctype: -
4972 parseString_s = QLatin1String("DOCTYPE");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("DOCTYPE");
-
4973 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:1332
yes
Evaluation Count:555
555-1332
4974 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
4975 return false;
executed: return false;
Execution Count:1332
1332
4976 } -
4977 break;
executed: break;
Execution Count:555
555
4978 case Ws1: -
4979 case Ws2: -
4980 case Ws3: -
4981 case Ws4: -
4982 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:2308
yes
Evaluation Count:4683
2308-4683
4983 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
4984 return false;
executed: return false;
Execution Count:2308
2308
4985 } -
4986 break;
executed: break;
Execution Count:4683
4683
4987 case Doctype2: -
4988 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
4989 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:846
yes
Evaluation Count:1041
846-1041
4990 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
4991 return false;
executed: return false;
Execution Count:846
846
4992 } -
4993 break;
executed: break;
Execution Count:1041
1041
4994 case Sys: -
4995 parseExternalID_allowPublicID = false;
executed (the execution status of this line is deduced): parseExternalID_allowPublicID = false;
-
4996 if (!parseExternalID()) {
evaluated: !parseExternalID()
TRUEFALSE
yes
Evaluation Count:279
yes
Evaluation Count:139
139-279
4997 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
4998 return false;
executed: return false;
Execution Count:279
279
4999 } -
5000 thisPublicId = publicId;
executed (the execution status of this line is deduced): thisPublicId = publicId;
-
5001 thisSystemId = systemId;
executed (the execution status of this line is deduced): thisSystemId = systemId;
-
5002 break;
executed: break;
Execution Count:139
139
5003 case MP: -
5004 case MPR: -
5005 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:885
yes
Evaluation Count:685
685-885
5006 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
5007 return false;
executed: return false;
Execution Count:885
885
5008 } -
5009 break;
executed: break;
Execution Count:685
685
5010 case PER: -
5011 parsePEReference_context = InDTD;
executed (the execution status of this line is deduced): parsePEReference_context = InDTD;
-
5012 if (!parsePEReference()) {
evaluated: !parsePEReference()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:30
20-30
5013 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
5014 return false;
executed: return false;
Execution Count:20
20
5015 } -
5016 break;
executed: break;
Execution Count:30
30
5017 case Mup: -
5018 if (!parseMarkupdecl()) {
evaluated: !parseMarkupdecl()
TRUEFALSE
yes
Evaluation Count:2457
yes
Evaluation Count:682
682-2457
5019 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
5020 return false;
executed: return false;
Execution Count:2457
2457
5021 } -
5022 break;
executed: break;
Execution Count:682
682
5023 case MPE: -
5024 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:417
yes
Evaluation Count:1104
417-1104
5025 parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
-
5026 return false;
executed: return false;
Execution Count:417
417
5027 } -
5028 break;
executed: break;
Execution Count:1104
1104
5029 case Done: -
5030 if (lexicalHnd) {
evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:1830
yes
Evaluation Count:6
6-1830
5031 if (!startDTDwasReported) {
evaluated: !startDTDwasReported
TRUEFALSE
yes
Evaluation Count:311
yes
Evaluation Count:1519
311-1519
5032 startDTDwasReported = true;
executed (the execution status of this line is deduced): startDTDwasReported = true;
-
5033 if (!lexicalHnd->startDTD(doctype, publicId, systemId)) {
partially evaluated: !lexicalHnd->startDTD(doctype, publicId, systemId)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:311
0-311
5034 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
5035 return false;
never executed: return false;
0
5036 } -
5037 }
executed: }
Execution Count:311
311
5038 if (!lexicalHnd->endDTD()) {
partially evaluated: !lexicalHnd->endDTD()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1830
0-1830
5039 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
5040 return false;
never executed: return false;
0
5041 } -
5042 }
executed: }
Execution Count:1830
1830
5043 next();
executed (the execution status of this line is deduced): next();
-
5044 break;
executed: break;
Execution Count:1836
1836
5045 } -
5046 }
executed: }
Execution Count:10757
10757
5047 return false;
never executed: return false;
0
5048} -
5049 -
5050/* -
5051 Parse a ExternalID [75]. -
5052 -
5053 If allowPublicID is true parse ExternalID [75] or PublicID [83]. -
5054*/ -
5055bool QXmlSimpleReaderPrivate::parseExternalID() -
5056{ -
5057 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
5058 const signed char Sys = 1; // parse 'SYSTEM'
executed (the execution status of this line is deduced): const signed char Sys = 1;
-
5059 const signed char SysWS = 2; // parse the whitespace after 'SYSTEM'
executed (the execution status of this line is deduced): const signed char SysWS = 2;
-
5060 const signed char SysSQ = 3; // parse SystemLiteral with '
executed (the execution status of this line is deduced): const signed char SysSQ = 3;
-
5061 const signed char SysSQ2 = 4; // parse SystemLiteral with '
executed (the execution status of this line is deduced): const signed char SysSQ2 = 4;
-
5062 const signed char SysDQ = 5; // parse SystemLiteral with "
executed (the execution status of this line is deduced): const signed char SysDQ = 5;
-
5063 const signed char SysDQ2 = 6; // parse SystemLiteral with "
executed (the execution status of this line is deduced): const signed char SysDQ2 = 6;
-
5064 const signed char Pub = 7; // parse 'PUBLIC'
executed (the execution status of this line is deduced): const signed char Pub = 7;
-
5065 const signed char PubWS = 8; // parse the whitespace after 'PUBLIC'
executed (the execution status of this line is deduced): const signed char PubWS = 8;
-
5066 const signed char PubSQ = 9; // parse PubidLiteral with '
executed (the execution status of this line is deduced): const signed char PubSQ = 9;
-
5067 const signed char PubSQ2 = 10; // parse PubidLiteral with '
executed (the execution status of this line is deduced): const signed char PubSQ2 = 10;
-
5068 const signed char PubDQ = 11; // parse PubidLiteral with "
executed (the execution status of this line is deduced): const signed char PubDQ = 11;
-
5069 const signed char PubDQ2 = 12; // parse PubidLiteral with "
executed (the execution status of this line is deduced): const signed char PubDQ2 = 12;
-
5070 const signed char PubE = 13; // finished parsing the PubidLiteral
executed (the execution status of this line is deduced): const signed char PubE = 13;
-
5071 const signed char PubWS2 = 14; // parse the whitespace after the PubidLiteral
executed (the execution status of this line is deduced): const signed char PubWS2 = 14;
-
5072 const signed char PDone = 15; // done if allowPublicID is true
executed (the execution status of this line is deduced): const signed char PDone = 15;
-
5073 const signed char Done = 16;
executed (the execution status of this line is deduced): const signed char Done = 16;
-
5074 -
5075 const signed char InpSQ = 0; // '
executed (the execution status of this line is deduced): const signed char InpSQ = 0;
-
5076 const signed char InpDQ = 1; // "
executed (the execution status of this line is deduced): const signed char InpDQ = 1;
-
5077 const signed char InpS = 2; // S
executed (the execution status of this line is deduced): const signed char InpS = 2;
-
5078 const signed char InpP = 3; // P
executed (the execution status of this line is deduced): const signed char InpP = 3;
-
5079 const signed char InpWs = 4; // white space
executed (the execution status of this line is deduced): const signed char InpWs = 4;
-
5080 const signed char InpUnknown = 5;
executed (the execution status of this line is deduced): const signed char InpUnknown = 5;
-
5081 -
5082 static const signed char table[15][6] = { -
5083 /* InpSQ InpDQ InpS InpP InpWs InpUnknown */ -
5084 { -1, -1, Sys, Pub, -1, -1 }, // Init -
5085 { -1, -1, -1, -1, SysWS, -1 }, // Sys -
5086 { SysSQ, SysDQ, -1, -1, -1, -1 }, // SysWS -
5087 { Done, SysSQ2, SysSQ2, SysSQ2, SysSQ2, SysSQ2 }, // SysSQ -
5088 { Done, SysSQ2, SysSQ2, SysSQ2, SysSQ2, SysSQ2 }, // SysSQ2 -
5089 { SysDQ2, Done, SysDQ2, SysDQ2, SysDQ2, SysDQ2 }, // SysDQ -
5090 { SysDQ2, Done, SysDQ2, SysDQ2, SysDQ2, SysDQ2 }, // SysDQ2 -
5091 { -1, -1, -1, -1, PubWS, -1 }, // Pub -
5092 { PubSQ, PubDQ, -1, -1, -1, -1 }, // PubWS -
5093 { PubE, -1, PubSQ2, PubSQ2, PubSQ2, PubSQ2 }, // PubSQ -
5094 { PubE, -1, PubSQ2, PubSQ2, PubSQ2, PubSQ2 }, // PubSQ2 -
5095 { -1, PubE, PubDQ2, PubDQ2, PubDQ2, PubDQ2 }, // PubDQ -
5096 { -1, PubE, PubDQ2, PubDQ2, PubDQ2, PubDQ2 }, // PubDQ2 -
5097 { PDone, PDone, PDone, PDone, PubWS2, PDone }, // PubE -
5098 { SysSQ, SysDQ, PDone, PDone, PDone, PDone } // PubWS2 -
5099 }; -
5100 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
5101 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
5102 -
5103 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:205
yes
Evaluation Count:3322
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:522
yes
Evaluation Count:2800
205-3322
5104 systemId.clear();
executed (the execution status of this line is deduced): systemId.clear();
-
5105 publicId.clear();
executed (the execution status of this line is deduced): publicId.clear();
-
5106 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
5107 } else {
executed: }
Execution Count:727
727
5108 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
5109#if defined(QT_QXML_DEBUG) -
5110 qDebug("QXmlSimpleReader: parseExternalID (cont) in state %d", state); -
5111#endif -
5112 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:956
yes
Evaluation Count:1844
956-1844
5113 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
5114 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:783
173-783
5115 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
5116#if defined(QT_QXML_DEBUG) -
5117 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
5118#endif -
5119 }
executed: }
Execution Count:173
173
5120 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:341
yes
Evaluation Count:615
341-615
5121 parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
-
5122 return false;
executed: return false;
Execution Count:341
341
5123 } -
5124 }
executed: }
Execution Count:615
615
5125 }
executed: }
Execution Count:2459
2459
5126 -
5127 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
5128 switch (state) { -
5129 case PDone: -
5130 if (parseExternalID_allowPublicID) {
evaluated: parseExternalID_allowPublicID
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:2
2-20
5131 publicId = string();
executed (the execution status of this line is deduced): publicId = string();
-
5132 return true;
executed: return true;
Execution Count:20
20
5133 } else { -
5134 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
5135 return false;
executed: return false;
Execution Count:2
2
5136 } -
5137 case Done: -
5138 return true;
executed: return true;
Execution Count:705
705
5139 case -1: -
5140 // Error -
5141 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
5142 return false;
never executed: return false;
0
5143 } -
5144 -
5145 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:1844
yes
Evaluation Count:14132
1844-14132
5146 unexpectedEof(&QXmlSimpleReaderPrivate::parseExternalID, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseExternalID, state);
-
5147 return false;
executed: return false;
Execution Count:1844
1844
5148 } -
5149 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:1022
yes
Evaluation Count:13110
1022-13110
5150 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
5151 } else if (c == QLatin1Char('\'')) {
executed: }
Execution Count:1022
evaluated: c == QLatin1Char('\'')
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:13030
80-13030
5152 input = InpSQ;
executed (the execution status of this line is deduced): input = InpSQ;
-
5153 } else if (c == QLatin1Char('"')) {
executed: }
Execution Count:80
evaluated: c == QLatin1Char('"')
TRUEFALSE
yes
Evaluation Count:1615
yes
Evaluation Count:11415
80-11415
5154 input = InpDQ;
executed (the execution status of this line is deduced): input = InpDQ;
-
5155 } else if (c == QLatin1Char('S')) {
executed: }
Execution Count:1615
evaluated: c == QLatin1Char('S')
TRUEFALSE
yes
Evaluation Count:586
yes
Evaluation Count:10829
586-10829
5156 input = InpS;
executed (the execution status of this line is deduced): input = InpS;
-
5157 } else if (c == QLatin1Char('P')) {
executed: }
Execution Count:586
evaluated: c == QLatin1Char('P')
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:10687
142-10687
5158 input = InpP;
executed (the execution status of this line is deduced): input = InpP;
-
5159 } else {
executed: }
Execution Count:142
142
5160 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
5161 }
executed: }
Execution Count:10687
10687
5162 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
5163 -
5164 switch (state) { -
5165 case Sys: -
5166 parseString_s = QLatin1String("SYSTEM");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("SYSTEM");
-
5167 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:392
yes
Evaluation Count:193
193-392
5168 parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
-
5169 return false;
executed: return false;
Execution Count:392
392
5170 } -
5171 break;
executed: break;
Execution Count:193
193
5172 case SysWS: -
5173 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:133
yes
Evaluation Count:452
133-452
5174 parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
-
5175 return false;
executed: return false;
Execution Count:133
133
5176 } -
5177 break;
executed: break;
Execution Count:452
452
5178 case SysSQ: -
5179 case SysDQ: -
5180 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
5181 next();
executed (the execution status of this line is deduced): next();
-
5182 break;
executed: break;
Execution Count:705
705
5183 case SysSQ2: -
5184 case SysDQ2: -
5185 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
5186 next();
executed (the execution status of this line is deduced): next();
-
5187 break;
executed: break;
Execution Count:8466
8466
5188 case Pub: -
5189 parseString_s = QLatin1String("PUBLIC");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("PUBLIC");
-
5190 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:92
50-92
5191 parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
-
5192 return false;
executed: return false;
Execution Count:50
50
5193 } -
5194 break;
executed: break;
Execution Count:92
92
5195 case PubWS: -
5196 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:120
22-120
5197 parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
-
5198 return false;
executed: return false;
Execution Count:22
22
5199 } -
5200 break;
executed: break;
Execution Count:120
120
5201 case PubSQ: -
5202 case PubDQ: -
5203 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
5204 next();
executed (the execution status of this line is deduced): next();
-
5205 break;
executed: break;
Execution Count:142
142
5206 case PubSQ2: -
5207 case PubDQ2: -
5208 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
5209 next();
executed (the execution status of this line is deduced): next();
-
5210 break;
executed: break;
Execution Count:2376
2376
5211 case PubE: -
5212 next();
executed (the execution status of this line is deduced): next();
-
5213 break;
executed: break;
Execution Count:142
142
5214 case PubWS2: -
5215 publicId = string();
executed (the execution status of this line is deduced): publicId = string();
-
5216 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:102
18-102
5217 parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseExternalID, state);
-
5218 return false;
executed: return false;
Execution Count:18
18
5219 } -
5220 break;
executed: break;
Execution Count:102
102
5221 case Done: -
5222 systemId = string();
executed (the execution status of this line is deduced): systemId = string();
-
5223 next();
executed (the execution status of this line is deduced): next();
-
5224 break;
executed: break;
Execution Count:705
705
5225 } -
5226 }
executed: }
Execution Count:13517
13517
5227 return false;
never executed: return false;
0
5228} -
5229 -
5230/* -
5231 Parse a markupdecl [29]. -
5232*/ -
5233bool QXmlSimpleReaderPrivate::parseMarkupdecl() -
5234{ -
5235 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
5236 const signed char Lt = 1; // < was read
executed (the execution status of this line is deduced): const signed char Lt = 1;
-
5237 const signed char Em = 2; // ! was read
executed (the execution status of this line is deduced): const signed char Em = 2;
-
5238 const signed char CE = 3; // E was read
executed (the execution status of this line is deduced): const signed char CE = 3;
-
5239 const signed char Qm = 4; // ? was read
executed (the execution status of this line is deduced): const signed char Qm = 4;
-
5240 const signed char Dash = 5; // - was read
executed (the execution status of this line is deduced): const signed char Dash = 5;
-
5241 const signed char CA = 6; // A was read
executed (the execution status of this line is deduced): const signed char CA = 6;
-
5242 const signed char CEL = 7; // EL was read
executed (the execution status of this line is deduced): const signed char CEL = 7;
-
5243 const signed char CEN = 8; // EN was read
executed (the execution status of this line is deduced): const signed char CEN = 8;
-
5244 const signed char CN = 9; // N was read
executed (the execution status of this line is deduced): const signed char CN = 9;
-
5245 const signed char Done = 10;
executed (the execution status of this line is deduced): const signed char Done = 10;
-
5246 -
5247 const signed char InpLt = 0; // <
executed (the execution status of this line is deduced): const signed char InpLt = 0;
-
5248 const signed char InpQm = 1; // ?
executed (the execution status of this line is deduced): const signed char InpQm = 1;
-
5249 const signed char InpEm = 2; // !
executed (the execution status of this line is deduced): const signed char InpEm = 2;
-
5250 const signed char InpDash = 3; // -
executed (the execution status of this line is deduced): const signed char InpDash = 3;
-
5251 const signed char InpA = 4; // A
executed (the execution status of this line is deduced): const signed char InpA = 4;
-
5252 const signed char InpE = 5; // E
executed (the execution status of this line is deduced): const signed char InpE = 5;
-
5253 const signed char InpL = 6; // L
executed (the execution status of this line is deduced): const signed char InpL = 6;
-
5254 const signed char InpN = 7; // N
executed (the execution status of this line is deduced): const signed char InpN = 7;
-
5255 const signed char InpUnknown = 8;
executed (the execution status of this line is deduced): const signed char InpUnknown = 8;
-
5256 -
5257 static const signed char table[4][9] = { -
5258 /* InpLt InpQm InpEm InpDash InpA InpE InpL InpN InpUnknown */ -
5259 { Lt, -1, -1, -1, -1, -1, -1, -1, -1 }, // Init -
5260 { -1, Qm, Em, -1, -1, -1, -1, -1, -1 }, // Lt -
5261 { -1, -1, -1, Dash, CA, CE, -1, CN, -1 }, // Em -
5262 { -1, -1, -1, -1, -1, -1, CEL, CEN, -1 } // CE -
5263 }; -
5264 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
5265 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
5266 -
5267 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:722
yes
Evaluation Count:21658
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:2417
yes
Evaluation Count:19241
722-21658
5268 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
5269 } else {
executed: }
Execution Count:3139
3139
5270 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
5271#if defined(QT_QXML_DEBUG) -
5272 qDebug("QXmlSimpleReader: parseMarkupdecl (cont) in state %d", state); -
5273#endif -
5274 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:16888
yes
Evaluation Count:2353
2353-16888
5275 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
5276 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
partially evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16888
0-16888
5277 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
5278#if defined(QT_QXML_DEBUG) -
5279 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
5280#endif -
5281 }
never executed: }
0
5282 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:14480
yes
Evaluation Count:2408
2408-14480
5283 parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5284 return false;
executed: return false;
Execution Count:14480
14480
5285 } -
5286 }
executed: }
Execution Count:2408
2408
5287 }
executed: }
Execution Count:4761
4761
5288 -
5289 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
5290 switch (state) { -
5291 case Qm: -
5292 if (contentHnd) {
never evaluated: contentHnd
0
5293 if (!contentHnd->processingInstruction(name(),string())) {
never evaluated: !contentHnd->processingInstruction(name(),string())
0
5294 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
5295 return false;
never executed: return false;
0
5296 } -
5297 }
never executed: }
0
5298 return true;
never executed: return true;
0
5299 case Dash: -
5300 if (lexicalHnd) {
evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:6
6-55
5301 if (!lexicalHnd->comment(string())) {
partially evaluated: !lexicalHnd->comment(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
5302 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
5303 return false;
never executed: return false;
0
5304 } -
5305 }
executed: }
Execution Count:55
55
5306 return true;
executed: return true;
Execution Count:61
61
5307 case CA: -
5308 return true;
executed: return true;
Execution Count:535
535
5309 case CEL: -
5310 return true;
executed: return true;
Execution Count:1558
1558
5311 case CEN: -
5312 return true;
executed: return true;
Execution Count:880
880
5313 case CN: -
5314 return true;
executed: return true;
Execution Count:56
56
5315 case Done: -
5316 return true;
never executed: return true;
0
5317 case -1: -
5318 // Error -
5319 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
5320 return false;
executed: return false;
Execution Count:3
3
5321 } -
5322 -
5323 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:2353
yes
Evaluation Count:11885
2353-11885
5324 unexpectedEof(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5325 return false;
executed: return false;
Execution Count:2353
2353
5326 } -
5327 if (c == QLatin1Char('<')) {
evaluated: c == QLatin1Char('<')
TRUEFALSE
yes
Evaluation Count:3139
yes
Evaluation Count:8746
3139-8746
5328 input = InpLt;
executed (the execution status of this line is deduced): input = InpLt;
-
5329 } else if (c == QLatin1Char('?')) {
executed: }
Execution Count:3139
evaluated: c == QLatin1Char('?')
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8745
1-8745
5330 input = InpQm;
executed (the execution status of this line is deduced): input = InpQm;
-
5331 } else if (c == QLatin1Char('!')) {
executed: }
Execution Count:1
evaluated: c == QLatin1Char('!')
TRUEFALSE
yes
Evaluation Count:3137
yes
Evaluation Count:5608
1-5608
5332 input = InpEm;
executed (the execution status of this line is deduced): input = InpEm;
-
5333 } else if (c == QLatin1Char('-')) {
executed: }
Execution Count:3137
evaluated: c == QLatin1Char('-')
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:5547
61-5547
5334 input = InpDash;
executed (the execution status of this line is deduced): input = InpDash;
-
5335 } else if (c == QLatin1Char('A')) {
executed: }
Execution Count:61
evaluated: c == QLatin1Char('A')
TRUEFALSE
yes
Evaluation Count:548
yes
Evaluation Count:4999
61-4999
5336 input = InpA;
executed (the execution status of this line is deduced): input = InpA;
-
5337 } else if (c == QLatin1Char('E')) {
executed: }
Execution Count:548
evaluated: c == QLatin1Char('E')
TRUEFALSE
yes
Evaluation Count:2470
yes
Evaluation Count:2529
548-2529
5338 input = InpE;
executed (the execution status of this line is deduced): input = InpE;
-
5339 } else if (c == QLatin1Char('L')) {
executed: }
Execution Count:2470
evaluated: c == QLatin1Char('L')
TRUEFALSE
yes
Evaluation Count:1577
yes
Evaluation Count:952
952-2470
5340 input = InpL;
executed (the execution status of this line is deduced): input = InpL;
-
5341 } else if (c == QLatin1Char('N')) {
executed: }
Execution Count:1577
evaluated: c == QLatin1Char('N')
TRUEFALSE
yes
Evaluation Count:949
yes
Evaluation Count:3
3-1577
5342 input = InpN;
executed (the execution status of this line is deduced): input = InpN;
-
5343 } else {
executed: }
Execution Count:949
949
5344 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
5345 }
executed: }
Execution Count:3
3
5346 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
5347 -
5348 switch (state) { -
5349 case Lt: -
5350 next();
executed (the execution status of this line is deduced): next();
-
5351 break;
executed: break;
Execution Count:3139
3139
5352 case Em: -
5353 next();
executed (the execution status of this line is deduced): next();
-
5354 break;
executed: break;
Execution Count:3137
3137
5355 case CE: -
5356 next();
executed (the execution status of this line is deduced): next();
-
5357 break;
executed: break;
Execution Count:2470
2470
5358 case Qm: -
5359 parsePI_xmldecl = false;
executed (the execution status of this line is deduced): parsePI_xmldecl = false;
-
5360 if (!parsePI()) {
partially evaluated: !parsePI()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
5361 parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5362 return false;
executed: return false;
Execution Count:1
1
5363 } -
5364 break;
never executed: break;
0
5365 case Dash: -
5366 if (!parseComment()) {
evaluated: !parseComment()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:52
9-52
5367 parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5368 return false;
executed: return false;
Execution Count:9
9
5369 } -
5370 break;
executed: break;
Execution Count:52
52
5371 case CA: -
5372 if (!parseAttlistDecl()) {
evaluated: !parseAttlistDecl()
TRUEFALSE
yes
Evaluation Count:490
yes
Evaluation Count:58
58-490
5373 parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5374 return false;
executed: return false;
Execution Count:490
490
5375 } -
5376 break;
executed: break;
Execution Count:58
58
5377 case CEL: -
5378 if (!parseElementDecl()) {
evaluated: !parseElementDecl()
TRUEFALSE
yes
Evaluation Count:1374
yes
Evaluation Count:203
203-1374
5379 parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5380 return false;
executed: return false;
Execution Count:1374
1374
5381 } -
5382 break;
executed: break;
Execution Count:203
203
5383 case CEN: -
5384 if (!parseEntityDecl()) {
evaluated: !parseEntityDecl()
TRUEFALSE
yes
Evaluation Count:535
yes
Evaluation Count:358
358-535
5385 parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5386 return false;
executed: return false;
Execution Count:535
535
5387 } -
5388 break;
executed: break;
Execution Count:358
358
5389 case CN: -
5390 if (!parseNotationDecl()) {
evaluated: !parseNotationDecl()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:11
11-45
5391 parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseMarkupdecl, state);
-
5392 return false;
executed: return false;
Execution Count:45
45
5393 } -
5394 break;
executed: break;
Execution Count:11
11
5395 } -
5396 }
executed: }
Execution Count:9431
9431
5397 return false;
never executed: return false;
0
5398} -
5399 -
5400/* -
5401 Parse a PEReference [69] -
5402*/ -
5403bool QXmlSimpleReaderPrivate::parsePEReference() -
5404{ -
5405 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
5406 const signed char Next = 1;
executed (the execution status of this line is deduced): const signed char Next = 1;
-
5407 const signed char Name = 2;
executed (the execution status of this line is deduced): const signed char Name = 2;
-
5408 const signed char NameR = 3; // same as Name, but already reported
executed (the execution status of this line is deduced): const signed char NameR = 3;
-
5409 const signed char Done = 4;
executed (the execution status of this line is deduced): const signed char Done = 4;
-
5410 -
5411 const signed char InpSemi = 0; // ;
executed (the execution status of this line is deduced): const signed char InpSemi = 0;
-
5412 const signed char InpPer = 1; // %
executed (the execution status of this line is deduced): const signed char InpPer = 1;
-
5413 const signed char InpUnknown = 2;
executed (the execution status of this line is deduced): const signed char InpUnknown = 2;
-
5414 -
5415 static const signed char table[4][3] = { -
5416 /* InpSemi InpPer InpUnknown */ -
5417 { -1, Next, -1 }, // Init -
5418 { -1, -1, Name }, // Next -
5419 { Done, -1, -1 }, // Name -
5420 { Done, -1, -1 } // NameR -
5421 }; -
5422 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
5423 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
5424 -
5425 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:70
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:25
7-70
5426 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
5427 } else {
executed: }
Execution Count:52
52
5428 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
5429#if defined(QT_QXML_DEBUG) -
5430 qDebug("QXmlSimpleReader: parsePEReference (cont) in state %d", state); -
5431#endif -
5432 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:18
7-18
5433 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
5434 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
partially evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
5435 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
5436#if defined(QT_QXML_DEBUG) -
5437 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
5438#endif -
5439 }
never executed: }
0
5440 if (!(this->*function)()) {
partially evaluated: !(this->*function)()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
5441 parseFailed(&QXmlSimpleReaderPrivate::parsePEReference, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePEReference, state);
-
5442 return false;
never executed: return false;
0
5443 } -
5444 }
executed: }
Execution Count:7
7
5445 }
executed: }
Execution Count:25
25
5446 -
5447 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
5448 switch (state) { -
5449 case Name: -
5450 { -
5451 bool skipIt = true;
executed (the execution status of this line is deduced): bool skipIt = true;
-
5452 QString xmlRefString;
executed (the execution status of this line is deduced): QString xmlRefString;
-
5453 -
5454 QMap<QString,QString>::Iterator it;
executed (the execution status of this line is deduced): QMap<QString,QString>::Iterator it;
-
5455 it = parameterEntities.find(ref());
executed (the execution status of this line is deduced): it = parameterEntities.find(ref());
-
5456 if (it != parameterEntities.end()) {
evaluated: it != parameterEntities.end()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:40
12-40
5457 skipIt = false;
executed (the execution status of this line is deduced): skipIt = false;
-
5458 xmlRefString = *it;
executed (the execution status of this line is deduced): xmlRefString = *it;
-
5459 } else if (entityRes) {
executed: }
Execution Count:12
partially evaluated: entityRes
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
0-40
5460 QMap<QString,QXmlSimpleReaderPrivate::ExternParameterEntity>::Iterator it2;
executed (the execution status of this line is deduced): QMap<QString,QXmlSimpleReaderPrivate::ExternParameterEntity>::Iterator it2;
-
5461 it2 = externParameterEntities.find(ref());
executed (the execution status of this line is deduced): it2 = externParameterEntities.find(ref());
-
5462 QXmlInputSource *ret = 0;
executed (the execution status of this line is deduced): QXmlInputSource *ret = 0;
-
5463 if (it2 != externParameterEntities.end()) {
partially evaluated: it2 != externParameterEntities.end()
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
0-40
5464 if (!entityRes->resolveEntity((*it2).publicId, (*it2).systemId, ret)) {
partially evaluated: !entityRes->resolveEntity((*it2).publicId, (*it2).systemId, ret)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
5465 delete ret;
never executed (the execution status of this line is deduced): delete ret;
-
5466 reportParseError(entityRes->errorString());
never executed (the execution status of this line is deduced): reportParseError(entityRes->errorString());
-
5467 return false;
never executed: return false;
0
5468 } -
5469 if (ret) {
partially evaluated: ret
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
5470 xmlRefString = ret->data();
never executed (the execution status of this line is deduced): xmlRefString = ret->data();
-
5471 delete ret;
never executed (the execution status of this line is deduced): delete ret;
-
5472 if (!stripTextDecl(xmlRefString)) {
never evaluated: !stripTextDecl(xmlRefString)
0
5473 reportParseError(QLatin1String(XMLERR_ERRORINTEXTDECL));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("error in the text declaration of an external entity"));
-
5474 return false;
never executed: return false;
0
5475 } -
5476 skipIt = false;
never executed (the execution status of this line is deduced): skipIt = false;
-
5477 }
never executed: }
0
5478 }
executed: }
Execution Count:40
40
5479 }
executed: }
Execution Count:40
40
5480 -
5481 if (skipIt) {
evaluated: skipIt
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:12
12-40
5482 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
0-40
5483 if (!contentHnd->skippedEntity(QLatin1Char('%') + ref())) {
partially evaluated: !contentHnd->skippedEntity(QLatin1Char('%') + ref())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
5484 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
5485 return false;
never executed: return false;
0
5486 } -
5487 }
executed: }
Execution Count:40
40
5488 } else {
executed: }
Execution Count:40
40
5489 if (parsePEReference_context == InEntityValue) {
evaluated: parsePEReference_context == InEntityValue
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
5490 // Included in literal -
5491 if (!insertXmlRef(xmlRefString, ref(), true))
partially evaluated: !insertXmlRef(xmlRefString, ref(), true)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
5492 return false;
never executed: return false;
0
5493 } else if (parsePEReference_context == InDTD) {
executed: }
Execution Count:2
partially evaluated: parsePEReference_context == InDTD
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
5494 // Included as PE -
5495 if (!insertXmlRef(QLatin1Char(' ') + xmlRefString + QLatin1Char(' '), ref(), false))
partially evaluated: !insertXmlRef(QLatin1Char(' ') + xmlRefString + QLatin1Char(' '), ref(), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
5496 return false;
never executed: return false;
0
5497 }
executed: }
Execution Count:10
10
5498 } -
5499 } -
5500 state = NameR;
executed (the execution status of this line is deduced): state = NameR;
-
5501 break;
executed: break;
Execution Count:52
52
5502 case Done: -
5503 return true;
executed: return true;
Execution Count:52
52
5504 case -1: -
5505 // Error -
5506 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
5507 return false;
never executed: return false;
0
5508 } -
5509 -
5510 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:156
18-156
5511 unexpectedEof(&QXmlSimpleReaderPrivate::parsePEReference, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parsePEReference, state);
-
5512 return false;
executed: return false;
Execution Count:18
18
5513 } -
5514 if (c == QLatin1Char(';')) {
evaluated: c == QLatin1Char(';')
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:104
52-104
5515 input = InpSemi;
executed (the execution status of this line is deduced): input = InpSemi;
-
5516 } else if (c == QLatin1Char('%')) {
executed: }
Execution Count:52
evaluated: c == QLatin1Char('%')
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:52
52
5517 input = InpPer;
executed (the execution status of this line is deduced): input = InpPer;
-
5518 } else {
executed: }
Execution Count:52
52
5519 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
5520 }
executed: }
Execution Count:52
52
5521 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
5522 -
5523 switch (state) { -
5524 case Next: -
5525 next();
executed (the execution status of this line is deduced): next();
-
5526 break;
executed: break;
Execution Count:52
52
5527 case Name: -
5528 case NameR: -
5529 parseName_useRef = true;
executed (the execution status of this line is deduced): parseName_useRef = true;
-
5530 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:45
7-45
5531 parseFailed(&QXmlSimpleReaderPrivate::parsePEReference, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parsePEReference, state);
-
5532 return false;
executed: return false;
Execution Count:7
7
5533 } -
5534 break;
executed: break;
Execution Count:45
45
5535 case Done: -
5536 next();
executed (the execution status of this line is deduced): next();
-
5537 break;
executed: break;
Execution Count:52
52
5538 } -
5539 }
executed: }
Execution Count:149
149
5540 return false;
never executed: return false;
0
5541} -
5542 -
5543/* -
5544 Parse a AttlistDecl [52]. -
5545 -
5546 Precondition: the beginning '<!' is already read and the head -
5547 stands on the 'A' of '<!ATTLIST' -
5548*/ -
5549bool QXmlSimpleReaderPrivate::parseAttlistDecl() -
5550{ -
5551 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
5552 const signed char Attlist = 1; // parse the string "ATTLIST"
executed (the execution status of this line is deduced): const signed char Attlist = 1;
-
5553 const signed char Ws = 2; // whitespace read
executed (the execution status of this line is deduced): const signed char Ws = 2;
-
5554 const signed char Name = 3; // parse name
executed (the execution status of this line is deduced): const signed char Name = 3;
-
5555 const signed char Ws1 = 4; // whitespace read
executed (the execution status of this line is deduced): const signed char Ws1 = 4;
-
5556 const signed char Attdef = 5; // parse the AttDef
executed (the execution status of this line is deduced): const signed char Attdef = 5;
-
5557 const signed char Ws2 = 6; // whitespace read
executed (the execution status of this line is deduced): const signed char Ws2 = 6;
-
5558 const signed char Atttype = 7; // parse the AttType
executed (the execution status of this line is deduced): const signed char Atttype = 7;
-
5559 const signed char Ws3 = 8; // whitespace read
executed (the execution status of this line is deduced): const signed char Ws3 = 8;
-
5560 const signed char DDecH = 9; // DefaultDecl with #
executed (the execution status of this line is deduced): const signed char DDecH = 9;
-
5561 const signed char DefReq = 10; // parse the string "REQUIRED"
executed (the execution status of this line is deduced): const signed char DefReq = 10;
-
5562 const signed char DefImp = 11; // parse the string "IMPLIED"
executed (the execution status of this line is deduced): const signed char DefImp = 11;
-
5563 const signed char DefFix = 12; // parse the string "FIXED"
executed (the execution status of this line is deduced): const signed char DefFix = 12;
-
5564 const signed char Attval = 13; // parse the AttValue
executed (the execution status of this line is deduced): const signed char Attval = 13;
-
5565 const signed char Ws4 = 14; // whitespace read
executed (the execution status of this line is deduced): const signed char Ws4 = 14;
-
5566 const signed char Done = 15;
executed (the execution status of this line is deduced): const signed char Done = 15;
-
5567 -
5568 const signed char InpWs = 0; // white space
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
5569 const signed char InpGt = 1; // >
executed (the execution status of this line is deduced): const signed char InpGt = 1;
-
5570 const signed char InpHash = 2; // #
executed (the execution status of this line is deduced): const signed char InpHash = 2;
-
5571 const signed char InpA = 3; // A
executed (the execution status of this line is deduced): const signed char InpA = 3;
-
5572 const signed char InpI = 4; // I
executed (the execution status of this line is deduced): const signed char InpI = 4;
-
5573 const signed char InpF = 5; // F
executed (the execution status of this line is deduced): const signed char InpF = 5;
-
5574 const signed char InpR = 6; // R
executed (the execution status of this line is deduced): const signed char InpR = 6;
-
5575 const signed char InpUnknown = 7;
executed (the execution status of this line is deduced): const signed char InpUnknown = 7;
-
5576 -
5577 static const signed char table[15][8] = { -
5578 /* InpWs InpGt InpHash InpA InpI InpF InpR InpUnknown */ -
5579 { -1, -1, -1, Attlist, -1, -1, -1, -1 }, // Init -
5580 { Ws, -1, -1, -1, -1, -1, -1, -1 }, // Attlist -
5581 { -1, -1, -1, Name, Name, Name, Name, Name }, // Ws -
5582 { Ws1, Done, Attdef, Attdef, Attdef, Attdef, Attdef, Attdef }, // Name -
5583 { -1, Done, Attdef, Attdef, Attdef, Attdef, Attdef, Attdef }, // Ws1 -
5584 { Ws2, -1, -1, -1, -1, -1, -1, -1 }, // Attdef -
5585 { -1, Atttype, Atttype, Atttype, Atttype, Atttype, Atttype, Atttype }, // Ws2 -
5586 { Ws3, -1, -1, -1, -1, -1, -1, -1 }, // Attype -
5587 { -1, Attval, DDecH, Attval, Attval, Attval, Attval, Attval }, // Ws3 -
5588 { -1, -1, -1, -1, DefImp, DefFix, DefReq, -1 }, // DDecH -
5589 { Ws4, Ws4, -1, -1, -1, -1, -1, -1 }, // DefReq -
5590 { Ws4, Ws4, -1, -1, -1, -1, -1, -1 }, // DefImp -
5591 { Ws3, -1, -1, -1, -1, -1, -1, -1 }, // DefFix -
5592 { Ws4, Ws4, -1, -1, -1, -1, -1, -1 }, // Attval -
5593 { -1, Done, Attdef, Attdef, Attdef, Attdef, Attdef, Attdef } // Ws4 -
5594 }; -
5595 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
5596 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
5597 -
5598 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:5236
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:477
yes
Evaluation Count:4759
71-5236
5599 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
5600 } else {
executed: }
Execution Count:548
548
5601 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
5602#if defined(QT_QXML_DEBUG) -
5603 qDebug("QXmlSimpleReader: parseAttlistDecl (cont) in state %d", state); -
5604#endif -
5605 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:4331
yes
Evaluation Count:428
428-4331
5606 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
5607 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:589
yes
Evaluation Count:3742
589-3742
5608 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
5609#if defined(QT_QXML_DEBUG) -
5610 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
5611#endif -
5612 }
executed: }
Execution Count:589
589
5613 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:1729
yes
Evaluation Count:2602
1729-2602
5614 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5615 return false;
executed: return false;
Execution Count:1729
1729
5616 } -
5617 }
executed: }
Execution Count:2602
2602
5618 }
executed: }
Execution Count:3030
3030
5619 -
5620 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
5621 switch (state) { -
5622 case Name: -
5623 attDeclEName = name();
executed (the execution status of this line is deduced): attDeclEName = name();
-
5624 break;
executed: break;
Execution Count:547
547
5625 case Attdef: -
5626 attDeclAName = name();
executed (the execution status of this line is deduced): attDeclAName = name();
-
5627 break;
executed: break;
Execution Count:618
618
5628 case Done: -
5629 return true;
executed: return true;
Execution Count:535
535
5630 case -1: -
5631 // Error -
5632 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
5633 return false;
executed: return false;
Execution Count:5
5
5634 } -
5635 -
5636 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:428
yes
Evaluation Count:6877
428-6877
5637 unexpectedEof(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5638 return false;
executed: return false;
Execution Count:428
428
5639 } -
5640 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:2425
yes
Evaluation Count:4452
2425-4452
5641 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
5642 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:2425
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:1060
yes
Evaluation Count:3392
1060-3392
5643 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
5644 } else if (c == QLatin1Char('#')) {
executed: }
Execution Count:1060
evaluated: c == QLatin1Char('#')
TRUEFALSE
yes
Evaluation Count:427
yes
Evaluation Count:2965
427-2965
5645 input = InpHash;
executed (the execution status of this line is deduced): input = InpHash;
-
5646 } else if (c == QLatin1Char('A')) {
executed: }
Execution Count:427
evaluated: c == QLatin1Char('A')
TRUEFALSE
yes
Evaluation Count:558
yes
Evaluation Count:2407
427-2407
5647 input = InpA;
executed (the execution status of this line is deduced): input = InpA;
-
5648 } else if (c == QLatin1Char('I')) {
executed: }
Execution Count:558
evaluated: c == QLatin1Char('I')
TRUEFALSE
yes
Evaluation Count:424
yes
Evaluation Count:1983
424-1983
5649 input = InpI;
executed (the execution status of this line is deduced): input = InpI;
-
5650 } else if (c == QLatin1Char('F')) {
executed: }
Execution Count:424
evaluated: c == QLatin1Char('F')
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:1962
21-1962
5651 input = InpF;
executed (the execution status of this line is deduced): input = InpF;
-
5652 } else if (c == QLatin1Char('R')) {
executed: }
Execution Count:21
evaluated: c == QLatin1Char('R')
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1952
10-1952
5653 input = InpR;
executed (the execution status of this line is deduced): input = InpR;
-
5654 } else {
executed: }
Execution Count:10
10
5655 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
5656 }
executed: }
Execution Count:1952
1952
5657 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
5658 -
5659 switch (state) { -
5660 case Attlist: -
5661 parseString_s = QLatin1String("ATTLIST");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("ATTLIST");
-
5662 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:428
yes
Evaluation Count:120
120-428
5663 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5664 return false;
executed: return false;
Execution Count:428
428
5665 } -
5666 break;
executed: break;
Execution Count:120
120
5667 case Ws: -
5668 case Ws1: -
5669 case Ws2: -
5670 case Ws3: -
5671 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:545
yes
Evaluation Count:1799
545-1799
5672 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5673 return false;
executed: return false;
Execution Count:545
545
5674 } -
5675 break;
executed: break;
Execution Count:1799
1799
5676 case Name: -
5677 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
5678 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:401
yes
Evaluation Count:146
146-401
5679 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5680 return false;
executed: return false;
Execution Count:401
401
5681 } -
5682 break;
executed: break;
Execution Count:146
146
5683 case Attdef: -
5684 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
5685 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:230
yes
Evaluation Count:388
230-388
5686 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5687 return false;
executed: return false;
Execution Count:230
230
5688 } -
5689 break;
executed: break;
Execution Count:388
388
5690 case Atttype: -
5691 if (!parseAttType()) {
evaluated: !parseAttType()
TRUEFALSE
yes
Evaluation Count:489
yes
Evaluation Count:128
128-489
5692 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5693 return false;
executed: return false;
Execution Count:489
489
5694 } -
5695 break;
executed: break;
Execution Count:128
128
5696 case DDecH: -
5697 next();
executed (the execution status of this line is deduced): next();
-
5698 break;
executed: break;
Execution Count:425
425
5699 case DefReq: -
5700 parseString_s = QLatin1String("REQUIRED");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("REQUIRED");
-
5701 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1
1-9
5702 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5703 return false;
executed: return false;
Execution Count:9
9
5704 } -
5705 break;
executed: break;
Execution Count:1
1
5706 case DefImp: -
5707 parseString_s = QLatin1String("IMPLIED");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("IMPLIED");
-
5708 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:334
yes
Evaluation Count:60
60-334
5709 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5710 return false;
executed: return false;
Execution Count:334
334
5711 } -
5712 break;
executed: break;
Execution Count:60
60
5713 case DefFix: -
5714 parseString_s = QLatin1String("FIXED");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("FIXED");
-
5715 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:9
9-12
5716 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5717 return false;
executed: return false;
Execution Count:12
12
5718 } -
5719 break;
executed: break;
Execution Count:9
9
5720 case Attval: -
5721 if (!parseAttValue()) {
evaluated: !parseAttValue()
TRUEFALSE
yes
Evaluation Count:127
yes
Evaluation Count:80
80-127
5722 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5723 return false;
executed: return false;
Execution Count:127
127
5724 } -
5725 break;
executed: break;
Execution Count:80
80
5726 case Ws4: -
5727 if (declHnd) {
partially evaluated: declHnd
TRUEFALSE
yes
Evaluation Count:606
no
Evaluation Count:0
0-606
5728 // ### not all values are computed yet... -
5729 if (!declHnd->attributeDecl(attDeclEName, attDeclAName, QLatin1String(""), QLatin1String(""), QLatin1String(""))) {
partially evaluated: !declHnd->attributeDecl(attDeclEName, attDeclAName, QLatin1String(""), QLatin1String(""), QLatin1String(""))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:606
0-606
5730 reportParseError(declHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(declHnd->errorString());
-
5731 return false;
never executed: return false;
0
5732 } -
5733 }
executed: }
Execution Count:606
606
5734 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:571
35-571
5735 parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttlistDecl, state);
-
5736 return false;
executed: return false;
Execution Count:35
35
5737 } -
5738 break;
executed: break;
Execution Count:571
571
5739 case Done: -
5740 next();
executed (the execution status of this line is deduced): next();
-
5741 break;
executed: break;
Execution Count:535
535
5742 } -
5743 }
executed: }
Execution Count:4267
4267
5744 return false;
never executed: return false;
0
5745} -
5746 -
5747/* -
5748 Parse a AttType [54] -
5749*/ -
5750bool QXmlSimpleReaderPrivate::parseAttType() -
5751{ -
5752 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
5753 const signed char ST = 1; // StringType
executed (the execution status of this line is deduced): const signed char ST = 1;
-
5754 const signed char TTI = 2; // TokenizedType starting with 'I'
executed (the execution status of this line is deduced): const signed char TTI = 2;
-
5755 const signed char TTI2 = 3; // TokenizedType helpstate
executed (the execution status of this line is deduced): const signed char TTI2 = 3;
-
5756 const signed char TTI3 = 4; // TokenizedType helpstate
executed (the execution status of this line is deduced): const signed char TTI3 = 4;
-
5757 const signed char TTE = 5; // TokenizedType starting with 'E'
executed (the execution status of this line is deduced): const signed char TTE = 5;
-
5758 const signed char TTEY = 6; // TokenizedType starting with 'ENTITY'
executed (the execution status of this line is deduced): const signed char TTEY = 6;
-
5759 const signed char TTEI = 7; // TokenizedType starting with 'ENTITI'
executed (the execution status of this line is deduced): const signed char TTEI = 7;
-
5760 const signed char N = 8; // N read (TokenizedType or Notation)
executed (the execution status of this line is deduced): const signed char N = 8;
-
5761 const signed char TTNM = 9; // TokenizedType starting with 'NM'
executed (the execution status of this line is deduced): const signed char TTNM = 9;
-
5762 const signed char TTNM2 = 10; // TokenizedType helpstate
executed (the execution status of this line is deduced): const signed char TTNM2 = 10;
-
5763 const signed char NO = 11; // Notation
executed (the execution status of this line is deduced): const signed char NO = 11;
-
5764 const signed char NO2 = 12; // Notation helpstate
executed (the execution status of this line is deduced): const signed char NO2 = 12;
-
5765 const signed char NO3 = 13; // Notation helpstate
executed (the execution status of this line is deduced): const signed char NO3 = 13;
-
5766 const signed char NOName = 14; // Notation, read name
executed (the execution status of this line is deduced): const signed char NOName = 14;
-
5767 const signed char NO4 = 15; // Notation helpstate
executed (the execution status of this line is deduced): const signed char NO4 = 15;
-
5768 const signed char EN = 16; // Enumeration
executed (the execution status of this line is deduced): const signed char EN = 16;
-
5769 const signed char ENNmt = 17; // Enumeration, read Nmtoken
executed (the execution status of this line is deduced): const signed char ENNmt = 17;
-
5770 const signed char EN2 = 18; // Enumeration helpstate
executed (the execution status of this line is deduced): const signed char EN2 = 18;
-
5771 const signed char ADone = 19; // almost done (make next and accept)
executed (the execution status of this line is deduced): const signed char ADone = 19;
-
5772 const signed char Done = 20;
executed (the execution status of this line is deduced): const signed char Done = 20;
-
5773 -
5774 const signed char InpWs = 0; // whitespace
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
5775 const signed char InpOp = 1; // (
executed (the execution status of this line is deduced): const signed char InpOp = 1;
-
5776 const signed char InpCp = 2; //)
executed (the execution status of this line is deduced): const signed char InpCp = 2;
-
5777 const signed char InpPipe = 3; // |
executed (the execution status of this line is deduced): const signed char InpPipe = 3;
-
5778 const signed char InpC = 4; // C
executed (the execution status of this line is deduced): const signed char InpC = 4;
-
5779 const signed char InpE = 5; // E
executed (the execution status of this line is deduced): const signed char InpE = 5;
-
5780 const signed char InpI = 6; // I
executed (the execution status of this line is deduced): const signed char InpI = 6;
-
5781 const signed char InpM = 7; // M
executed (the execution status of this line is deduced): const signed char InpM = 7;
-
5782 const signed char InpN = 8; // N
executed (the execution status of this line is deduced): const signed char InpN = 8;
-
5783 const signed char InpO = 9; // O
executed (the execution status of this line is deduced): const signed char InpO = 9;
-
5784 const signed char InpR = 10; // R
executed (the execution status of this line is deduced): const signed char InpR = 10;
-
5785 const signed char InpS = 11; // S
executed (the execution status of this line is deduced): const signed char InpS = 11;
-
5786 const signed char InpY = 12; // Y
executed (the execution status of this line is deduced): const signed char InpY = 12;
-
5787 const signed char InpUnknown = 13;
executed (the execution status of this line is deduced): const signed char InpUnknown = 13;
-
5788 -
5789 static const signed char table[19][14] = { -
5790 /* InpWs InpOp InpCp InpPipe InpC InpE InpI InpM InpN InpO InpR InpS InpY InpUnknown */ -
5791 { -1, EN, -1, -1, ST, TTE, TTI, -1, N, -1, -1, -1, -1, -1 }, // Init -
5792 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done }, // ST -
5793 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, TTI2, Done, Done, Done }, // TTI -
5794 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, TTI3, Done, Done }, // TTI2 -
5795 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done }, // TTI3 -
5796 { -1, -1, -1, -1, -1, -1, TTEI, -1, -1, -1, -1, -1, TTEY, -1 }, // TTE -
5797 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done }, // TTEY -
5798 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done }, // TTEI -
5799 { -1, -1, -1, -1, -1, -1, -1, TTNM, -1, NO, -1, -1, -1, -1 }, // N -
5800 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, TTNM2, Done, Done }, // TTNM -
5801 { Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done, Done }, // TTNM2 -
5802 { NO2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // NO -
5803 { -1, NO3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // NO2 -
5804 { NOName, NOName, NOName, NOName, NOName, NOName, NOName, NOName, NOName, NOName, NOName, NOName, NOName, NOName }, // NO3 -
5805 { NO4, -1, ADone, NO3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // NOName -
5806 { -1, -1, ADone, NO3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // NO4 -
5807 { -1, -1, ENNmt, -1, ENNmt, ENNmt, ENNmt, ENNmt, ENNmt, ENNmt, ENNmt, ENNmt, ENNmt, ENNmt }, // EN -
5808 { EN2, -1, ADone, EN, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // ENNmt -
5809 { -1, -1, ADone, EN, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } // EN2 -
5810 }; -
5811 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
5812 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
5813 -
5814 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:1519
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:540
yes
Evaluation Count:979
77-1519
5815 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
5816 } else {
executed: }
Execution Count:617
617
5817 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
5818#if defined(QT_QXML_DEBUG) -
5819 qDebug("QXmlSimpleReader: parseAttType (cont) in state %d", state); -
5820#endif -
5821 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:747
yes
Evaluation Count:232
232-747
5822 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
5823 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:721
26-721
5824 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
5825#if defined(QT_QXML_DEBUG) -
5826 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
5827#endif -
5828 }
executed: }
Execution Count:26
26
5829 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:267
yes
Evaluation Count:480
267-480
5830 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5831 return false;
executed: return false;
Execution Count:267
267
5832 } -
5833 }
executed: }
Execution Count:480
480
5834 }
executed: }
Execution Count:712
712
5835 -
5836 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
5837 switch (state) { -
5838 case ADone: -
5839 return true;
executed: return true;
Execution Count:32
32
5840 case Done: -
5841 return true;
executed: return true;
Execution Count:582
582
5842 case -1: -
5843 // Error -
5844 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
5845 return false;
executed: return false;
Execution Count:3
3
5846 } -
5847 -
5848 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:232
yes
Evaluation Count:1531
232-1531
5849 unexpectedEof(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5850 return false;
executed: return false;
Execution Count:232
232
5851 } -
5852 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:601
yes
Evaluation Count:930
601-930
5853 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
5854 } else if (c == QLatin1Char('(')) {
executed: }
Execution Count:601
evaluated: c == QLatin1Char('(')
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:896
34-896
5855 input = InpOp;
executed (the execution status of this line is deduced): input = InpOp;
-
5856 } else if (c == QLatin1Char(')')) {
executed: }
Execution Count:34
evaluated: c == QLatin1Char(')')
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:864
32-864
5857 input = InpCp;
executed (the execution status of this line is deduced): input = InpCp;
-
5858 } else if (c == QLatin1Char('|')) {
executed: }
Execution Count:32
evaluated: c == QLatin1Char('|')
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:843
21-843
5859 input = InpPipe;
executed (the execution status of this line is deduced): input = InpPipe;
-
5860 } else if (c == QLatin1Char('C')) {
executed: }
Execution Count:21
evaluated: c == QLatin1Char('C')
TRUEFALSE
yes
Evaluation Count:471
yes
Evaluation Count:372
21-471
5861 input = InpC;
executed (the execution status of this line is deduced): input = InpC;
-
5862 } else if (c == QLatin1Char('E')) {
executed: }
Execution Count:471
evaluated: c == QLatin1Char('E')
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:342
30-471
5863 input = InpE;
executed (the execution status of this line is deduced): input = InpE;
-
5864 } else if (c == QLatin1Char('I')) {
executed: }
Execution Count:30
evaluated: c == QLatin1Char('I')
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:302
30-302
5865 input = InpI;
executed (the execution status of this line is deduced): input = InpI;
-
5866 } else if (c == QLatin1Char('M')) {
executed: }
Execution Count:40
evaluated: c == QLatin1Char('M')
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:251
40-251
5867 input = InpM;
executed (the execution status of this line is deduced): input = InpM;
-
5868 } else if (c == QLatin1Char('N')) {
executed: }
Execution Count:51
evaluated: c == QLatin1Char('N')
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:178
51-178
5869 input = InpN;
executed (the execution status of this line is deduced): input = InpN;
-
5870 } else if (c == QLatin1Char('O')) {
executed: }
Execution Count:73
evaluated: c == QLatin1Char('O')
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:157
21-157
5871 input = InpO;
executed (the execution status of this line is deduced): input = InpO;
-
5872 } else if (c == QLatin1Char('R')) {
executed: }
Execution Count:21
evaluated: c == QLatin1Char('R')
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:137
20-137
5873 input = InpR;
executed (the execution status of this line is deduced): input = InpR;
-
5874 } else if (c == QLatin1Char('S')) {
executed: }
Execution Count:20
evaluated: c == QLatin1Char('S')
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:77
20-77
5875 input = InpS;
executed (the execution status of this line is deduced): input = InpS;
-
5876 } else if (c == QLatin1Char('Y')) {
executed: }
Execution Count:60
evaluated: c == QLatin1Char('Y')
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:57
20-60
5877 input = InpY;
executed (the execution status of this line is deduced): input = InpY;
-
5878 } else {
executed: }
Execution Count:20
20
5879 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
5880 }
executed: }
Execution Count:57
57
5881 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
5882 -
5883 switch (state) { -
5884 case ST: -
5885 parseString_s = QLatin1String("CDATA");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("CDATA");
-
5886 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:324
yes
Evaluation Count:147
147-324
5887 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5888 return false;
executed: return false;
Execution Count:324
324
5889 } -
5890 break;
executed: break;
Execution Count:147
147
5891 case TTI: -
5892 parseString_s = QLatin1String("ID");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("ID");
-
5893 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:12
12-18
5894 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5895 return false;
executed: return false;
Execution Count:18
18
5896 } -
5897 break;
executed: break;
Execution Count:12
12
5898 case TTI2: -
5899 parseString_s = QLatin1String("REF");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("REF");
-
5900 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:10
10
5901 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5902 return false;
executed: return false;
Execution Count:10
10
5903 } -
5904 break;
executed: break;
Execution Count:10
10
5905 case TTI3: -
5906 next(); // S
executed (the execution status of this line is deduced): next();
-
5907 break;
executed: break;
Execution Count:10
10
5908 case TTE: -
5909 parseString_s = QLatin1String("ENTIT");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("ENTIT");
-
5910 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:6
6-24
5911 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5912 return false;
executed: return false;
Execution Count:24
24
5913 } -
5914 break;
executed: break;
Execution Count:6
6
5915 case TTEY: -
5916 next(); // Y
executed (the execution status of this line is deduced): next();
-
5917 break;
executed: break;
Execution Count:20
20
5918 case TTEI: -
5919 parseString_s = QLatin1String("IES");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("IES");
-
5920 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
5921 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5922 return false;
executed: return false;
Execution Count:5
5
5923 } -
5924 break;
executed: break;
Execution Count:5
5
5925 case N: -
5926 next(); // N
executed (the execution status of this line is deduced): next();
-
5927 break;
executed: break;
Execution Count:73
73
5928 case TTNM: -
5929 parseString_s = QLatin1String("MTOKEN");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("MTOKEN");
-
5930 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:11
11-40
5931 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5932 return false;
executed: return false;
Execution Count:40
40
5933 } -
5934 break;
executed: break;
Execution Count:11
11
5935 case TTNM2: -
5936 next(); // S
executed (the execution status of this line is deduced): next();
-
5937 break;
executed: break;
Execution Count:50
50
5938 case NO: -
5939 parseString_s = QLatin1String("OTATION");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("OTATION");
-
5940 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:4
4-17
5941 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5942 return false;
executed: return false;
Execution Count:17
17
5943 } -
5944 break;
executed: break;
Execution Count:4
4
5945 case NO2: -
5946 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:12
8-12
5947 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5948 return false;
executed: return false;
Execution Count:8
8
5949 } -
5950 break;
executed: break;
Execution Count:12
12
5951 case NO3: -
5952 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:20
10-20
5953 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5954 return false;
executed: return false;
Execution Count:10
10
5955 } -
5956 break;
executed: break;
Execution Count:20
20
5957 case NOName: -
5958 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
5959 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:19
11-19
5960 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5961 return false;
executed: return false;
Execution Count:11
11
5962 } -
5963 break;
executed: break;
Execution Count:19
19
5964 case NO4: -
5965 if (!eat_ws()) {
never evaluated: !eat_ws()
0
5966 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5967 return false;
never executed: return false;
0
5968 } -
5969 break;
never executed: break;
0
5970 case EN: -
5971 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:16
8-16
5972 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5973 return false;
executed: return false;
Execution Count:8
8
5974 } -
5975 break;
executed: break;
Execution Count:16
16
5976 case ENNmt: -
5977 if (!parseNmtoken()) {
evaluated: !parseNmtoken()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:19
5-19
5978 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5979 return false;
executed: return false;
Execution Count:5
5
5980 } -
5981 break;
executed: break;
Execution Count:19
19
5982 case EN2: -
5983 if (!eat_ws()) {
never evaluated: !eat_ws()
0
5984 parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttType, state);
-
5985 return false;
never executed: return false;
0
5986 } -
5987 break;
never executed: break;
0
5988 case ADone: -
5989 next();
executed (the execution status of this line is deduced): next();
-
5990 break;
executed: break;
Execution Count:32
32
5991 } -
5992 }
executed: }
Execution Count:1051
1051
5993 return false;
never executed: return false;
0
5994} -
5995 -
5996/* -
5997 Parse a AttValue [10] -
5998 -
5999 Precondition: the head stands on the beginning " or ' -
6000 -
6001 If this function was successful, the head stands on the first -
6002 character after the closing " or ' and the value of the attribute -
6003 is in string(). -
6004*/ -
6005bool QXmlSimpleReaderPrivate::parseAttValue() -
6006{ -
6007 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
6008 const signed char Dq = 1; // double quotes were read
executed (the execution status of this line is deduced): const signed char Dq = 1;
-
6009 const signed char DqRef = 2; // read references in double quotes
executed (the execution status of this line is deduced): const signed char DqRef = 2;
-
6010 const signed char DqC = 3; // signed character read in double quotes
executed (the execution status of this line is deduced): const signed char DqC = 3;
-
6011 const signed char Sq = 4; // single quotes were read
executed (the execution status of this line is deduced): const signed char Sq = 4;
-
6012 const signed char SqRef = 5; // read references in single quotes
executed (the execution status of this line is deduced): const signed char SqRef = 5;
-
6013 const signed char SqC = 6; // signed character read in single quotes
executed (the execution status of this line is deduced): const signed char SqC = 6;
-
6014 const signed char Done = 7;
executed (the execution status of this line is deduced): const signed char Done = 7;
-
6015 -
6016 const signed char InpDq = 0; // "
executed (the execution status of this line is deduced): const signed char InpDq = 0;
-
6017 const signed char InpSq = 1; // '
executed (the execution status of this line is deduced): const signed char InpSq = 1;
-
6018 const signed char InpAmp = 2; // &
executed (the execution status of this line is deduced): const signed char InpAmp = 2;
-
6019 const signed char InpLt = 3; // <
executed (the execution status of this line is deduced): const signed char InpLt = 3;
-
6020 const signed char InpUnknown = 4;
executed (the execution status of this line is deduced): const signed char InpUnknown = 4;
-
6021 -
6022 static const signed char table[7][5] = { -
6023 /* InpDq InpSq InpAmp InpLt InpUnknown */ -
6024 { Dq, Sq, -1, -1, -1 }, // Init -
6025 { Done, DqC, DqRef, -1, DqC }, // Dq -
6026 { Done, DqC, DqRef, -1, DqC }, // DqRef -
6027 { Done, DqC, DqRef, -1, DqC }, // DqC -
6028 { SqC, Done, SqRef, -1, SqC }, // Sq -
6029 { SqC, Done, SqRef, -1, SqC }, // SqRef -
6030 { SqC, Done, SqRef, -1, SqC } // SqRef -
6031 }; -
6032 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
6033 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
6034 -
6035 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:28714
yes
Evaluation Count:1870
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:729
yes
Evaluation Count:1141
729-28714
6036 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
6037 } else {
executed: }
Execution Count:29443
29443
6038 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
6039#if defined(QT_QXML_DEBUG) -
6040 qDebug("QXmlSimpleReader: parseAttValue (cont) in state %d", state); -
6041#endif -
6042 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:948
193-948
6043 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
6044 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
partially evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:193
0-193
6045 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
6046#if defined(QT_QXML_DEBUG) -
6047 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
6048#endif -
6049 }
never executed: }
0
6050 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:124
69-124
6051 parseFailed(&QXmlSimpleReaderPrivate::parseAttValue, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttValue, state);
-
6052 return false;
executed: return false;
Execution Count:69
69
6053 } -
6054 }
executed: }
Execution Count:124
124
6055 }
executed: }
Execution Count:1072
1072
6056 -
6057 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
6058 switch (state) { -
6059 case Done: -
6060 return true;
executed: return true;
Execution Count:29426
29426
6061 case -1: -
6062 // Error -
6063 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
6064 return false;
executed: return false;
Execution Count:6
6
6065 } -
6066 -
6067 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:948
yes
Evaluation Count:377449
948-377449
6068 unexpectedEof(&QXmlSimpleReaderPrivate::parseAttValue, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseAttValue, state);
-
6069 return false;
executed: return false;
Execution Count:948
948
6070 } -
6071 if (c == QLatin1Char('"')) {
evaluated: c == QLatin1Char('"')
TRUEFALSE
yes
Evaluation Count:55590
yes
Evaluation Count:321859
55590-321859
6072 input = InpDq;
executed (the execution status of this line is deduced): input = InpDq;
-
6073 } else if (c == QLatin1Char('\'')) {
executed: }
Execution Count:55590
evaluated: c == QLatin1Char('\'')
TRUEFALSE
yes
Evaluation Count:3578
yes
Evaluation Count:318281
3578-318281
6074 input = InpSq;
executed (the execution status of this line is deduced): input = InpSq;
-
6075 } else if (c == QLatin1Char('&')) {
executed: }
Execution Count:3578
evaluated: c == QLatin1Char('&')
TRUEFALSE
yes
Evaluation Count:392
yes
Evaluation Count:317889
392-317889
6076 input = InpAmp;
executed (the execution status of this line is deduced): input = InpAmp;
-
6077 } else if (c == QLatin1Char('<')) {
executed: }
Execution Count:392
evaluated: c == QLatin1Char('<')
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:317884
5-317884
6078 input = InpLt;
executed (the execution status of this line is deduced): input = InpLt;
-
6079 } else {
executed: }
Execution Count:5
5
6080 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
6081 }
executed: }
Execution Count:317884
317884
6082 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
6083 -
6084 switch (state) { -
6085 case Dq: -
6086 case Sq: -
6087 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
6088 next();
executed (the execution status of this line is deduced): next();
-
6089 break;
executed: break;
Execution Count:29442
29442
6090 case DqRef: -
6091 case SqRef: -
6092 parseReference_context = InAttributeValue;
executed (the execution status of this line is deduced): parseReference_context = InAttributeValue;
-
6093 if (!parseReference()) {
evaluated: !parseReference()
TRUEFALSE
yes
Evaluation Count:135
yes
Evaluation Count:257
135-257
6094 parseFailed(&QXmlSimpleReaderPrivate::parseAttValue, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttValue, state);
-
6095 return false;
executed: return false;
Execution Count:135
135
6096 } -
6097 break;
executed: break;
Execution Count:257
257
6098 case DqC: -
6099 case SqC: -
6100 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
6101 next();
executed (the execution status of this line is deduced): next();
-
6102 break;
executed: break;
Execution Count:318183
318183
6103 case Done: -
6104 next();
executed (the execution status of this line is deduced): next();
-
6105 break;
executed: break;
Execution Count:29426
29426
6106 } -
6107 }
executed: }
Execution Count:377314
377314
6108 return false;
never executed: return false;
0
6109} -
6110 -
6111/* -
6112 Parse a elementdecl [45]. -
6113 -
6114 Precondition: the beginning '<!E' is already read and the head -
6115 stands on the 'L' of '<!ELEMENT' -
6116*/ -
6117bool QXmlSimpleReaderPrivate::parseElementDecl() -
6118{ -
6119 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
6120 const signed char Elem = 1; // parse the beginning string
executed (the execution status of this line is deduced): const signed char Elem = 1;
-
6121 const signed char Ws1 = 2; // whitespace required
executed (the execution status of this line is deduced): const signed char Ws1 = 2;
-
6122 const signed char Nam = 3; // parse Name
executed (the execution status of this line is deduced): const signed char Nam = 3;
-
6123 const signed char Ws2 = 4; // whitespace required
executed (the execution status of this line is deduced): const signed char Ws2 = 4;
-
6124 const signed char Empty = 5; // read EMPTY
executed (the execution status of this line is deduced): const signed char Empty = 5;
-
6125 const signed char Any = 6; // read ANY
executed (the execution status of this line is deduced): const signed char Any = 6;
-
6126 const signed char Cont = 7; // read contentspec (except ANY or EMPTY)
executed (the execution status of this line is deduced): const signed char Cont = 7;
-
6127 const signed char Mix = 8; // read Mixed
executed (the execution status of this line is deduced): const signed char Mix = 8;
-
6128 const signed char Mix2 = 9; //
executed (the execution status of this line is deduced): const signed char Mix2 = 9;
-
6129 const signed char Mix3 = 10; //
executed (the execution status of this line is deduced): const signed char Mix3 = 10;
-
6130 const signed char MixN1 = 11; //
executed (the execution status of this line is deduced): const signed char MixN1 = 11;
-
6131 const signed char MixN2 = 12; //
executed (the execution status of this line is deduced): const signed char MixN2 = 12;
-
6132 const signed char MixN3 = 13; //
executed (the execution status of this line is deduced): const signed char MixN3 = 13;
-
6133 const signed char MixN4 = 14; //
executed (the execution status of this line is deduced): const signed char MixN4 = 14;
-
6134 const signed char Cp = 15; // parse cp
executed (the execution status of this line is deduced): const signed char Cp = 15;
-
6135 const signed char Cp2 = 16; //
executed (the execution status of this line is deduced): const signed char Cp2 = 16;
-
6136 const signed char WsD = 17; // eat whitespace before Done
executed (the execution status of this line is deduced): const signed char WsD = 17;
-
6137 const signed char Done = 18;
executed (the execution status of this line is deduced): const signed char Done = 18;
-
6138 -
6139 const signed char InpWs = 0;
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
6140 const signed char InpGt = 1; // >
executed (the execution status of this line is deduced): const signed char InpGt = 1;
-
6141 const signed char InpPipe = 2; // |
executed (the execution status of this line is deduced): const signed char InpPipe = 2;
-
6142 const signed char InpOp = 3; // (
executed (the execution status of this line is deduced): const signed char InpOp = 3;
-
6143 const signed char InpCp = 4; //)
executed (the execution status of this line is deduced): const signed char InpCp = 4;
-
6144 const signed char InpHash = 5; // #
executed (the execution status of this line is deduced): const signed char InpHash = 5;
-
6145 const signed char InpQm = 6; // ?
executed (the execution status of this line is deduced): const signed char InpQm = 6;
-
6146 const signed char InpAst = 7; // *
executed (the execution status of this line is deduced): const signed char InpAst = 7;
-
6147 const signed char InpPlus = 8; // +
executed (the execution status of this line is deduced): const signed char InpPlus = 8;
-
6148 const signed char InpA = 9; // A
executed (the execution status of this line is deduced): const signed char InpA = 9;
-
6149 const signed char InpE = 10; // E
executed (the execution status of this line is deduced): const signed char InpE = 10;
-
6150 const signed char InpL = 11; // L
executed (the execution status of this line is deduced): const signed char InpL = 11;
-
6151 const signed char InpUnknown = 12;
executed (the execution status of this line is deduced): const signed char InpUnknown = 12;
-
6152 -
6153 static const signed char table[18][13] = { -
6154 /* InpWs InpGt InpPipe InpOp InpCp InpHash InpQm InpAst InpPlus InpA InpE InpL InpUnknown */ -
6155 { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, Elem, -1 }, // Init -
6156 { Ws1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // Elem -
6157 { -1, -1, -1, -1, -1, -1, -1, -1, -1, Nam, Nam, Nam, Nam }, // Ws1 -
6158 { Ws2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // Nam -
6159 { -1, -1, -1, Cont, -1, -1, -1, -1, -1, Any, Empty, -1, -1 }, // Ws2 -
6160 { WsD, Done, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // Empty -
6161 { WsD, Done, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // Any -
6162 { -1, -1, -1, Cp, Cp, Mix, -1, -1, -1, Cp, Cp, Cp, Cp }, // Cont -
6163 { Mix2, -1, MixN1, -1, Mix3, -1, -1, -1, -1, -1, -1, -1, -1 }, // Mix -
6164 { -1, -1, MixN1, -1, Mix3, -1, -1, -1, -1, -1, -1, -1, -1 }, // Mix2 -
6165 { WsD, Done, -1, -1, -1, -1, -1, WsD, -1, -1, -1, -1, -1 }, // Mix3 -
6166 { -1, -1, -1, -1, -1, -1, -1, -1, -1, MixN2, MixN2, MixN2, MixN2 }, // MixN1 -
6167 { MixN3, -1, MixN1, -1, MixN4, -1, -1, -1, -1, -1, -1, -1, -1 }, // MixN2 -
6168 { -1, -1, MixN1, -1, MixN4, -1, -1, -1, -1, -1, -1, -1, -1 }, // MixN3 -
6169 { -1, -1, -1, -1, -1, -1, -1, WsD, -1, -1, -1, -1, -1 }, // MixN4 -
6170 { WsD, Done, -1, -1, -1, -1, Cp2, Cp2, Cp2, -1, -1, -1, -1 }, // Cp -
6171 { WsD, Done, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // Cp2 -
6172 { -1, Done, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } // WsD -
6173 }; -
6174 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
6175 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
6176 -
6177 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:9563
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1364
yes
Evaluation Count:8199
213-9563
6178 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
6179 } else {
executed: }
Execution Count:1577
1577
6180 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
6181#if defined(QT_QXML_DEBUG) -
6182 qDebug("QXmlSimpleReader: parseElementDecl (cont) in state %d", state); -
6183#endif -
6184 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:6984
yes
Evaluation Count:1215
1215-6984
6185 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
6186 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:1242
yes
Evaluation Count:5742
1242-5742
6187 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
6188#if defined(QT_QXML_DEBUG) -
6189 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
6190#endif -
6191 }
executed: }
Execution Count:1242
1242
6192 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:2455
yes
Evaluation Count:4529
2455-4529
6193 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6194 return false;
executed: return false;
Execution Count:2455
2455
6195 } -
6196 }
executed: }
Execution Count:4529
4529
6197 }
executed: }
Execution Count:5744
5744
6198 -
6199 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
6200 switch (state) { -
6201 case Done: -
6202 return true;
executed: return true;
Execution Count:1558
1558
6203 case -1: -
6204 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
6205 return false;
executed: return false;
Execution Count:12
12
6206 } -
6207 -
6208 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:1215
yes
Evaluation Count:12207
1215-12207
6209 unexpectedEof(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6210 return false;
executed: return false;
Execution Count:1215
1215
6211 } -
6212 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:3158
yes
Evaluation Count:9049
3158-9049
6213 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
6214 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:3158
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:1558
yes
Evaluation Count:7491
1558-7491
6215 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
6216 } else if (c == QLatin1Char('|')) {
executed: }
Execution Count:1558
evaluated: c == QLatin1Char('|')
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:7479
12-7479
6217 input = InpPipe;
executed (the execution status of this line is deduced): input = InpPipe;
-
6218 } else if (c == QLatin1Char('(')) {
executed: }
Execution Count:12
evaluated: c == QLatin1Char('(')
TRUEFALSE
yes
Evaluation Count:1446
yes
Evaluation Count:6033
12-6033
6219 input = InpOp;
executed (the execution status of this line is deduced): input = InpOp;
-
6220 } else if (c == QLatin1Char(')')) {
executed: }
Execution Count:1446
evaluated: c == QLatin1Char(')')
TRUEFALSE
yes
Evaluation Count:1247
yes
Evaluation Count:4786
1247-4786
6221 input = InpCp;
executed (the execution status of this line is deduced): input = InpCp;
-
6222 } else if (c == QLatin1Char('#')) {
executed: }
Execution Count:1247
evaluated: c == QLatin1Char('#')
TRUEFALSE
yes
Evaluation Count:1247
yes
Evaluation Count:3539
1247-3539
6223 input = InpHash;
executed (the execution status of this line is deduced): input = InpHash;
-
6224 } else if (c == QLatin1Char('?')) {
executed: }
Execution Count:1247
evaluated: c == QLatin1Char('?')
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3536
3-3536
6225 input = InpQm;
executed (the execution status of this line is deduced): input = InpQm;
-
6226 } else if (c == QLatin1Char('*')) {
executed: }
Execution Count:3
evaluated: c == QLatin1Char('*')
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:3504
3-3504
6227 input = InpAst;
executed (the execution status of this line is deduced): input = InpAst;
-
6228 } else if (c == QLatin1Char('+')) {
executed: }
Execution Count:32
evaluated: c == QLatin1Char('+')
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3492
12-3492
6229 input = InpPlus;
executed (the execution status of this line is deduced): input = InpPlus;
-
6230 } else if (c == QLatin1Char('A')) {
executed: }
Execution Count:12
evaluated: c == QLatin1Char('A')
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:3462
12-3462
6231 input = InpA;
executed (the execution status of this line is deduced): input = InpA;
-
6232 } else if (c == QLatin1Char('E')) {
executed: }
Execution Count:30
evaluated: c == QLatin1Char('E')
TRUEFALSE
yes
Evaluation Count:101
yes
Evaluation Count:3361
30-3361
6233 input = InpE;
executed (the execution status of this line is deduced): input = InpE;
-
6234 } else if (c == QLatin1Char('L')) {
executed: }
Execution Count:101
evaluated: c == QLatin1Char('L')
TRUEFALSE
yes
Evaluation Count:1577
yes
Evaluation Count:1784
101-1784
6235 input = InpL;
executed (the execution status of this line is deduced): input = InpL;
-
6236 } else {
executed: }
Execution Count:1577
1577
6237 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
6238 }
executed: }
Execution Count:1784
1784
6239 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
6240 -
6241 switch (state) { -
6242 case Elem: -
6243 parseString_s = QLatin1String("LEMENT");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("LEMENT");
-
6244 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:1199
yes
Evaluation Count:378
378-1199
6245 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6246 return false;
executed: return false;
Execution Count:1199
1199
6247 } -
6248 break;
executed: break;
Execution Count:378
378
6249 case Ws1: -
6250 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:465
yes
Evaluation Count:1112
465-1112
6251 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6252 return false;
executed: return false;
Execution Count:465
465
6253 } -
6254 break;
executed: break;
Execution Count:1112
1112
6255 case Nam: -
6256 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
6257 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:961
yes
Evaluation Count:616
616-961
6258 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6259 return false;
executed: return false;
Execution Count:961
961
6260 } -
6261 break;
executed: break;
Execution Count:616
616
6262 case Ws2: -
6263 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:254
yes
Evaluation Count:1322
254-1322
6264 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6265 return false;
executed: return false;
Execution Count:254
254
6266 } -
6267 break;
executed: break;
Execution Count:1322
1322
6268 case Empty: -
6269 parseString_s = QLatin1String("EMPTY");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("EMPTY");
-
6270 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:36
36-65
6271 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6272 return false;
executed: return false;
Execution Count:65
65
6273 } -
6274 break;
executed: break;
Execution Count:36
36
6275 case Any: -
6276 parseString_s = QLatin1String("ANY");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("ANY");
-
6277 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:14
14-16
6278 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6279 return false;
executed: return false;
Execution Count:16
16
6280 } -
6281 break;
executed: break;
Execution Count:14
14
6282 case Cont: -
6283 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:513
yes
Evaluation Count:929
513-929
6284 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6285 return false;
executed: return false;
Execution Count:513
513
6286 } -
6287 break;
executed: break;
Execution Count:929
929
6288 case Mix: -
6289 parseString_s = QLatin1String("#PCDATA");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("#PCDATA");
-
6290 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:964
yes
Evaluation Count:283
283-964
6291 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6292 return false;
executed: return false;
Execution Count:964
964
6293 } -
6294 break;
executed: break;
Execution Count:283
283
6295 case Mix2: -
6296 if (!eat_ws()) {
partially evaluated: !eat_ws()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
6297 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6298 return false;
never executed: return false;
0
6299 } -
6300 break;
executed: break;
Execution Count:2
2
6301 case Mix3: -
6302 next();
executed (the execution status of this line is deduced): next();
-
6303 break;
executed: break;
Execution Count:1235
1235
6304 case MixN1: -
6305 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:7
5-7
6306 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6307 return false;
executed: return false;
Execution Count:5
5
6308 } -
6309 break;
executed: break;
Execution Count:7
7
6310 case MixN2: -
6311 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
6312 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:10
1-10
6313 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6314 return false;
executed: return false;
Execution Count:1
1
6315 } -
6316 break;
executed: break;
Execution Count:10
10
6317 case MixN3: -
6318 if (!eat_ws()) {
never evaluated: !eat_ws()
0
6319 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6320 return false;
never executed: return false;
0
6321 } -
6322 break;
never executed: break;
0
6323 case MixN4: -
6324 next();
executed (the execution status of this line is deduced): next();
-
6325 break;
executed: break;
Execution Count:10
10
6326 case Cp: -
6327 if (!parseChoiceSeq()) {
evaluated: !parseChoiceSeq()
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:103
92-103
6328 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6329 return false;
executed: return false;
Execution Count:92
92
6330 } -
6331 break;
executed: break;
Execution Count:103
103
6332 case Cp2: -
6333 next();
executed (the execution status of this line is deduced): next();
-
6334 break;
executed: break;
Execution Count:32
32
6335 case WsD: -
6336 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:12
1-12
6337 parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseElementDecl, state);
-
6338 return false;
executed: return false;
Execution Count:1
1
6339 } -
6340 break;
executed: break;
Execution Count:12
12
6341 case Done: -
6342 next();
executed (the execution status of this line is deduced): next();
-
6343 break;
executed: break;
Execution Count:1558
1558
6344 } -
6345 }
executed: }
Execution Count:7671
7671
6346 return false;
never executed: return false;
0
6347} -
6348 -
6349/* -
6350 Parse a NotationDecl [82]. -
6351 -
6352 Precondition: the beginning '<!' is already read and the head -
6353 stands on the 'N' of '<!NOTATION' -
6354*/ -
6355bool QXmlSimpleReaderPrivate::parseNotationDecl() -
6356{ -
6357 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
6358 const signed char Not = 1; // read NOTATION
executed (the execution status of this line is deduced): const signed char Not = 1;
-
6359 const signed char Ws1 = 2; // eat whitespaces
executed (the execution status of this line is deduced): const signed char Ws1 = 2;
-
6360 const signed char Nam = 3; // read Name
executed (the execution status of this line is deduced): const signed char Nam = 3;
-
6361 const signed char Ws2 = 4; // eat whitespaces
executed (the execution status of this line is deduced): const signed char Ws2 = 4;
-
6362 const signed char ExtID = 5; // parse ExternalID
executed (the execution status of this line is deduced): const signed char ExtID = 5;
-
6363 const signed char ExtIDR = 6; // same as ExtID, but already reported
executed (the execution status of this line is deduced): const signed char ExtIDR = 6;
-
6364 const signed char Ws3 = 7; // eat whitespaces
executed (the execution status of this line is deduced): const signed char Ws3 = 7;
-
6365 const signed char Done = 8;
executed (the execution status of this line is deduced): const signed char Done = 8;
-
6366 -
6367 const signed char InpWs = 0;
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
6368 const signed char InpGt = 1; // >
executed (the execution status of this line is deduced): const signed char InpGt = 1;
-
6369 const signed char InpN = 2; // N
executed (the execution status of this line is deduced): const signed char InpN = 2;
-
6370 const signed char InpUnknown = 3;
executed (the execution status of this line is deduced): const signed char InpUnknown = 3;
-
6371 -
6372 static const signed char table[8][4] = { -
6373 /* InpWs InpGt InpN InpUnknown */ -
6374 { -1, -1, Not, -1 }, // Init -
6375 { Ws1, -1, -1, -1 }, // Not -
6376 { -1, -1, Nam, Nam }, // Ws1 -
6377 { Ws2, Done, -1, -1 }, // Nam -
6378 { -1, Done, ExtID, ExtID }, // Ws2 -
6379 { Ws3, Done, -1, -1 }, // ExtID -
6380 { Ws3, Done, -1, -1 }, // ExtIDR -
6381 { -1, Done, -1, -1 } // Ws3 -
6382 }; -
6383 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
6384 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
6385 -
6386 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:536
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:491
11-536
6387 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
6388 } else {
executed: }
Execution Count:56
56
6389 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
6390#if defined(QT_QXML_DEBUG) -
6391 qDebug("QXmlSimpleReader: parseNotationDecl (cont) in state %d", state); -
6392#endif -
6393 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:472
yes
Evaluation Count:19
19-472
6394 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
6395 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:442
30-442
6396 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
6397#if defined(QT_QXML_DEBUG) -
6398 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
6399#endif -
6400 }
executed: }
Execution Count:30
30
6401 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:333
yes
Evaluation Count:139
139-333
6402 parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6403 return false;
executed: return false;
Execution Count:333
333
6404 } -
6405 }
executed: }
Execution Count:139
139
6406 }
executed: }
Execution Count:158
158
6407 -
6408 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
6409 switch (state) { -
6410 case ExtID: -
6411 // call the handler -
6412 if (dtdHnd) {
partially evaluated: dtdHnd
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
0-56
6413 if (!dtdHnd->notationDecl(name(), publicId, systemId)) {
partially evaluated: !dtdHnd->notationDecl(name(), publicId, systemId)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:56
0-56
6414 reportParseError(dtdHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(dtdHnd->errorString());
-
6415 return false;
never executed: return false;
0
6416 } -
6417 }
executed: }
Execution Count:56
56
6418 state = ExtIDR;
executed (the execution status of this line is deduced): state = ExtIDR;
-
6419 break;
executed: break;
Execution Count:56
56
6420 case Done: -
6421 return true;
executed: return true;
Execution Count:56
56
6422 case -1: -
6423 // Error -
6424 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
6425 return false;
never executed: return false;
0
6426 } -
6427 -
6428 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:336
19-336
6429 unexpectedEof(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6430 return false;
executed: return false;
Execution Count:19
19
6431 } -
6432 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:224
112-224
6433 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
6434 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:112
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:168
56-168
6435 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
6436 } else if (c == QLatin1Char('N')) {
executed: }
Execution Count:56
evaluated: c == QLatin1Char('N')
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:112
56-112
6437 input = InpN;
executed (the execution status of this line is deduced): input = InpN;
-
6438 } else {
executed: }
Execution Count:56
56
6439 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
6440 }
executed: }
Execution Count:112
112
6441 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
6442 -
6443 switch (state) { -
6444 case Not: -
6445 parseString_s = QLatin1String("NOTATION");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("NOTATION");
-
6446 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:13
13-43
6447 parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6448 return false;
executed: return false;
Execution Count:43
43
6449 } -
6450 break;
executed: break;
Execution Count:13
13
6451 case Ws1: -
6452 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:40
16-40
6453 parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6454 return false;
executed: return false;
Execution Count:16
16
6455 } -
6456 break;
executed: break;
Execution Count:40
40
6457 case Nam: -
6458 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
6459 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:35
21-35
6460 parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6461 return false;
executed: return false;
Execution Count:21
21
6462 } -
6463 break;
executed: break;
Execution Count:35
35
6464 case Ws2: -
6465 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:42
14-42
6466 parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6467 return false;
executed: return false;
Execution Count:14
14
6468 } -
6469 break;
executed: break;
Execution Count:42
42
6470 case ExtID: -
6471 case ExtIDR: -
6472 parseExternalID_allowPublicID = true;
executed (the execution status of this line is deduced): parseExternalID_allowPublicID = true;
-
6473 if (!parseExternalID()) {
evaluated: !parseExternalID()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:11
11-45
6474 parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6475 return false;
executed: return false;
Execution Count:45
45
6476 } -
6477 break;
executed: break;
Execution Count:11
11
6478 case Ws3: -
6479 if (!eat_ws()) {
never evaluated: !eat_ws()
0
6480 parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNotationDecl, state);
-
6481 return false;
never executed: return false;
0
6482 } -
6483 break;
never executed: break;
0
6484 case Done: -
6485 next();
executed (the execution status of this line is deduced): next();
-
6486 break;
executed: break;
Execution Count:56
56
6487 } -
6488 }
executed: }
Execution Count:197
197
6489 return false;
never executed: return false;
0
6490} -
6491 -
6492/* -
6493 Parse choice [49] or seq [50]. -
6494 -
6495 Precondition: the beginning '('S? is already read and the head -
6496 stands on the first non-whitespace character after it. -
6497*/ -
6498bool QXmlSimpleReaderPrivate::parseChoiceSeq() -
6499{ -
6500 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
6501 const signed char Ws1 = 1; // eat whitespace
executed (the execution status of this line is deduced): const signed char Ws1 = 1;
-
6502 const signed char CoS = 2; // choice or set
executed (the execution status of this line is deduced): const signed char CoS = 2;
-
6503 const signed char Ws2 = 3; // eat whitespace
executed (the execution status of this line is deduced): const signed char Ws2 = 3;
-
6504 const signed char More = 4; // more cp to read
executed (the execution status of this line is deduced): const signed char More = 4;
-
6505 const signed char Name = 5; // read name
executed (the execution status of this line is deduced): const signed char Name = 5;
-
6506 const signed char Done = 6; //
executed (the execution status of this line is deduced): const signed char Done = 6;
-
6507 -
6508 const signed char InpWs = 0; // S
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
6509 const signed char InpOp = 1; // (
executed (the execution status of this line is deduced): const signed char InpOp = 1;
-
6510 const signed char InpCp = 2; //)
executed (the execution status of this line is deduced): const signed char InpCp = 2;
-
6511 const signed char InpQm = 3; // ?
executed (the execution status of this line is deduced): const signed char InpQm = 3;
-
6512 const signed char InpAst = 4; // *
executed (the execution status of this line is deduced): const signed char InpAst = 4;
-
6513 const signed char InpPlus = 5; // +
executed (the execution status of this line is deduced): const signed char InpPlus = 5;
-
6514 const signed char InpPipe = 6; // |
executed (the execution status of this line is deduced): const signed char InpPipe = 6;
-
6515 const signed char InpComm = 7; // ,
executed (the execution status of this line is deduced): const signed char InpComm = 7;
-
6516 const signed char InpUnknown = 8;
executed (the execution status of this line is deduced): const signed char InpUnknown = 8;
-
6517 -
6518 static const signed char table[6][9] = { -
6519 /* InpWs InpOp InpCp InpQm InpAst InpPlus InpPipe InpComm InpUnknown */ -
6520 { -1, Ws1, -1, -1, -1, -1, -1, -1, Name }, // Init -
6521 { -1, CoS, -1, -1, -1, -1, -1, -1, CoS }, // Ws1 -
6522 { Ws2, -1, Done, Ws2, Ws2, Ws2, More, More, -1 }, // CS -
6523 { -1, -1, Done, -1, -1, -1, More, More, -1 }, // Ws2 -
6524 { -1, Ws1, -1, -1, -1, -1, -1, -1, Name }, // More (same as Init) -
6525 { Ws2, -1, Done, Ws2, Ws2, Ws2, More, More, -1 } // Name (same as CS) -
6526 }; -
6527 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
6528 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
6529 -
6530 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:294
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:162
yes
Evaluation Count:132
39-294
6531 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
6532 } else {
executed: }
Execution Count:201
201
6533 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
6534#if defined(QT_QXML_DEBUG) -
6535 qDebug("QXmlSimpleReader: parseChoiceSeq (cont) in state %d", state); -
6536#endif -
6537 if (!parseStack->isEmpty()) {
partially evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:132
no
Evaluation Count:0
0-132
6538 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
6539 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:73
59-73
6540 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
6541#if defined(QT_QXML_DEBUG) -
6542 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
6543#endif -
6544 }
executed: }
Execution Count:59
59
6545 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:118
14-118
6546 parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
-
6547 return false;
executed: return false;
Execution Count:14
14
6548 } -
6549 }
executed: }
Execution Count:118
118
6550 }
executed: }
Execution Count:118
118
6551 -
6552 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
6553 switch (state) { -
6554 case Done: -
6555 return true;
executed: return true;
Execution Count:193
193
6556 case -1: -
6557 // Error -
6558 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
6559 return false;
executed: return false;
Execution Count:4
4
6560 } -
6561 -
6562 if (atEnd()) {
partially evaluated: atEnd()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:621
0-621
6563 unexpectedEof(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
never executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
-
6564 return false;
never executed: return false;
0
6565 } -
6566 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:597
24-597
6567 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
6568 } else if (c == QLatin1Char('(')) {
executed: }
Execution Count:24
evaluated: c == QLatin1Char('(')
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:591
6-591
6569 input = InpOp;
executed (the execution status of this line is deduced): input = InpOp;
-
6570 } else if (c == QLatin1Char(')')) {
executed: }
Execution Count:6
evaluated: c == QLatin1Char(')')
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:397
6-397
6571 input = InpCp;
executed (the execution status of this line is deduced): input = InpCp;
-
6572 } else if (c == QLatin1Char('?')) {
executed: }
Execution Count:194
evaluated: c == QLatin1Char('?')
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:383
14-383
6573 input = InpQm;
executed (the execution status of this line is deduced): input = InpQm;
-
6574 } else if (c == QLatin1Char('*')) {
executed: }
Execution Count:14
evaluated: c == QLatin1Char('*')
TRUEFALSE
yes
Evaluation Count:82
yes
Evaluation Count:301
14-301
6575 input = InpAst;
executed (the execution status of this line is deduced): input = InpAst;
-
6576 } else if (c == QLatin1Char('+')) {
executed: }
Execution Count:82
evaluated: c == QLatin1Char('+')
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:299
2-299
6577 input = InpPlus;
executed (the execution status of this line is deduced): input = InpPlus;
-
6578 } else if (c == QLatin1Char('|')) {
executed: }
Execution Count:2
evaluated: c == QLatin1Char('|')
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:276
2-276
6579 input = InpPipe;
executed (the execution status of this line is deduced): input = InpPipe;
-
6580 } else if (c == QLatin1Char(',')) {
executed: }
Execution Count:23
evaluated: c == QLatin1Char(',')
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:250
23-250
6581 input = InpComm;
executed (the execution status of this line is deduced): input = InpComm;
-
6582 } else {
executed: }
Execution Count:26
26
6583 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
6584 }
executed: }
Execution Count:250
250
6585 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
6586 -
6587 switch (state) { -
6588 case Ws1: -
6589 if (!next_eat_ws()) {
partially evaluated: !next_eat_ws()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
6590 parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
-
6591 return false;
never executed: return false;
0
6592 } -
6593 break;
executed: break;
Execution Count:6
6
6594 case CoS: -
6595 if (!parseChoiceSeq()) {
evaluated: !parseChoiceSeq()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
6596 parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
-
6597 return false;
executed: return false;
Execution Count:1
1
6598 } -
6599 break;
executed: break;
Execution Count:5
5
6600 case Ws2: -
6601 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:82
38-82
6602 parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
-
6603 return false;
executed: return false;
Execution Count:38
38
6604 } -
6605 break;
executed: break;
Execution Count:82
82
6606 case More: -
6607 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:32
17-32
6608 parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
-
6609 return false;
executed: return false;
Execution Count:17
17
6610 } -
6611 break;
executed: break;
Execution Count:32
32
6612 case Name: -
6613 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
6614 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:177
66-177
6615 parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseChoiceSeq, state);
-
6616 return false;
executed: return false;
Execution Count:66
66
6617 } -
6618 break;
executed: break;
Execution Count:177
177
6619 case Done: -
6620 next();
executed (the execution status of this line is deduced): next();
-
6621 break;
executed: break;
Execution Count:193
193
6622 } -
6623 }
executed: }
Execution Count:499
499
6624 return false;
never executed: return false;
0
6625} -
6626 -
6627/* -
6628 Parse a EntityDecl [70]. -
6629 -
6630 Precondition: the beginning '<!E' is already read and the head -
6631 stand on the 'N' of '<!ENTITY' -
6632*/ -
6633bool QXmlSimpleReaderPrivate::parseEntityDecl() -
6634{ -
6635 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
6636 const signed char Ent = 1; // parse "ENTITY"
executed (the execution status of this line is deduced): const signed char Ent = 1;
-
6637 const signed char Ws1 = 2; // white space read
executed (the execution status of this line is deduced): const signed char Ws1 = 2;
-
6638 const signed char Name = 3; // parse name
executed (the execution status of this line is deduced): const signed char Name = 3;
-
6639 const signed char Ws2 = 4; // white space read
executed (the execution status of this line is deduced): const signed char Ws2 = 4;
-
6640 const signed char EValue = 5; // parse entity value
executed (the execution status of this line is deduced): const signed char EValue = 5;
-
6641 const signed char EValueR = 6; // same as EValue, but already reported
executed (the execution status of this line is deduced): const signed char EValueR = 6;
-
6642 const signed char ExtID = 7; // parse ExternalID
executed (the execution status of this line is deduced): const signed char ExtID = 7;
-
6643 const signed char Ws3 = 8; // white space read
executed (the execution status of this line is deduced): const signed char Ws3 = 8;
-
6644 const signed char Ndata = 9; // parse "NDATA"
executed (the execution status of this line is deduced): const signed char Ndata = 9;
-
6645 const signed char Ws4 = 10; // white space read
executed (the execution status of this line is deduced): const signed char Ws4 = 10;
-
6646 const signed char NNam = 11; // parse name
executed (the execution status of this line is deduced): const signed char NNam = 11;
-
6647 const signed char NNamR = 12; // same as NNam, but already reported
executed (the execution status of this line is deduced): const signed char NNamR = 12;
-
6648 const signed char PEDec = 13; // parse PEDecl
executed (the execution status of this line is deduced): const signed char PEDec = 13;
-
6649 const signed char Ws6 = 14; // white space read
executed (the execution status of this line is deduced): const signed char Ws6 = 14;
-
6650 const signed char PENam = 15; // parse name
executed (the execution status of this line is deduced): const signed char PENam = 15;
-
6651 const signed char Ws7 = 16; // white space read
executed (the execution status of this line is deduced): const signed char Ws7 = 16;
-
6652 const signed char PEVal = 17; // parse entity value
executed (the execution status of this line is deduced): const signed char PEVal = 17;
-
6653 const signed char PEValR = 18; // same as PEVal, but already reported
executed (the execution status of this line is deduced): const signed char PEValR = 18;
-
6654 const signed char PEEID = 19; // parse ExternalID
executed (the execution status of this line is deduced): const signed char PEEID = 19;
-
6655 const signed char PEEIDR = 20; // same as PEEID, but already reported
executed (the execution status of this line is deduced): const signed char PEEIDR = 20;
-
6656 const signed char WsE = 21; // white space read
executed (the execution status of this line is deduced): const signed char WsE = 21;
-
6657 const signed char Done = 22;
executed (the execution status of this line is deduced): const signed char Done = 22;
-
6658 const signed char EDDone = 23; // done, but also report an external, unparsed entity decl
executed (the execution status of this line is deduced): const signed char EDDone = 23;
-
6659 -
6660 const signed char InpWs = 0; // white space
executed (the execution status of this line is deduced): const signed char InpWs = 0;
-
6661 const signed char InpPer = 1; // %
executed (the execution status of this line is deduced): const signed char InpPer = 1;
-
6662 const signed char InpQuot = 2; // " or '
executed (the execution status of this line is deduced): const signed char InpQuot = 2;
-
6663 const signed char InpGt = 3; // >
executed (the execution status of this line is deduced): const signed char InpGt = 3;
-
6664 const signed char InpN = 4; // N
executed (the execution status of this line is deduced): const signed char InpN = 4;
-
6665 const signed char InpUnknown = 5;
executed (the execution status of this line is deduced): const signed char InpUnknown = 5;
-
6666 -
6667 static const signed char table[22][6] = { -
6668 /* InpWs InpPer InpQuot InpGt InpN InpUnknown */ -
6669 { -1, -1, -1, -1, Ent, -1 }, // Init -
6670 { Ws1, -1, -1, -1, -1, -1 }, // Ent -
6671 { -1, PEDec, -1, -1, Name, Name }, // Ws1 -
6672 { Ws2, -1, -1, -1, -1, -1 }, // Name -
6673 { -1, -1, EValue, -1, -1, ExtID }, // Ws2 -
6674 { WsE, -1, -1, Done, -1, -1 }, // EValue -
6675 { WsE, -1, -1, Done, -1, -1 }, // EValueR -
6676 { Ws3, -1, -1, EDDone,-1, -1 }, // ExtID -
6677 { -1, -1, -1, EDDone,Ndata, -1 }, // Ws3 -
6678 { Ws4, -1, -1, -1, -1, -1 }, // Ndata -
6679 { -1, -1, -1, -1, NNam, NNam }, // Ws4 -
6680 { WsE, -1, -1, Done, -1, -1 }, // NNam -
6681 { WsE, -1, -1, Done, -1, -1 }, // NNamR -
6682 { Ws6, -1, -1, -1, -1, -1 }, // PEDec -
6683 { -1, -1, -1, -1, PENam, PENam }, // Ws6 -
6684 { Ws7, -1, -1, -1, -1, -1 }, // PENam -
6685 { -1, -1, PEVal, -1, -1, PEEID }, // Ws7 -
6686 { WsE, -1, -1, Done, -1, -1 }, // PEVal -
6687 { WsE, -1, -1, Done, -1, -1 }, // PEValR -
6688 { WsE, -1, -1, Done, -1, -1 }, // PEEID -
6689 { WsE, -1, -1, Done, -1, -1 }, // PEEIDR -
6690 { -1, -1, -1, Done, -1, -1 } // WsE -
6691 }; -
6692 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
6693 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
6694 -
6695 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:371
yes
Evaluation Count:3893
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:522
yes
Evaluation Count:3371
371-3893
6696 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
6697 } else {
executed: }
Execution Count:893
893
6698 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
6699#if defined(QT_QXML_DEBUG) -
6700 qDebug("QXmlSimpleReader: parseEntityDecl (cont) in state %d", state); -
6701#endif -
6702 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:3026
yes
Evaluation Count:345
345-3026
6703 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
6704 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:431
yes
Evaluation Count:2595
431-2595
6705 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
6706#if defined(QT_QXML_DEBUG) -
6707 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
6708#endif -
6709 }
executed: }
Execution Count:431
431
6710 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:1549
yes
Evaluation Count:1477
1477-1549
6711 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6712 return false;
executed: return false;
Execution Count:1549
1549
6713 } -
6714 }
executed: }
Execution Count:1477
1477
6715 }
executed: }
Execution Count:1822
1822
6716 -
6717 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
6718 switch (state) { -
6719 case EValue: -
6720 if ( !entityExist(name())) {
evaluated: !entityExist(name())
TRUEFALSE
yes
Evaluation Count:530
yes
Evaluation Count:36
36-530
6721 entities.insert(name(), string());
executed (the execution status of this line is deduced): entities.insert(name(), string());
-
6722 if (declHnd) {
partially evaluated: declHnd
TRUEFALSE
yes
Evaluation Count:530
no
Evaluation Count:0
0-530
6723 if (!declHnd->internalEntityDecl(name(), string())) {
partially evaluated: !declHnd->internalEntityDecl(name(), string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:530
0-530
6724 reportParseError(declHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(declHnd->errorString());
-
6725 return false;
never executed: return false;
0
6726 } -
6727 }
executed: }
Execution Count:530
530
6728 }
executed: }
Execution Count:530
530
6729 state = EValueR;
executed (the execution status of this line is deduced): state = EValueR;
-
6730 break;
executed: break;
Execution Count:566
566
6731 case NNam: -
6732 if ( !entityExist(name())) {
partially evaluated: !entityExist(name())
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
6733 externEntities.insert(name(), QXmlSimpleReaderPrivate::ExternEntity(publicId, systemId, ref()));
executed (the execution status of this line is deduced): externEntities.insert(name(), QXmlSimpleReaderPrivate::ExternEntity(publicId, systemId, ref()));
-
6734 if (dtdHnd) {
partially evaluated: dtdHnd
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
6735 if (!dtdHnd->unparsedEntityDecl(name(), publicId, systemId, ref())) {
partially evaluated: !dtdHnd->unparsedEntityDecl(name(), publicId, systemId, ref())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
6736 reportParseError(declHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(declHnd->errorString());
-
6737 return false;
never executed: return false;
0
6738 } -
6739 }
executed: }
Execution Count:13
13
6740 }
executed: }
Execution Count:13
13
6741 state = NNamR;
executed (the execution status of this line is deduced): state = NNamR;
-
6742 break;
executed: break;
Execution Count:13
13
6743 case PEVal: -
6744 if ( !entityExist(name())) {
partially evaluated: !entityExist(name())
TRUEFALSE
yes
Evaluation Count:67
no
Evaluation Count:0
0-67
6745 parameterEntities.insert(name(), string());
executed (the execution status of this line is deduced): parameterEntities.insert(name(), string());
-
6746 if (declHnd) {
partially evaluated: declHnd
TRUEFALSE
yes
Evaluation Count:67
no
Evaluation Count:0
0-67
6747 if (!declHnd->internalEntityDecl(QLatin1Char('%') + name(), string())) {
partially evaluated: !declHnd->internalEntityDecl(QLatin1Char('%') + name(), string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:67
0-67
6748 reportParseError(declHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(declHnd->errorString());
-
6749 return false;
never executed: return false;
0
6750 } -
6751 }
executed: }
Execution Count:67
67
6752 }
executed: }
Execution Count:67
67
6753 state = PEValR;
executed (the execution status of this line is deduced): state = PEValR;
-
6754 break;
executed: break;
Execution Count:67
67
6755 case PEEID: -
6756 if ( !entityExist(name())) {
partially evaluated: !entityExist(name())
TRUEFALSE
yes
Evaluation Count:62
no
Evaluation Count:0
0-62
6757 externParameterEntities.insert(name(), QXmlSimpleReaderPrivate::ExternParameterEntity(publicId, systemId));
executed (the execution status of this line is deduced): externParameterEntities.insert(name(), QXmlSimpleReaderPrivate::ExternParameterEntity(publicId, systemId));
-
6758 if (declHnd) {
partially evaluated: declHnd
TRUEFALSE
yes
Evaluation Count:62
no
Evaluation Count:0
0-62
6759 if (!declHnd->externalEntityDecl(QLatin1Char('%') + name(), publicId, systemId)) {
partially evaluated: !declHnd->externalEntityDecl(QLatin1Char('%') + name(), publicId, systemId)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:62
0-62
6760 reportParseError(declHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(declHnd->errorString());
-
6761 return false;
never executed: return false;
0
6762 } -
6763 }
executed: }
Execution Count:62
62
6764 }
executed: }
Execution Count:62
62
6765 state = PEEIDR;
executed (the execution status of this line is deduced): state = PEEIDR;
-
6766 break;
executed: break;
Execution Count:62
62
6767 case EDDone: -
6768 if ( !entityExist(name())) {
partially evaluated: !entityExist(name())
TRUEFALSE
yes
Evaluation Count:175
no
Evaluation Count:0
0-175
6769 externEntities.insert(name(), QXmlSimpleReaderPrivate::ExternEntity(publicId, systemId, QString()));
executed (the execution status of this line is deduced): externEntities.insert(name(), QXmlSimpleReaderPrivate::ExternEntity(publicId, systemId, QString()));
-
6770 if (declHnd) {
evaluated: declHnd
TRUEFALSE
yes
Evaluation Count:156
yes
Evaluation Count:19
19-156
6771 if (!declHnd->externalEntityDecl(name(), publicId, systemId)) {
partially evaluated: !declHnd->externalEntityDecl(name(), publicId, systemId)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:156
0-156
6772 reportParseError(declHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(declHnd->errorString());
-
6773 return false;
never executed: return false;
0
6774 } -
6775 }
executed: }
Execution Count:156
156
6776 }
executed: }
Execution Count:175
175
6777 return true;
executed: return true;
Execution Count:175
175
6778 case Done: -
6779 return true;
executed: return true;
Execution Count:705
705
6780 case -1: -
6781 // Error -
6782 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
6783 return false;
executed: return false;
Execution Count:6
6
6784 } -
6785 -
6786 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:345
yes
Evaluation Count:5658
345-5658
6787 unexpectedEof(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6788 return false;
executed: return false;
Execution Count:345
345
6789 } -
6790 if (is_S(c)) {
evaluated: is_S(c)
TRUEFALSE
yes
Evaluation Count:1941
yes
Evaluation Count:3717
1941-3717
6791 input = InpWs;
executed (the execution status of this line is deduced): input = InpWs;
-
6792 } else if (c == QLatin1Char('%')) {
executed: }
Execution Count:1941
evaluated: c == QLatin1Char('%')
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:3586
131-3586
6793 input = InpPer;
executed (the execution status of this line is deduced): input = InpPer;
-
6794 } else if (c == QLatin1Char('"') || c == QLatin1Char('\'')) {
executed: }
Execution Count:131
evaluated: c == QLatin1Char('"')
TRUEFALSE
yes
Evaluation Count:611
yes
Evaluation Count:2975
evaluated: c == QLatin1Char('\'')
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:2948
27-2975
6795 input = InpQuot;
executed (the execution status of this line is deduced): input = InpQuot;
-
6796 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:638
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:880
yes
Evaluation Count:2068
638-2068
6797 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
6798 } else if (c == QLatin1Char('N')) {
executed: }
Execution Count:880
evaluated: c == QLatin1Char('N')
TRUEFALSE
yes
Evaluation Count:909
yes
Evaluation Count:1159
880-1159
6799 input = InpN;
executed (the execution status of this line is deduced): input = InpN;
-
6800 } else {
executed: }
Execution Count:909
909
6801 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
6802 }
executed: }
Execution Count:1159
1159
6803 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
6804 -
6805 switch (state) { -
6806 case Ent: -
6807 parseString_s = QLatin1String("NTITY");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("NTITY");
-
6808 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:427
yes
Evaluation Count:466
427-466
6809 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6810 return false;
executed: return false;
Execution Count:427
427
6811 } -
6812 break;
executed: break;
Execution Count:466
466
6813 case Ws1: -
6814 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:162
yes
Evaluation Count:730
162-730
6815 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6816 return false;
executed: return false;
Execution Count:162
162
6817 } -
6818 break;
executed: break;
Execution Count:730
730
6819 case Name: -
6820 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
6821 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:145
yes
Evaluation Count:617
145-617
6822 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6823 return false;
executed: return false;
Execution Count:145
145
6824 } -
6825 break;
executed: break;
Execution Count:617
617
6826 case Ws2: -
6827 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:596
164-596
6828 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6829 return false;
executed: return false;
Execution Count:164
164
6830 } -
6831 break;
executed: break;
Execution Count:596
596
6832 case EValue: -
6833 case EValueR: -
6834 if (!parseEntityValue()) {
evaluated: !parseEntityValue()
TRUEFALSE
yes
Evaluation Count:207
yes
Evaluation Count:362
207-362
6835 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6836 return false;
executed: return false;
Execution Count:207
207
6837 } -
6838 break;
executed: break;
Execution Count:362
362
6839 case ExtID: -
6840 parseExternalID_allowPublicID = false;
executed (the execution status of this line is deduced): parseExternalID_allowPublicID = false;
-
6841 if (!parseExternalID()) {
evaluated: !parseExternalID()
TRUEFALSE
yes
Evaluation Count:146
yes
Evaluation Count:45
45-146
6842 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6843 return false;
executed: return false;
Execution Count:146
146
6844 } -
6845 break;
executed: break;
Execution Count:45
45
6846 case Ws3: -
6847 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
3-10
6848 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6849 return false;
executed: return false;
Execution Count:3
3
6850 } -
6851 break;
executed: break;
Execution Count:10
10
6852 case Ndata: -
6853 parseString_s = QLatin1String("NDATA");
executed (the execution status of this line is deduced): parseString_s = QLatin1String("NDATA");
-
6854 if (!parseString()) {
evaluated: !parseString()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:7
6-7
6855 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6856 return false;
executed: return false;
Execution Count:6
6
6857 } -
6858 break;
executed: break;
Execution Count:7
7
6859 case Ws4: -
6860 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-9
6861 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6862 return false;
executed: return false;
Execution Count:4
4
6863 } -
6864 break;
executed: break;
Execution Count:9
9
6865 case NNam: -
6866 case NNamR: -
6867 parseName_useRef = true;
executed (the execution status of this line is deduced): parseName_useRef = true;
-
6868 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
2-11
6869 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6870 return false;
executed: return false;
Execution Count:2
2
6871 } -
6872 break;
executed: break;
Execution Count:11
11
6873 case PEDec: -
6874 next();
executed (the execution status of this line is deduced): next();
-
6875 break;
executed: break;
Execution Count:130
130
6876 case Ws6: -
6877 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:78
52-78
6878 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6879 return false;
executed: return false;
Execution Count:52
52
6880 } -
6881 break;
executed: break;
Execution Count:78
78
6882 case PENam: -
6883 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
6884 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:112
18-112
6885 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6886 return false;
executed: return false;
Execution Count:18
18
6887 } -
6888 break;
executed: break;
Execution Count:112
112
6889 case Ws7: -
6890 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:84
46-84
6891 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6892 return false;
executed: return false;
Execution Count:46
46
6893 } -
6894 break;
executed: break;
Execution Count:84
84
6895 case PEVal: -
6896 case PEValR: -
6897 if (!parseEntityValue()) {
evaluated: !parseEntityValue()
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:20
20-48
6898 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6899 return false;
executed: return false;
Execution Count:48
48
6900 } -
6901 break;
executed: break;
Execution Count:20
20
6902 case PEEID: -
6903 case PEEIDR: -
6904 parseExternalID_allowPublicID = false;
executed (the execution status of this line is deduced): parseExternalID_allowPublicID = false;
-
6905 if (!parseExternalID()) {
evaluated: !parseExternalID()
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:8
8-54
6906 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6907 return false;
executed: return false;
Execution Count:54
54
6908 } -
6909 break;
executed: break;
Execution Count:8
8
6910 case WsE: -
6911 if (!eat_ws()) {
partially evaluated: !eat_ws()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
6912 parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityDecl, state);
-
6913 return false;
never executed: return false;
0
6914 } -
6915 break;
executed: break;
Execution Count:3
3
6916 case EDDone: -
6917 next();
executed (the execution status of this line is deduced): next();
-
6918 break;
executed: break;
Execution Count:175
175
6919 case Done: -
6920 next();
executed (the execution status of this line is deduced): next();
-
6921 break;
executed: break;
Execution Count:705
705
6922 } -
6923 }
executed: }
Execution Count:4174
4174
6924 return false;
never executed: return false;
0
6925} -
6926 -
6927/* -
6928 Parse a EntityValue [9] -
6929*/ -
6930bool QXmlSimpleReaderPrivate::parseEntityValue() -
6931{ -
6932 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
6933 const signed char Dq = 1; // EntityValue is double quoted
executed (the execution status of this line is deduced): const signed char Dq = 1;
-
6934 const signed char DqC = 2; // signed character
executed (the execution status of this line is deduced): const signed char DqC = 2;
-
6935 const signed char DqPER = 3; // PERefence
executed (the execution status of this line is deduced): const signed char DqPER = 3;
-
6936 const signed char DqRef = 4; // Reference
executed (the execution status of this line is deduced): const signed char DqRef = 4;
-
6937 const signed char Sq = 5; // EntityValue is double quoted
executed (the execution status of this line is deduced): const signed char Sq = 5;
-
6938 const signed char SqC = 6; // signed character
executed (the execution status of this line is deduced): const signed char SqC = 6;
-
6939 const signed char SqPER = 7; // PERefence
executed (the execution status of this line is deduced): const signed char SqPER = 7;
-
6940 const signed char SqRef = 8; // Reference
executed (the execution status of this line is deduced): const signed char SqRef = 8;
-
6941 const signed char Done = 9;
executed (the execution status of this line is deduced): const signed char Done = 9;
-
6942 -
6943 const signed char InpDq = 0; // "
executed (the execution status of this line is deduced): const signed char InpDq = 0;
-
6944 const signed char InpSq = 1; // '
executed (the execution status of this line is deduced): const signed char InpSq = 1;
-
6945 const signed char InpAmp = 2; // &
executed (the execution status of this line is deduced): const signed char InpAmp = 2;
-
6946 const signed char InpPer = 3; // %
executed (the execution status of this line is deduced): const signed char InpPer = 3;
-
6947 const signed char InpUnknown = 4;
executed (the execution status of this line is deduced): const signed char InpUnknown = 4;
-
6948 -
6949 static const signed char table[9][5] = { -
6950 /* InpDq InpSq InpAmp InpPer InpUnknown */ -
6951 { Dq, Sq, -1, -1, -1 }, // Init -
6952 { Done, DqC, DqRef, DqPER, DqC }, // Dq -
6953 { Done, DqC, DqRef, DqPER, DqC }, // DqC -
6954 { Done, DqC, DqRef, DqPER, DqC }, // DqPER -
6955 { Done, DqC, DqRef, DqPER, DqC }, // DqRef -
6956 { SqC, Done, SqRef, SqPER, SqC }, // Sq -
6957 { SqC, Done, SqRef, SqPER, SqC }, // SqC -
6958 { SqC, Done, SqRef, SqPER, SqC }, // SqPER -
6959 { SqC, Done, SqRef, SqPER, SqC } // SqRef -
6960 }; -
6961 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
6962 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
6963 -
6964 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:313
yes
Evaluation Count:957
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:324
yes
Evaluation Count:633
313-957
6965 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
6966 } else {
executed: }
Execution Count:637
637
6967 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
6968#if defined(QT_QXML_DEBUG) -
6969 qDebug("QXmlSimpleReader: parseEntityValue (cont) in state %d", state); -
6970#endif -
6971 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:172
yes
Evaluation Count:461
172-461
6972 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
6973 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
partially evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:172
0-172
6974 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
6975#if defined(QT_QXML_DEBUG) -
6976 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
6977#endif -
6978 }
never executed: }
0
6979 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:112
60-112
6980 parseFailed(&QXmlSimpleReaderPrivate::parseEntityValue, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityValue, state);
-
6981 return false;
executed: return false;
Execution Count:60
60
6982 } -
6983 }
executed: }
Execution Count:112
112
6984 }
executed: }
Execution Count:573
573
6985 -
6986 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
6987 switch (state) { -
6988 case Done: -
6989 return true;
executed: return true;
Execution Count:633
633
6990 case -1: -
6991 // Error -
6992 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
6993 return false;
never executed: return false;
0
6994 } -
6995 -
6996 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:462
yes
Evaluation Count:4201
462-4201
6997 unexpectedEof(&QXmlSimpleReaderPrivate::parseEntityValue, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseEntityValue, state);
-
6998 return false;
executed: return false;
Execution Count:462
462
6999 } -
7000 if (c == QLatin1Char('"')) {
evaluated: c == QLatin1Char('"')
TRUEFALSE
yes
Evaluation Count:1217
yes
Evaluation Count:2984
1217-2984
7001 input = InpDq;
executed (the execution status of this line is deduced): input = InpDq;
-
7002 } else if (c == QLatin1Char('\'')) {
executed: }
Execution Count:1217
evaluated: c == QLatin1Char('\'')
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:2914
70-2914
7003 input = InpSq;
executed (the execution status of this line is deduced): input = InpSq;
-
7004 } else if (c == QLatin1Char('&')) {
executed: }
Execution Count:70
evaluated: c == QLatin1Char('&')
TRUEFALSE
yes
Evaluation Count:222
yes
Evaluation Count:2692
70-2692
7005 input = InpAmp;
executed (the execution status of this line is deduced): input = InpAmp;
-
7006 } else if (c == QLatin1Char('%')) {
executed: }
Execution Count:222
evaluated: c == QLatin1Char('%')
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2690
2-2690
7007 input = InpPer;
executed (the execution status of this line is deduced): input = InpPer;
-
7008 } else {
executed: }
Execution Count:2
2
7009 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
7010 }
executed: }
Execution Count:2690
2690
7011 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
7012 -
7013 switch (state) { -
7014 case Dq: -
7015 case Sq: -
7016 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
7017 next();
executed (the execution status of this line is deduced): next();
-
7018 break;
executed: break;
Execution Count:637
637
7019 case DqC: -
7020 case SqC: -
7021 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
7022 next();
executed (the execution status of this line is deduced): next();
-
7023 break;
executed: break;
Execution Count:2707
2707
7024 case DqPER: -
7025 case SqPER: -
7026 parsePEReference_context = InEntityValue;
executed (the execution status of this line is deduced): parsePEReference_context = InEntityValue;
-
7027 if (!parsePEReference()) {
partially evaluated: !parsePEReference()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
7028 parseFailed(&QXmlSimpleReaderPrivate::parseEntityValue, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityValue, state);
-
7029 return false;
never executed: return false;
0
7030 } -
7031 break;
executed: break;
Execution Count:2
2
7032 case DqRef: -
7033 case SqRef: -
7034 parseReference_context = InEntityValue;
executed (the execution status of this line is deduced): parseReference_context = InEntityValue;
-
7035 if (!parseReference()) {
evaluated: !parseReference()
TRUEFALSE
yes
Evaluation Count:115
yes
Evaluation Count:107
107-115
7036 parseFailed(&QXmlSimpleReaderPrivate::parseEntityValue, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseEntityValue, state);
-
7037 return false;
executed: return false;
Execution Count:115
115
7038 } -
7039 break;
executed: break;
Execution Count:107
107
7040 case Done: -
7041 next();
executed (the execution status of this line is deduced): next();
-
7042 break;
executed: break;
Execution Count:633
633
7043 } -
7044 }
executed: }
Execution Count:4086
4086
7045 return false;
never executed: return false;
0
7046} -
7047 -
7048/* -
7049 Parse a comment [15]. -
7050 -
7051 Precondition: the beginning '<!' of the comment is already read and the head -
7052 stands on the first '-' of '<!--'. -
7053 -
7054 If this funktion was successful, the head-position is on the first -
7055 character after the comment. -
7056*/ -
7057bool QXmlSimpleReaderPrivate::parseComment() -
7058{ -
7059 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
7060 const signed char Dash1 = 1; // the first dash was read
executed (the execution status of this line is deduced): const signed char Dash1 = 1;
-
7061 const signed char Dash2 = 2; // the second dash was read
executed (the execution status of this line is deduced): const signed char Dash2 = 2;
-
7062 const signed char Com = 3; // read comment
executed (the execution status of this line is deduced): const signed char Com = 3;
-
7063 const signed char Com2 = 4; // read comment (help state)
executed (the execution status of this line is deduced): const signed char Com2 = 4;
-
7064 const signed char ComE = 5; // finished reading comment
executed (the execution status of this line is deduced): const signed char ComE = 5;
-
7065 const signed char Done = 6;
executed (the execution status of this line is deduced): const signed char Done = 6;
-
7066 -
7067 const signed char InpDash = 0; // -
executed (the execution status of this line is deduced): const signed char InpDash = 0;
-
7068 const signed char InpGt = 1; // >
executed (the execution status of this line is deduced): const signed char InpGt = 1;
-
7069 const signed char InpUnknown = 2;
executed (the execution status of this line is deduced): const signed char InpUnknown = 2;
-
7070 -
7071 static const signed char table[6][3] = { -
7072 /* InpDash InpGt InpUnknown */ -
7073 { Dash1, -1, -1 }, // Init -
7074 { Dash2, -1, -1 }, // Dash1 -
7075 { Com2, Com, Com }, // Dash2 -
7076 { Com2, Com, Com }, // Com -
7077 { ComE, Com, Com }, // Com2 -
7078 { -1, Done, -1 } // ComE -
7079 }; -
7080 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
7081 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
7082 -
7083 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:2028
yes
Evaluation Count:527
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:464
63-2028
7084 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
7085 } else {
executed: }
Execution Count:2091
2091
7086 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
7087#if defined(QT_QXML_DEBUG) -
7088 qDebug("QXmlSimpleReader: parseComment (cont) in state %d", state); -
7089#endif -
7090 if (!parseStack->isEmpty()) {
partially evaluated: !parseStack->isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:464
0-464
7091 ParseFunction function = parseStack->top().function;
never executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
7092 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
never evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
0
7093 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
7094#if defined(QT_QXML_DEBUG) -
7095 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
7096#endif -
7097 }
never executed: }
0
7098 if (!(this->*function)()) {
never evaluated: !(this->*function)()
0
7099 parseFailed(&QXmlSimpleReaderPrivate::parseComment, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseComment, state);
-
7100 return false;
never executed: return false;
0
7101 } -
7102 }
never executed: }
0
7103 }
executed: }
Execution Count:464
464
7104 -
7105 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
7106 switch (state) { -
7107 case Dash2: -
7108 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
7109 break;
executed: break;
Execution Count:2116
2116
7110 case Com2: -
7111 // if next character is not a dash than don't skip it -
7112 if (!atEnd() && c != QLatin1Char('-'))
evaluated: !atEnd()
TRUEFALSE
yes
Evaluation Count:6381
yes
Evaluation Count:30
evaluated: c != QLatin1Char('-')
TRUEFALSE
yes
Evaluation Count:4292
yes
Evaluation Count:2089
30-6381
7113 stringAddC(QLatin1Char('-'));
executed: stringAddC(QLatin1Char('-'));
Execution Count:4292
4292
7114 break;
executed: break;
Execution Count:6411
6411
7115 case Done: -
7116 return true;
executed: return true;
Execution Count:2087
2087
7117 case -1: -
7118 // Error -
7119 reportParseError(QLatin1String(XMLERR_ERRORPARSINGCOMMENT));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing comment"));
-
7120 return false;
executed: return false;
Execution Count:3
3
7121 } -
7122 -
7123 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:465
yes
Evaluation Count:465511
465-465511
7124 unexpectedEof(&QXmlSimpleReaderPrivate::parseComment, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseComment, state);
-
7125 return false;
executed: return false;
Execution Count:465
465
7126 } -
7127 if (c == QLatin1Char('-')) {
evaluated: c == QLatin1Char('-')
TRUEFALSE
yes
Evaluation Count:12651
yes
Evaluation Count:452860
12651-452860
7128 input = InpDash;
executed (the execution status of this line is deduced): input = InpDash;
-
7129 } else if (c == QLatin1Char('>')) {
executed: }
Execution Count:12651
evaluated: c == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:13527
yes
Evaluation Count:439333
12651-439333
7130 input = InpGt;
executed (the execution status of this line is deduced): input = InpGt;
-
7131 } else {
executed: }
Execution Count:13527
13527
7132 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
7133 }
executed: }
Execution Count:439333
439333
7134 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
7135 -
7136 switch (state) { -
7137 case Dash1: -
7138 next();
executed (the execution status of this line is deduced): next();
-
7139 break;
executed: break;
Execution Count:2090
2090
7140 case Dash2: -
7141 next();
executed (the execution status of this line is deduced): next();
-
7142 break;
executed: break;
Execution Count:2090
2090
7143 case Com: -
7144 stringAddC();
executed (the execution status of this line is deduced): stringAddC();
-
7145 next();
executed (the execution status of this line is deduced): next();
-
7146 break;
executed: break;
Execution Count:450771
450771
7147 case Com2: -
7148 next();
executed (the execution status of this line is deduced): next();
-
7149 break;
executed: break;
Execution Count:6381
6381
7150 case ComE: -
7151 next();
executed (the execution status of this line is deduced): next();
-
7152 break;
executed: break;
Execution Count:2089
2089
7153 case Done: -
7154 next();
executed (the execution status of this line is deduced): next();
-
7155 break;
executed: break;
Execution Count:2087
2087
7156 } -
7157 }
executed: }
Execution Count:465511
465511
7158 return false;
never executed: return false;
0
7159} -
7160 -
7161/* -
7162 Parse an Attribute [41]. -
7163 -
7164 Precondition: the head stands on the first character of the name -
7165 of the attribute (i.e. all whitespaces are already parsed). -
7166 -
7167 The head stand on the next character after the end quotes. The -
7168 variable name contains the name of the attribute and the variable -
7169 string contains the value of the attribute. -
7170*/ -
7171bool QXmlSimpleReaderPrivate::parseAttribute() -
7172{ -
7173 const int Init = 0;
executed (the execution status of this line is deduced): const int Init = 0;
-
7174 const int PName = 1; // parse name
executed (the execution status of this line is deduced): const int PName = 1;
-
7175 const int Ws = 2; // eat ws
executed (the execution status of this line is deduced): const int Ws = 2;
-
7176 const int Eq = 3; // the '=' was read
executed (the execution status of this line is deduced): const int Eq = 3;
-
7177 const int Quotes = 4; // " or ' were read
executed (the execution status of this line is deduced): const int Quotes = 4;
-
7178 -
7179 const int InpNameBe = 0;
executed (the execution status of this line is deduced): const int InpNameBe = 0;
-
7180 const int InpEq = 1; // =
executed (the execution status of this line is deduced): const int InpEq = 1;
-
7181 const int InpDq = 2; // "
executed (the execution status of this line is deduced): const int InpDq = 2;
-
7182 const int InpSq = 3; // '
executed (the execution status of this line is deduced): const int InpSq = 3;
-
7183 const int InpUnknown = 4;
executed (the execution status of this line is deduced): const int InpUnknown = 4;
-
7184 -
7185 static const int table[4][5] = { -
7186 /* InpNameBe InpEq InpDq InpSq InpUnknown */ -
7187 { PName, -1, -1, -1, -1 }, // Init -
7188 { -1, Eq, -1, -1, Ws }, // PName -
7189 { -1, Eq, -1, -1, -1 }, // Ws -
7190 { -1, -1, Quotes, Quotes, -1 } // Eq -
7191 }; -
7192 int state;
executed (the execution status of this line is deduced): int state;
-
7193 int input;
executed (the execution status of this line is deduced): int input;
-
7194 -
7195 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:28690
yes
Evaluation Count:2446
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:549
yes
Evaluation Count:1897
549-28690
7196 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
7197 } else {
executed: }
Execution Count:29239
29239
7198 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
7199#if defined(QT_QXML_DEBUG) -
7200 qDebug("QXmlSimpleReader: parseAttribute (cont) in state %d", state); -
7201#endif -
7202 if (!parseStack->isEmpty()) {
partially evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1897
no
Evaluation Count:0
0-1897
7203 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
7204 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
yes
Evaluation Count:158
yes
Evaluation Count:1739
158-1739
7205 parseStack->pop();
executed (the execution status of this line is deduced): parseStack->pop();
-
7206#if defined(QT_QXML_DEBUG) -
7207 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
7208#endif -
7209 }
executed: }
Execution Count:158
158
7210 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:933
yes
Evaluation Count:964
933-964
7211 parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
-
7212 return false;
executed: return false;
Execution Count:933
933
7213 } -
7214 }
executed: }
Execution Count:964
964
7215 }
executed: }
Execution Count:964
964
7216 -
7217 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
7218 switch (state) { -
7219 case Quotes: -
7220 // Done -
7221 return true;
executed: return true;
Execution Count:29224
29224
7222 case -1: -
7223 // Error -
7224 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
7225 return false;
executed: return false;
Execution Count:3
3
7226 } -
7227 -
7228 if (atEnd()) {
partially evaluated: atEnd()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:87737
0-87737
7229 unexpectedEof(&QXmlSimpleReaderPrivate::parseAttribute, state);
never executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseAttribute, state);
-
7230 return false;
never executed: return false;
0
7231 } -
7232 if (determineNameChar(c) == NameBeginning) {
evaluated: determineNameChar(c) == NameBeginning
TRUEFALSE
yes
Evaluation Count:29240
yes
Evaluation Count:58497
29240-58497
7233 input = InpNameBe;
executed (the execution status of this line is deduced): input = InpNameBe;
-
7234 } else if (c == QLatin1Char('=')) {
executed: }
Execution Count:29240
evaluated: c == QLatin1Char('=')
TRUEFALSE
yes
Evaluation Count:29238
yes
Evaluation Count:29259
29238-29259
7235 input = InpEq;
executed (the execution status of this line is deduced): input = InpEq;
-
7236 } else if (c == QLatin1Char('"')) {
executed: }
Execution Count:29238
evaluated: c == QLatin1Char('"')
TRUEFALSE
yes
Evaluation Count:27596
yes
Evaluation Count:1663
1663-29238
7237 input = InpDq;
executed (the execution status of this line is deduced): input = InpDq;
-
7238 } else if (c == QLatin1Char('\'')) {
executed: }
Execution Count:27596
evaluated: c == QLatin1Char('\'')
TRUEFALSE
yes
Evaluation Count:1640
yes
Evaluation Count:23
23-27596
7239 input = InpSq;
executed (the execution status of this line is deduced): input = InpSq;
-
7240 } else {
executed: }
Execution Count:1640
1640
7241 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
7242 }
executed: }
Execution Count:23
23
7243 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
7244 -
7245 switch (state) { -
7246 case PName: -
7247 parseName_useRef = false;
executed (the execution status of this line is deduced): parseName_useRef = false;
-
7248 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:362
yes
Evaluation Count:28877
362-28877
7249 parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
-
7250 return false;
executed: return false;
Execution Count:362
362
7251 } -
7252 break;
executed: break;
Execution Count:28877
28877
7253 case Ws: -
7254 if (!eat_ws()) {
evaluated: !eat_ws()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:17
4-17
7255 parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
-
7256 return false;
executed: return false;
Execution Count:4
4
7257 } -
7258 break;
executed: break;
Execution Count:17
17
7259 case Eq: -
7260 if (!next_eat_ws()) {
evaluated: !next_eat_ws()
TRUEFALSE
yes
Evaluation Count:152
yes
Evaluation Count:29086
152-29086
7261 parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
-
7262 return false;
executed: return false;
Execution Count:152
152
7263 } -
7264 break;
executed: break;
Execution Count:29086
29086
7265 case Quotes: -
7266 if (!parseAttValue()) {
evaluated: !parseAttValue()
TRUEFALSE
yes
Evaluation Count:458
yes
Evaluation Count:28778
458-28778
7267 parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseAttribute, state);
-
7268 return false;
executed: return false;
Execution Count:458
458
7269 } -
7270 break;
executed: break;
Execution Count:28778
28778
7271 } -
7272 }
executed: }
Execution Count:86761
86761
7273 return false;
never executed: return false;
0
7274} -
7275 -
7276/* -
7277 Parse a Name [5] and store the name in name or ref (if useRef is true). -
7278*/ -
7279bool QXmlSimpleReaderPrivate::parseName() -
7280{ -
7281 const int Init = 0;
executed (the execution status of this line is deduced): const int Init = 0;
-
7282 const int Name1 = 1; // parse first character of the name
executed (the execution status of this line is deduced): const int Name1 = 1;
-
7283 const int Name = 2; // parse name
executed (the execution status of this line is deduced): const int Name = 2;
-
7284 const int Done = 3;
executed (the execution status of this line is deduced): const int Done = 3;
-
7285 -
7286 static const int table[3][3] = { -
7287 /* InpNameBe InpNameCh InpUnknown */ -
7288 { Name1, -1, -1 }, // Init -
7289 { Name, Name, Done }, // Name1 -
7290 { Name, Name, Done } // Name -
7291 }; -
7292 int state;
executed (the execution status of this line is deduced): int state;
-
7293 -
7294 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:114470
yes
Evaluation Count:18173
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:9758
yes
Evaluation Count:8415
8415-114470
7295 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
7296 } else {
executed: }
Execution Count:124228
124228
7297 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
7298#if defined(QT_QXML_DEBUG) -
7299 qDebug("QXmlSimpleReader: parseName (cont) in state %d", state); -
7300#endif -
7301 if (!parseStack->isEmpty()) {
partially evaluated: !parseStack->isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8415
0-8415
7302 ParseFunction function = parseStack->top().function;
never executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
7303 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
never evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
0
7304 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
7305#if defined(QT_QXML_DEBUG) -
7306 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
7307#endif -
7308 }
never executed: }
0
7309 if (!(this->*function)()) {
never evaluated: !(this->*function)()
0
7310 parseFailed(&QXmlSimpleReaderPrivate::parseName, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseName, state);
-
7311 return false;
never executed: return false;
0
7312 } -
7313 }
never executed: }
0
7314 }
executed: }
Execution Count:8415
8415
7315 -
7316 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
7317 switch (state) { -
7318 case Done: -
7319 return true;
executed: return true;
Execution Count:124215
124215
7320 case -1: -
7321 // Error -
7322 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
7323 return false;
executed: return false;
Execution Count:13
13
7324 } -
7325 -
7326 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:8415
yes
Evaluation Count:597424
8415-597424
7327 unexpectedEof(&QXmlSimpleReaderPrivate::parseName, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseName, state);
-
7328 return false;
executed: return false;
Execution Count:8415
8415
7329 } -
7330 -
7331 // we can safely do the (int) cast thanks to the Q_ASSERTs earlier in this function -
7332 state = table[state][(int)fastDetermineNameChar(c)];
executed (the execution status of this line is deduced): state = table[state][(int)fastDetermineNameChar(c)];
-
7333 -
7334 switch (state) { -
7335 case Name1: -
7336 if (parseName_useRef) {
evaluated: parseName_useRef
TRUEFALSE
yes
Evaluation Count:5365
yes
Evaluation Count:118850
5365-118850
7337 refClear();
executed (the execution status of this line is deduced): refClear();
-
7338 refAddC();
executed (the execution status of this line is deduced): refAddC();
-
7339 } else {
executed: }
Execution Count:5365
5365
7340 nameClear();
executed (the execution status of this line is deduced): nameClear();
-
7341 nameAddC();
executed (the execution status of this line is deduced): nameAddC();
-
7342 }
executed: }
Execution Count:118850
118850
7343 next();
executed (the execution status of this line is deduced): next();
-
7344 break;
executed: break;
Execution Count:124215
124215
7345 case Name: -
7346 if (parseName_useRef) {
evaluated: parseName_useRef
TRUEFALSE
yes
Evaluation Count:19155
yes
Evaluation Count:329826
19155-329826
7347 refAddC();
executed (the execution status of this line is deduced): refAddC();
-
7348 } else {
executed: }
Execution Count:19155
19155
7349 nameAddC();
executed (the execution status of this line is deduced): nameAddC();
-
7350 }
executed: }
Execution Count:329826
329826
7351 next();
executed (the execution status of this line is deduced): next();
-
7352 break;
executed: break;
Execution Count:348981
348981
7353 } -
7354 }
executed: }
Execution Count:597424
597424
7355 return false;
never executed: return false;
0
7356} -
7357 -
7358/* -
7359 Parse a Nmtoken [7] and store the name in name. -
7360*/ -
7361bool QXmlSimpleReaderPrivate::parseNmtoken() -
7362{ -
7363 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
7364 const signed char NameF = 1;
executed (the execution status of this line is deduced): const signed char NameF = 1;
-
7365 const signed char Name = 2;
executed (the execution status of this line is deduced): const signed char Name = 2;
-
7366 const signed char Done = 3;
executed (the execution status of this line is deduced): const signed char Done = 3;
-
7367 -
7368 const signed char InpNameCh = 0; // NameChar without InpNameBe
executed (the execution status of this line is deduced): const signed char InpNameCh = 0;
-
7369 const signed char InpUnknown = 1;
executed (the execution status of this line is deduced): const signed char InpUnknown = 1;
-
7370 -
7371 static const signed char table[3][2] = { -
7372 /* InpNameCh InpUnknown */ -
7373 { NameF, -1 }, // Init -
7374 { Name, Done }, // NameF -
7375 { Name, Done } // Name -
7376 }; -
7377 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
7378 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
7379 -
7380 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:23
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:5
5-23
7381 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
7382 } else {
executed: }
Execution Count:24
24
7383 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
7384#if defined(QT_QXML_DEBUG) -
7385 qDebug("QXmlSimpleReader: parseNmtoken (cont) in state %d", state); -
7386#endif -
7387 if (!parseStack->isEmpty()) {
partially evaluated: !parseStack->isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
7388 ParseFunction function = parseStack->top().function;
never executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
7389 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
never evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
0
7390 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
7391#if defined(QT_QXML_DEBUG) -
7392 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
7393#endif -
7394 }
never executed: }
0
7395 if (!(this->*function)()) {
never evaluated: !(this->*function)()
0
7396 parseFailed(&QXmlSimpleReaderPrivate::parseNmtoken, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseNmtoken, state);
-
7397 return false;
never executed: return false;
0
7398 } -
7399 }
never executed: }
0
7400 }
executed: }
Execution Count:5
5
7401 -
7402 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
7403 switch (state) { -
7404 case Done: -
7405 return true;
executed: return true;
Execution Count:24
24
7406 case -1: -
7407 // Error -
7408 reportParseError(QLatin1String(XMLERR_LETTEREXPECTED));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("letter is expected"));
-
7409 return false;
never executed: return false;
0
7410 } -
7411 -
7412 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:56
5-56
7413 unexpectedEof(&QXmlSimpleReaderPrivate::parseNmtoken, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseNmtoken, state);
-
7414 return false;
executed: return false;
Execution Count:5
5
7415 } -
7416 if (determineNameChar(c) == NotName) {
evaluated: determineNameChar(c) == NotName
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:32
24-32
7417 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
7418 } else {
executed: }
Execution Count:24
24
7419 input = InpNameCh;
executed (the execution status of this line is deduced): input = InpNameCh;
-
7420 }
executed: }
Execution Count:32
32
7421 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
7422 -
7423 switch (state) { -
7424 case NameF: -
7425 nameClear();
executed (the execution status of this line is deduced): nameClear();
-
7426 nameAddC();
executed (the execution status of this line is deduced): nameAddC();
-
7427 next();
executed (the execution status of this line is deduced): next();
-
7428 break;
executed: break;
Execution Count:24
24
7429 case Name: -
7430 nameAddC();
executed (the execution status of this line is deduced): nameAddC();
-
7431 next();
executed (the execution status of this line is deduced): next();
-
7432 break;
executed: break;
Execution Count:8
8
7433 } -
7434 }
executed: }
Execution Count:56
56
7435 return false;
never executed: return false;
0
7436} -
7437 -
7438/* -
7439 Parse a Reference [67]. -
7440 -
7441 parseReference_charDataRead is set to true if the reference must not be -
7442 parsed. The character(s) which the reference mapped to are appended to -
7443 string. The head stands on the first character after the reference. -
7444 -
7445 parseReference_charDataRead is set to false if the reference must be parsed. -
7446 The charachter(s) which the reference mapped to are inserted at the reference -
7447 position. The head stands on the first character of the replacement). -
7448*/ -
7449bool QXmlSimpleReaderPrivate::parseReference() -
7450{ -
7451 // temporary variables (only used in very local context, so they don't -
7452 // interfere with incremental parsing) -
7453 uint tmp;
executed (the execution status of this line is deduced): uint tmp;
-
7454 bool ok;
executed (the execution status of this line is deduced): bool ok;
-
7455 -
7456 const signed char Init = 0;
executed (the execution status of this line is deduced): const signed char Init = 0;
-
7457 const signed char SRef = 1; // start of a reference
executed (the execution status of this line is deduced): const signed char SRef = 1;
-
7458 const signed char ChRef = 2; // parse CharRef
executed (the execution status of this line is deduced): const signed char ChRef = 2;
-
7459 const signed char ChDec = 3; // parse CharRef decimal
executed (the execution status of this line is deduced): const signed char ChDec = 3;
-
7460 const signed char ChHexS = 4; // start CharRef hexadecimal
executed (the execution status of this line is deduced): const signed char ChHexS = 4;
-
7461 const signed char ChHex = 5; // parse CharRef hexadecimal
executed (the execution status of this line is deduced): const signed char ChHex = 5;
-
7462 const signed char Name = 6; // parse name
executed (the execution status of this line is deduced): const signed char Name = 6;
-
7463 const signed char DoneD = 7; // done CharRef decimal
executed (the execution status of this line is deduced): const signed char DoneD = 7;
-
7464 const signed char DoneH = 8; // done CharRef hexadecimal
executed (the execution status of this line is deduced): const signed char DoneH = 8;
-
7465 const signed char DoneN = 9; // done EntityRef
executed (the execution status of this line is deduced): const signed char DoneN = 9;
-
7466 -
7467 const signed char InpAmp = 0; // &
executed (the execution status of this line is deduced): const signed char InpAmp = 0;
-
7468 const signed char InpSemi = 1; // ;
executed (the execution status of this line is deduced): const signed char InpSemi = 1;
-
7469 const signed char InpHash = 2; // #
executed (the execution status of this line is deduced): const signed char InpHash = 2;
-
7470 const signed char InpX = 3; // x
executed (the execution status of this line is deduced): const signed char InpX = 3;
-
7471 const signed char InpNum = 4; // 0-9
executed (the execution status of this line is deduced): const signed char InpNum = 4;
-
7472 const signed char InpHex = 5; // a-f A-F
executed (the execution status of this line is deduced): const signed char InpHex = 5;
-
7473 const signed char InpUnknown = 6;
executed (the execution status of this line is deduced): const signed char InpUnknown = 6;
-
7474 -
7475 static const signed char table[8][7] = { -
7476 /* InpAmp InpSemi InpHash InpX InpNum InpHex InpUnknown */ -
7477 { SRef, -1, -1, -1, -1, -1, -1 }, // Init -
7478 { -1, -1, ChRef, Name, Name, Name, Name }, // SRef -
7479 { -1, -1, -1, ChHexS, ChDec, -1, -1 }, // ChRef -
7480 { -1, DoneD, -1, -1, ChDec, -1, -1 }, // ChDec -
7481 { -1, -1, -1, -1, ChHex, ChHex, -1 }, // ChHexS -
7482 { -1, DoneH, -1, -1, ChHex, ChHex, -1 }, // ChHex -
7483 { -1, DoneN, -1, -1, -1, -1, -1 } // Name -
7484 }; -
7485 signed char state;
executed (the execution status of this line is deduced): signed char state;
-
7486 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
7487 -
7488 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:16349
yes
Evaluation Count:2474
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:1161
yes
Evaluation Count:1313
1161-16349
7489 parseReference_charDataRead = false;
executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7490 state = Init;
executed (the execution status of this line is deduced): state = Init;
-
7491 } else {
executed: }
Execution Count:17510
17510
7492 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
7493#if defined(QT_QXML_DEBUG) -
7494 qDebug("QXmlSimpleReader: parseReference (cont) in state %d", state); -
7495#endif -
7496 if (!parseStack->isEmpty()) {
evaluated: !parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:504
yes
Evaluation Count:809
504-809
7497 ParseFunction function = parseStack->top().function;
executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
7498 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
partially evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:504
0-504
7499 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
7500#if defined(QT_QXML_DEBUG) -
7501 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
7502#endif -
7503 }
never executed: }
0
7504 if (!(this->*function)()) {
evaluated: !(this->*function)()
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:374
130-374
7505 parseFailed(&QXmlSimpleReaderPrivate::parseReference, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseReference, state);
-
7506 return false;
executed: return false;
Execution Count:130
130
7507 } -
7508 }
executed: }
Execution Count:374
374
7509 }
executed: }
Execution Count:1183
1183
7510 -
7511 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
7512 switch (state) { -
7513 case DoneD: -
7514 return true;
executed: return true;
Execution Count:281
281
7515 case DoneH: -
7516 return true;
executed: return true;
Execution Count:11916
11916
7517 case DoneN: -
7518 return true;
executed: return true;
Execution Count:5290
5290
7519 case -1: -
7520 // Error -
7521 reportParseError(QLatin1String(XMLERR_ERRORPARSINGREFERENCE));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing reference"));
-
7522 return false;
executed: return false;
Execution Count:6
6
7523 } -
7524 -
7525 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:809
yes
Evaluation Count:77865
809-77865
7526 unexpectedEof(&QXmlSimpleReaderPrivate::parseReference, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseReference, state);
-
7527 return false;
executed: return false;
Execution Count:809
809
7528 } -
7529 if (c.row()) {
partially evaluated: c.row()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77865
0-77865
7530 input = InpUnknown;
never executed (the execution status of this line is deduced): input = InpUnknown;
-
7531 } else if (c.cell() == '&') {
never executed: }
evaluated: c.cell() == '&'
TRUEFALSE
yes
Evaluation Count:17511
yes
Evaluation Count:60354
0-60354
7532 input = InpAmp;
executed (the execution status of this line is deduced): input = InpAmp;
-
7533 } else if (c.cell() == ';') {
executed: }
Execution Count:17511
evaluated: c.cell() == ';'
TRUEFALSE
yes
Evaluation Count:17495
yes
Evaluation Count:42859
17495-42859
7534 input = InpSemi;
executed (the execution status of this line is deduced): input = InpSemi;
-
7535 } else if (c.cell() == '#') {
executed: }
Execution Count:17495
evaluated: c.cell() == '#'
TRUEFALSE
yes
Evaluation Count:12200
yes
Evaluation Count:30659
12200-30659
7536 input = InpHash;
executed (the execution status of this line is deduced): input = InpHash;
-
7537 } else if (c.cell() == 'x') {
executed: }
Execution Count:12200
evaluated: c.cell() == 'x'
TRUEFALSE
yes
Evaluation Count:11930
yes
Evaluation Count:18729
11930-18729
7538 input = InpX;
executed (the execution status of this line is deduced): input = InpX;
-
7539 } else if ('0' <= c.cell() && c.cell() <= '9') {
executed: }
Execution Count:11930
evaluated: '0' <= c.cell()
TRUEFALSE
yes
Evaluation Count:18718
yes
Evaluation Count:11
evaluated: c.cell() <= '9'
TRUEFALSE
yes
Evaluation Count:1537
yes
Evaluation Count:17181
11-18718
7540 input = InpNum;
executed (the execution status of this line is deduced): input = InpNum;
-
7541 } else if ('a' <= c.cell() && c.cell() <= 'f') {
executed: }
Execution Count:1537
evaluated: 'a' <= c.cell()
TRUEFALSE
yes
Evaluation Count:17055
yes
Evaluation Count:137
evaluated: c.cell() <= 'f'
TRUEFALSE
yes
Evaluation Count:13671
yes
Evaluation Count:3384
137-17055
7542 input = InpHex;
executed (the execution status of this line is deduced): input = InpHex;
-
7543 } else if ('A' <= c.cell() && c.cell() <= 'F') {
executed: }
Execution Count:13671
evaluated: 'A' <= c.cell()
TRUEFALSE
yes
Evaluation Count:3509
yes
Evaluation Count:12
evaluated: c.cell() <= 'F'
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:3456
12-13671
7544 input = InpHex;
executed (the execution status of this line is deduced): input = InpHex;
-
7545 } else {
executed: }
Execution Count:53
53
7546 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
7547 }
executed: }
Execution Count:3468
3468
7548 state = table[state][input];
executed (the execution status of this line is deduced): state = table[state][input];
-
7549 -
7550 switch (state) { -
7551 case SRef: -
7552 refClear();
executed (the execution status of this line is deduced): refClear();
-
7553 next();
executed (the execution status of this line is deduced): next();
-
7554 break;
executed: break;
Execution Count:17510
17510
7555 case ChRef: -
7556 next();
executed (the execution status of this line is deduced): next();
-
7557 break;
executed: break;
Execution Count:12200
12200
7558 case ChDec: -
7559 refAddC();
executed (the execution status of this line is deduced): refAddC();
-
7560 next();
executed (the execution status of this line is deduced): next();
-
7561 break;
executed: break;
Execution Count:928
928
7562 case ChHexS: -
7563 next();
executed (the execution status of this line is deduced): next();
-
7564 break;
executed: break;
Execution Count:11916
11916
7565 case ChHex: -
7566 refAddC();
executed (the execution status of this line is deduced): refAddC();
-
7567 next();
executed (the execution status of this line is deduced): next();
-
7568 break;
executed: break;
Execution Count:12501
12501
7569 case Name: -
7570 // read the name into the ref -
7571 parseName_useRef = true;
executed (the execution status of this line is deduced): parseName_useRef = true;
-
7572 if (!parseName()) {
evaluated: !parseName()
TRUEFALSE
yes
Evaluation Count:383
yes
Evaluation Count:4926
383-4926
7573 parseFailed(&QXmlSimpleReaderPrivate::parseReference, state);
executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseReference, state);
-
7574 return false;
executed: return false;
Execution Count:383
383
7575 } -
7576 break;
executed: break;
Execution Count:4926
4926
7577 case DoneD: -
7578 tmp = ref().toUInt(&ok, 10);
executed (the execution status of this line is deduced): tmp = ref().toUInt(&ok, 10);
-
7579 if (ok) {
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:281
no
Evaluation Count:0
0-281
7580 stringAddC(QChar(tmp));
executed (the execution status of this line is deduced): stringAddC(QChar(tmp));
-
7581 } else {
executed: }
Execution Count:281
281
7582 reportParseError(QLatin1String(XMLERR_ERRORPARSINGREFERENCE));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing reference"));
-
7583 return false;
never executed: return false;
0
7584 } -
7585 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7586 next();
executed (the execution status of this line is deduced): next();
-
7587 break;
executed: break;
Execution Count:281
281
7588 case DoneH: -
7589 tmp = ref().toUInt(&ok, 16);
executed (the execution status of this line is deduced): tmp = ref().toUInt(&ok, 16);
-
7590 if (ok) {
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:11916
no
Evaluation Count:0
0-11916
7591 stringAddC(QChar(tmp));
executed (the execution status of this line is deduced): stringAddC(QChar(tmp));
-
7592 } else {
executed: }
Execution Count:11916
11916
7593 reportParseError(QLatin1String(XMLERR_ERRORPARSINGREFERENCE));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("error occurred while parsing reference"));
-
7594 return false;
never executed: return false;
0
7595 } -
7596 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7597 next();
executed (the execution status of this line is deduced): next();
-
7598 break;
executed: break;
Execution Count:11916
11916
7599 case DoneN: -
7600 if (!processReference())
evaluated: !processReference()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:5290
8-5290
7601 return false;
executed: return false;
Execution Count:8
8
7602 next();
executed (the execution status of this line is deduced): next();
-
7603 break;
executed: break;
Execution Count:5290
5290
7604 } -
7605 }
executed: }
Execution Count:77474
77474
7606 return false;
never executed: return false;
0
7607} -
7608 -
7609/* -
7610 Helper function for parseReference() -
7611*/ -
7612bool QXmlSimpleReaderPrivate::processReference() -
7613{ -
7614 QString reference = ref();
executed (the execution status of this line is deduced): QString reference = ref();
-
7615 if (reference == QLatin1String("amp")) {
evaluated: reference == QLatin1String("amp")
TRUEFALSE
yes
Evaluation Count:596
yes
Evaluation Count:4702
596-4702
7616 if (parseReference_context == InEntityValue) {
evaluated: parseReference_context == InEntityValue
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:594
2-594
7617 // Bypassed -
7618 stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('a')); stringAddC(QLatin1Char('m')); stringAddC(QLatin1Char('p')); stringAddC(QLatin1Char(';'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('a')); stringAddC(QLatin1Char('m')); stringAddC(QLatin1Char('p')); stringAddC(QLatin1Char(';'));
-
7619 } else {
executed: }
Execution Count:2
2
7620 // Included or Included in literal -
7621 stringAddC(QLatin1Char('&'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&'));
-
7622 }
executed: }
Execution Count:594
594
7623 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7624 } else if (reference == QLatin1String("lt")) {
executed: }
Execution Count:596
evaluated: reference == QLatin1String("lt")
TRUEFALSE
yes
Evaluation Count:1143
yes
Evaluation Count:3559
596-3559
7625 if (parseReference_context == InEntityValue) {
evaluated: parseReference_context == InEntityValue
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1131
12-1131
7626 // Bypassed -
7627 stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('l')); stringAddC(QLatin1Char('t')); stringAddC(QLatin1Char(';'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('l')); stringAddC(QLatin1Char('t')); stringAddC(QLatin1Char(';'));
-
7628 } else {
executed: }
Execution Count:12
12
7629 // Included or Included in literal -
7630 stringAddC(QLatin1Char('<'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('<'));
-
7631 }
executed: }
Execution Count:1131
1131
7632 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7633 } else if (reference == QLatin1String("gt")) {
executed: }
Execution Count:1143
evaluated: reference == QLatin1String("gt")
TRUEFALSE
yes
Evaluation Count:244
yes
Evaluation Count:3315
244-3315
7634 if (parseReference_context == InEntityValue) {
partially evaluated: parseReference_context == InEntityValue
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:244
0-244
7635 // Bypassed -
7636 stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('g')); stringAddC(QLatin1Char('t')); stringAddC(QLatin1Char(';'));
never executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('g')); stringAddC(QLatin1Char('t')); stringAddC(QLatin1Char(';'));
-
7637 } else {
never executed: }
0
7638 // Included or Included in literal -
7639 stringAddC(QLatin1Char('>'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('>'));
-
7640 }
executed: }
Execution Count:244
244
7641 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7642 } else if (reference == QLatin1String("apos")) {
executed: }
Execution Count:244
evaluated: reference == QLatin1String("apos")
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:3295
20-3295
7643 if (parseReference_context == InEntityValue) {
partially evaluated: parseReference_context == InEntityValue
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
7644 // Bypassed -
7645 stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('a')); stringAddC(QLatin1Char('p')); stringAddC(QLatin1Char('o')); stringAddC(QLatin1Char('s')); stringAddC(QLatin1Char(';'));
never executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('a')); stringAddC(QLatin1Char('p')); stringAddC(QLatin1Char('o')); stringAddC(QLatin1Char('s')); stringAddC(QLatin1Char(';'));
-
7646 } else {
never executed: }
0
7647 // Included or Included in literal -
7648 stringAddC(QLatin1Char('\''));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('\''));
-
7649 }
executed: }
Execution Count:20
20
7650 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7651 } else if (reference == QLatin1String("quot")) {
executed: }
Execution Count:20
evaluated: reference == QLatin1String("quot")
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:3260
20-3260
7652 if (parseReference_context == InEntityValue) {
partially evaluated: parseReference_context == InEntityValue
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
7653 // Bypassed -
7654 stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('q')); stringAddC(QLatin1Char('u')); stringAddC(QLatin1Char('o')); stringAddC(QLatin1Char('t')); stringAddC(QLatin1Char(';'));
never executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&')); stringAddC(QLatin1Char('q')); stringAddC(QLatin1Char('u')); stringAddC(QLatin1Char('o')); stringAddC(QLatin1Char('t')); stringAddC(QLatin1Char(';'));
-
7655 } else {
never executed: }
0
7656 // Included or Included in literal -
7657 stringAddC(QLatin1Char('"'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('"'));
-
7658 }
executed: }
Execution Count:35
35
7659 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7660 } else {
executed: }
Execution Count:35
35
7661 QMap<QString,QString>::Iterator it;
executed (the execution status of this line is deduced): QMap<QString,QString>::Iterator it;
-
7662 it = entities.find(reference);
executed (the execution status of this line is deduced): it = entities.find(reference);
-
7663 if (it != entities.end()) {
evaluated: it != entities.end()
TRUEFALSE
yes
Evaluation Count:2820
yes
Evaluation Count:440
440-2820
7664 // "Internal General" -
7665 switch (parseReference_context) { -
7666 case InContent: -
7667 // Included -
7668 if (!insertXmlRef(*it, reference, false))
evaluated: !insertXmlRef(*it, reference, false)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2649
1-2649
7669 return false;
executed: return false;
Execution Count:1
1
7670 parseReference_charDataRead = false;
executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7671 break;
executed: break;
Execution Count:2649
2649
7672 case InAttributeValue: -
7673 // Included in literal -
7674 if (!insertXmlRef(*it, reference, true))
evaluated: !insertXmlRef(*it, reference, true)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:161
3-161
7675 return false;
executed: return false;
Execution Count:3
3
7676 parseReference_charDataRead = false;
executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7677 break;
executed: break;
Execution Count:161
161
7678 case InEntityValue: -
7679 { -
7680 // Bypassed -
7681 stringAddC(QLatin1Char('&'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&'));
-
7682 for (int i=0; i<(int)reference.length(); i++) {
evaluated: i<(int)reference.length()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:6
6-42
7683 stringAddC(reference[i]);
executed (the execution status of this line is deduced): stringAddC(reference[i]);
-
7684 }
executed: }
Execution Count:42
42
7685 stringAddC(QLatin1Char(';'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char(';'));
-
7686 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7687 } -
7688 break;
executed: break;
Execution Count:6
6
7689 case InDTD: -
7690 // Forbidden -
7691 parseReference_charDataRead = false;
never executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7692 reportParseError(QLatin1String(XMLERR_INTERNALGENERALENTITYINDTD));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("internal general entity reference not allowed in DTD"));
-
7693 return false;
never executed: return false;
0
7694 } -
7695 } else {
executed: }
Execution Count:2816
2816
7696 QMap<QString,QXmlSimpleReaderPrivate::ExternEntity>::Iterator itExtern;
executed (the execution status of this line is deduced): QMap<QString,QXmlSimpleReaderPrivate::ExternEntity>::Iterator itExtern;
-
7697 itExtern = externEntities.find(reference);
executed (the execution status of this line is deduced): itExtern = externEntities.find(reference);
-
7698 if (itExtern == externEntities.end()) {
evaluated: itExtern == externEntities.end()
TRUEFALSE
yes
Evaluation Count:296
yes
Evaluation Count:144
144-296
7699 // entity not declared -
7700 // ### check this case for conformance -
7701 if (parseReference_context == InEntityValue) {
evaluated: parseReference_context == InEntityValue
TRUEFALSE
yes
Evaluation Count:99
yes
Evaluation Count:197
99-197
7702 // Bypassed -
7703 stringAddC(QLatin1Char('&'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&'));
-
7704 for (int i=0; i<(int)reference.length(); i++) {
evaluated: i<(int)reference.length()
TRUEFALSE
yes
Evaluation Count:209
yes
Evaluation Count:99
99-209
7705 stringAddC(reference[i]);
executed (the execution status of this line is deduced): stringAddC(reference[i]);
-
7706 }
executed: }
Execution Count:209
209
7707 stringAddC(QLatin1Char(';'));
executed (the execution status of this line is deduced): stringAddC(QLatin1Char(';'));
-
7708 parseReference_charDataRead = true;
executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7709 } else {
executed: }
Execution Count:99
99
7710 // if we have some char data read, report it now -
7711 if (parseReference_context == InContent) {
evaluated: parseReference_context == InContent
TRUEFALSE
yes
Evaluation Count:183
yes
Evaluation Count:14
14-183
7712 if (contentCharDataRead) {
evaluated: contentCharDataRead
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:83
83-100
7713 if (reportWhitespaceCharData || !string().simplified().isEmpty()) {
partially evaluated: reportWhitespaceCharData
TRUEFALSE
yes
Evaluation Count:100
no
Evaluation Count:0
never evaluated: !string().simplified().isEmpty()
0-100
7714 if (contentHnd != 0 && !contentHnd->characters(string())) {
partially evaluated: contentHnd != 0
TRUEFALSE
yes
Evaluation Count:100
no
Evaluation Count:0
partially evaluated: !contentHnd->characters(string())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:100
0-100
7715 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
7716 return false;
never executed: return false;
0
7717 } -
7718 }
executed: }
Execution Count:100
100
7719 stringClear();
executed (the execution status of this line is deduced): stringClear();
-
7720 contentCharDataRead = false;
executed (the execution status of this line is deduced): contentCharDataRead = false;
-
7721 }
executed: }
Execution Count:100
100
7722 }
executed: }
Execution Count:183
183
7723 -
7724 if (contentHnd) {
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:197
no
Evaluation Count:0
0-197
7725 qt_xml_skipped_entity_in_content = parseReference_context == InContent;
executed (the execution status of this line is deduced): qt_xml_skipped_entity_in_content = parseReference_context == InContent;
-
7726 if (!contentHnd->skippedEntity(reference)) {
partially evaluated: !contentHnd->skippedEntity(reference)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:197
0-197
7727 qt_xml_skipped_entity_in_content = false;
never executed (the execution status of this line is deduced): qt_xml_skipped_entity_in_content = false;
-
7728 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
7729 return false; // error
never executed: return false;
0
7730 } -
7731 qt_xml_skipped_entity_in_content = false;
executed (the execution status of this line is deduced): qt_xml_skipped_entity_in_content = false;
-
7732 }
executed: }
Execution Count:197
197
7733 }
executed: }
Execution Count:197
197
7734 } else if ((*itExtern).notation.isNull()) {
evaluated: (*itExtern).notation.isNull()
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:2
2-142
7735 // "External Parsed General" -
7736 switch (parseReference_context) { -
7737 case InContent: -
7738 { -
7739 // Included if validating -
7740 bool skipIt = true;
executed (the execution status of this line is deduced): bool skipIt = true;
-
7741 if (entityRes) {
partially evaluated: entityRes
TRUEFALSE
yes
Evaluation Count:140
no
Evaluation Count:0
0-140
7742 QXmlInputSource *ret = 0;
executed (the execution status of this line is deduced): QXmlInputSource *ret = 0;
-
7743 if (!entityRes->resolveEntity((*itExtern).publicId, (*itExtern).systemId, ret)) {
partially evaluated: !entityRes->resolveEntity((*itExtern).publicId, (*itExtern).systemId, ret)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
7744 delete ret;
never executed (the execution status of this line is deduced): delete ret;
-
7745 reportParseError(entityRes->errorString());
never executed (the execution status of this line is deduced): reportParseError(entityRes->errorString());
-
7746 return false;
never executed: return false;
0
7747 } -
7748 if (ret) {
partially evaluated: ret
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
7749 QString xmlRefString = ret->data();
never executed (the execution status of this line is deduced): QString xmlRefString = ret->data();
-
7750 delete ret;
never executed (the execution status of this line is deduced): delete ret;
-
7751 if (!stripTextDecl(xmlRefString)) {
never evaluated: !stripTextDecl(xmlRefString)
0
7752 reportParseError(QLatin1String(XMLERR_ERRORINTEXTDECL));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("error in the text declaration of an external entity"));
-
7753 return false;
never executed: return false;
0
7754 } -
7755 if (!insertXmlRef(xmlRefString, reference, false))
never evaluated: !insertXmlRef(xmlRefString, reference, false)
0
7756 return false;
never executed: return false;
0
7757 skipIt = false;
never executed (the execution status of this line is deduced): skipIt = false;
-
7758 }
never executed: }
0
7759 }
executed: }
Execution Count:140
140
7760 if (skipIt && contentHnd) {
partially evaluated: skipIt
TRUEFALSE
yes
Evaluation Count:140
no
Evaluation Count:0
partially evaluated: contentHnd
TRUEFALSE
yes
Evaluation Count:140
no
Evaluation Count:0
0-140
7761 qt_xml_skipped_entity_in_content = true;
executed (the execution status of this line is deduced): qt_xml_skipped_entity_in_content = true;
-
7762 if (!contentHnd->skippedEntity(reference)) {
partially evaluated: !contentHnd->skippedEntity(reference)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
7763 qt_xml_skipped_entity_in_content = false;
never executed (the execution status of this line is deduced): qt_xml_skipped_entity_in_content = false;
-
7764 reportParseError(contentHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(contentHnd->errorString());
-
7765 return false; // error
never executed: return false;
0
7766 } -
7767 qt_xml_skipped_entity_in_content = false;
executed (the execution status of this line is deduced): qt_xml_skipped_entity_in_content = false;
-
7768 }
executed: }
Execution Count:140
140
7769 parseReference_charDataRead = false;
executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7770 } break;
executed: break;
Execution Count:140
140
7771 case InAttributeValue: -
7772 // Forbidden -
7773 parseReference_charDataRead = false;
executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7774 reportParseError(QLatin1String(XMLERR_EXTERNALGENERALENTITYINAV));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("external parsed general entity reference not allowed in attribute value"));
-
7775 return false;
executed: return false;
Execution Count:2
2
7776 case InEntityValue: -
7777 { -
7778 // Bypassed -
7779 stringAddC(QLatin1Char('&'));
never executed (the execution status of this line is deduced): stringAddC(QLatin1Char('&'));
-
7780 for (int i=0; i<(int)reference.length(); i++) {
never evaluated: i<(int)reference.length()
0
7781 stringAddC(reference[i]);
never executed (the execution status of this line is deduced): stringAddC(reference[i]);
-
7782 }
never executed: }
0
7783 stringAddC(QLatin1Char(';'));
never executed (the execution status of this line is deduced): stringAddC(QLatin1Char(';'));
-
7784 parseReference_charDataRead = true;
never executed (the execution status of this line is deduced): parseReference_charDataRead = true;
-
7785 } -
7786 break;
never executed: break;
0
7787 case InDTD: -
7788 // Forbidden -
7789 parseReference_charDataRead = false;
never executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7790 reportParseError(QLatin1String(XMLERR_EXTERNALGENERALENTITYINDTD));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("external parsed general entity reference not allowed in DTD"));
-
7791 return false;
never executed: return false;
0
7792 } -
7793 } else {
executed: }
Execution Count:140
140
7794 // "Unparsed" -
7795 // ### notify for "Occurs as Attribute Value" missing (but this is no refence, anyway) -
7796 // Forbidden -
7797 parseReference_charDataRead = false;
executed (the execution status of this line is deduced): parseReference_charDataRead = false;
-
7798 reportParseError(QLatin1String(XMLERR_UNPARSEDENTITYREFERENCE));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unparsed entity reference in wrong context"));
-
7799 return false; // error
executed: return false;
Execution Count:2
2
7800 } -
7801 } -
7802 } -
7803 return true; // no error
executed: return true;
Execution Count:5290
5290
7804} -
7805 -
7806 -
7807/* -
7808 Parses over a simple string. -
7809 -
7810 After the string was successfully parsed, the head is on the first -
7811 character after the string. -
7812*/ -
7813bool QXmlSimpleReaderPrivate::parseString() -
7814{ -
7815 const signed char InpCharExpected = 0; // the character that was expected
executed (the execution status of this line is deduced): const signed char InpCharExpected = 0;
-
7816 const signed char InpUnknown = 1;
executed (the execution status of this line is deduced): const signed char InpUnknown = 1;
-
7817 -
7818 signed char state; // state in this function is the position in the string s
executed (the execution status of this line is deduced): signed char state;
-
7819 signed char input;
executed (the execution status of this line is deduced): signed char input;
-
7820 -
7821 if (parseStack==0 || parseStack->isEmpty()) {
evaluated: parseStack==0
TRUEFALSE
yes
Evaluation Count:1767
yes
Evaluation Count:17594
evaluated: parseStack->isEmpty()
TRUEFALSE
yes
Evaluation Count:6612
yes
Evaluation Count:10982
1767-17594
7822 Done = parseString_s.length();
executed (the execution status of this line is deduced): Done = parseString_s.length();
-
7823 state = 0;
executed (the execution status of this line is deduced): state = 0;
-
7824 } else {
executed: }
Execution Count:8379
8379
7825 state = parseStack->pop().state;
executed (the execution status of this line is deduced): state = parseStack->pop().state;
-
7826#if defined(QT_QXML_DEBUG) -
7827 qDebug("QXmlSimpleReader: parseString (cont) in state %d", state); -
7828#endif -
7829 if (!parseStack->isEmpty()) {
partially evaluated: !parseStack->isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10982
0-10982
7830 ParseFunction function = parseStack->top().function;
never executed (the execution status of this line is deduced): ParseFunction function = parseStack->top().function;
-
7831 if (function == &QXmlSimpleReaderPrivate::eat_ws) {
never evaluated: function == &QXmlSimpleReaderPrivate::eat_ws
0
7832 parseStack->pop();
never executed (the execution status of this line is deduced): parseStack->pop();
-
7833#if defined(QT_QXML_DEBUG) -
7834 qDebug("QXmlSimpleReader: eat_ws (cont)"); -
7835#endif -
7836 }
never executed: }
0
7837 if (!(this->*function)()) {
never evaluated: !(this->*function)()
0
7838 parseFailed(&QXmlSimpleReaderPrivate::parseString, state);
never executed (the execution status of this line is deduced): parseFailed(&QXmlSimpleReaderPrivate::parseString, state);
-
7839 return false;
never executed: return false;
0
7840 } -
7841 }
never executed: }
0
7842 }
executed: }
Execution Count:10982
10982
7843 -
7844 for (;;) {
executed (the execution status of this line is deduced): for (;;) {
-
7845 if (state == Done) {
evaluated: state == Done
TRUEFALSE
yes
Evaluation Count:8376
yes
Evaluation Count:63893
8376-63893
7846 return true;
executed: return true;
Execution Count:8376
8376
7847 } -
7848 -
7849 if (atEnd()) {
evaluated: atEnd()
TRUEFALSE
yes
Evaluation Count:10982
yes
Evaluation Count:52911
10982-52911
7850 unexpectedEof(&QXmlSimpleReaderPrivate::parseString, state);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::parseString, state);
-
7851 return false;
executed: return false;
Execution Count:10982
10982
7852 } -
7853 if (c == parseString_s[(int)state]) {
evaluated: c == parseString_s[(int)state]
TRUEFALSE
yes
Evaluation Count:52908
yes
Evaluation Count:3
3-52908
7854 input = InpCharExpected;
executed (the execution status of this line is deduced): input = InpCharExpected;
-
7855 } else {
executed: }
Execution Count:52908
52908
7856 input = InpUnknown;
executed (the execution status of this line is deduced): input = InpUnknown;
-
7857 }
executed: }
Execution Count:3
3
7858 if (input == InpCharExpected) {
evaluated: input == InpCharExpected
TRUEFALSE
yes
Evaluation Count:52908
yes
Evaluation Count:3
3-52908
7859 state++;
executed (the execution status of this line is deduced): state++;
-
7860 } else {
executed: }
Execution Count:52908
52908
7861 // Error -
7862 reportParseError(QLatin1String(XMLERR_UNEXPECTEDCHARACTER));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected character"));
-
7863 return false;
executed: return false;
Execution Count:3
3
7864 } -
7865 -
7866 next();
executed (the execution status of this line is deduced): next();
-
7867 }
executed: }
Execution Count:52908
52908
7868 return false;
never executed: return false;
0
7869} -
7870 -
7871/* -
7872 This private function inserts and reports an entity substitution. The -
7873 substituted string is \a data and the name of the entity reference is \a -
7874 name. If \a inLiteral is true, the entity is IncludedInLiteral (i.e., " and ' -
7875 must be quoted. Otherwise they are not quoted. -
7876 -
7877 This function returns false on error. -
7878*/ -
7879bool QXmlSimpleReaderPrivate::insertXmlRef(const QString &data, const QString &name, bool inLiteral) -
7880{ -
7881 if (inLiteral) {
evaluated: inLiteral
TRUEFALSE
yes
Evaluation Count:166
yes
Evaluation Count:2660
166-2660
7882 QString tmp = data;
executed (the execution status of this line is deduced): QString tmp = data;
-
7883 xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1Char('\"'),
executed (the execution status of this line is deduced): xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1Char('\"'),
-
7884 QLatin1String("&quot;")).replace(QLatin1Char('\''), QLatin1String("&apos;"))));
executed (the execution status of this line is deduced): QLatin1String("&quot;")).replace(QLatin1Char('\''), QLatin1String("&apos;"))));
-
7885 } else {
executed: }
Execution Count:166
166
7886 xmlRefStack.push(XmlRef(name, data));
executed (the execution status of this line is deduced): xmlRefStack.push(XmlRef(name, data));
-
7887 }
executed: }
Execution Count:2660
2660
7888 int n = qMax(parameterEntities.count(), entities.count());
executed (the execution status of this line is deduced): int n = qMax(parameterEntities.count(), entities.count());
-
7889 if (xmlRefStack.count() > n+1) {
evaluated: xmlRefStack.count() > n+1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2822
4-2822
7890 // recursive entities -
7891 reportParseError(QLatin1String(XMLERR_RECURSIVEENTITIES));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("recursive entities"));
-
7892 return false;
executed: return false;
Execution Count:4
4
7893 } -
7894 if (reportEntities && lexicalHnd) {
evaluated: reportEntities
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2820
partially evaluated: lexicalHnd
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2820
7895 if (!lexicalHnd->startEntity(name)) {
partially evaluated: !lexicalHnd->startEntity(name)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
7896 reportParseError(lexicalHnd->errorString());
never executed (the execution status of this line is deduced): reportParseError(lexicalHnd->errorString());
-
7897 return false;
never executed: return false;
0
7898 } -
7899 }
executed: }
Execution Count:2
2
7900 return true;
executed: return true;
Execution Count:2822
2822
7901} -
7902 -
7903/* -
7904 This private function moves the cursor to the next character. -
7905*/ -
7906void QXmlSimpleReaderPrivate::next() -
7907{ -
7908 int count = xmlRefStack.size();
executed (the execution status of this line is deduced): int count = xmlRefStack.size();
-
7909 while (count != 0) {
evaluated: count != 0
TRUEFALSE
yes
Evaluation Count:14215
yes
Evaluation Count:3214231
14215-3214231
7910 if (xmlRefStack.top().isEmpty()) {
evaluated: xmlRefStack.top().isEmpty()
TRUEFALSE
yes
Evaluation Count:2798
yes
Evaluation Count:11417
2798-11417
7911 xmlRefStack.pop_back();
executed (the execution status of this line is deduced): xmlRefStack.pop_back();
-
7912 count--;
executed (the execution status of this line is deduced): count--;
-
7913 } else {
executed: }
Execution Count:2798
2798
7914 c = xmlRefStack.top().next();
executed (the execution status of this line is deduced): c = xmlRefStack.top().next();
-
7915 return;
executed: return;
Execution Count:11417
11417
7916 } -
7917 } -
7918 -
7919 // the following could be written nicer, but since it is a time-critical -
7920 // function, rather optimize for speed -
7921 ushort uc = c.unicode();
executed (the execution status of this line is deduced): ushort uc = c.unicode();
-
7922 c = inputSource->next();
executed (the execution status of this line is deduced): c = inputSource->next();
-
7923 // If we are not incremental parsing, we just skip over EndOfData chars to give the -
7924 // parser an uninterrupted stream of document chars. -
7925 if (c == QXmlInputSource::EndOfData && parseStack == 0)
evaluated: c == QXmlInputSource::EndOfData
TRUEFALSE
yes
Evaluation Count:51383
yes
Evaluation Count:3162848
evaluated: parseStack == 0
TRUEFALSE
yes
Evaluation Count:6475
yes
Evaluation Count:44908
6475-3162848
7926 c = inputSource->next();
executed: c = inputSource->next();
Execution Count:6475
6475
7927 if (uc == '\n') {
evaluated: uc == '\n'
TRUEFALSE
yes
Evaluation Count:81113
yes
Evaluation Count:3133118
81113-3133118
7928 lineNr++;
executed (the execution status of this line is deduced): lineNr++;
-
7929 columnNr = -1;
executed (the execution status of this line is deduced): columnNr = -1;
-
7930 } else if (uc == '\r') {
executed: }
Execution Count:81113
evaluated: uc == '\r'
TRUEFALSE
yes
Evaluation Count:23975
yes
Evaluation Count:3109143
23975-3109143
7931 if (c != QLatin1Char('\n')) {
evaluated: c != QLatin1Char('\n')
TRUEFALSE
yes
Evaluation Count:2548
yes
Evaluation Count:21427
2548-21427
7932 lineNr++;
executed (the execution status of this line is deduced): lineNr++;
-
7933 columnNr = -1;
executed (the execution status of this line is deduced): columnNr = -1;
-
7934 }
executed: }
Execution Count:2548
2548
7935 }
executed: }
Execution Count:23975
23975
7936 ++columnNr;
executed (the execution status of this line is deduced): ++columnNr;
-
7937}
executed: }
Execution Count:3214231
3214231
7938 -
7939/* -
7940 This private function moves the cursor to the next non-whitespace character. -
7941 This function does not move the cursor if the actual cursor position is a -
7942 non-whitespace charcter. -
7943 -
7944 Returns false when you use incremental parsing and this function reaches EOF -
7945 with reading only whitespace characters. In this case it also poplulates the -
7946 parseStack with useful information. In all other cases, this function returns -
7947 true. -
7948*/ -
7949bool QXmlSimpleReaderPrivate::eat_ws() -
7950{ -
7951 while (!atEnd()) {
evaluated: !atEnd()
TRUEFALSE
yes
Evaluation Count:143459
yes
Evaluation Count:10486
10486-143459
7952 if (!is_S(c)) {
evaluated: !is_S(c)
TRUEFALSE
yes
Evaluation Count:82136
yes
Evaluation Count:61323
61323-82136
7953 return true;
executed: return true;
Execution Count:82136
82136
7954 } -
7955 next();
executed (the execution status of this line is deduced): next();
-
7956 }
executed: }
Execution Count:61323
61323
7957 if (parseStack != 0) {
evaluated: parseStack != 0
TRUEFALSE
yes
Evaluation Count:10088
yes
Evaluation Count:398
398-10088
7958 unexpectedEof(&QXmlSimpleReaderPrivate::eat_ws, 0);
executed (the execution status of this line is deduced): unexpectedEof(&QXmlSimpleReaderPrivate::eat_ws, 0);
-
7959 return false;
executed: return false;
Execution Count:10088
10088
7960 } -
7961 return true;
executed: return true;
Execution Count:398
398
7962} -
7963 -
7964bool QXmlSimpleReaderPrivate::next_eat_ws() -
7965{ -
7966 next();
executed (the execution status of this line is deduced): next();
-
7967 return eat_ws();
executed: return eat_ws();
Execution Count:34025
34025
7968} -
7969 -
7970 -
7971/* -
7972 This private function initializes the reader. \a i is the input source to -
7973 read the data from. -
7974*/ -
7975void QXmlSimpleReaderPrivate::init(const QXmlInputSource *i) -
7976{ -
7977 lineNr = 0;
executed (the execution status of this line is deduced): lineNr = 0;
-
7978 columnNr = -1;
executed (the execution status of this line is deduced): columnNr = -1;
-
7979 inputSource = const_cast<QXmlInputSource *>(i);
executed (the execution status of this line is deduced): inputSource = const_cast<QXmlInputSource *>(i);
-
7980 initData();
executed (the execution status of this line is deduced): initData();
-
7981 -
7982 externParameterEntities.clear();
executed (the execution status of this line is deduced): externParameterEntities.clear();
-
7983 parameterEntities.clear();
executed (the execution status of this line is deduced): parameterEntities.clear();
-
7984 externEntities.clear();
executed (the execution status of this line is deduced): externEntities.clear();
-
7985 entities.clear();
executed (the execution status of this line is deduced): entities.clear();
-
7986 -
7987 tags.clear();
executed (the execution status of this line is deduced): tags.clear();
-
7988 -
7989 doctype.clear();
executed (the execution status of this line is deduced): doctype.clear();
-
7990 xmlVersion.clear();
executed (the execution status of this line is deduced): xmlVersion.clear();
-
7991 encoding.clear();
executed (the execution status of this line is deduced): encoding.clear();
-
7992 standalone = QXmlSimpleReaderPrivate::Unknown;
executed (the execution status of this line is deduced): standalone = QXmlSimpleReaderPrivate::Unknown;
-
7993 error.clear();
executed (the execution status of this line is deduced): error.clear();
-
7994}
executed: }
Execution Count:2245
2245
7995 -
7996/* -
7997 This private function initializes the XML data related variables. Especially, -
7998 it reads the data from the input source. -
7999*/ -
8000void QXmlSimpleReaderPrivate::initData() -
8001{ -
8002 c = QXmlInputSource::EndOfData;
executed (the execution status of this line is deduced): c = QXmlInputSource::EndOfData;
-
8003 xmlRefStack.clear();
executed (the execution status of this line is deduced): xmlRefStack.clear();
-
8004 next();
executed (the execution status of this line is deduced): next();
-
8005}
executed: }
Execution Count:47153
47153
8006 -
8007/* -
8008 Returns true if a entity with the name \a e exists, -
8009 otherwise returns false. -
8010*/ -
8011bool QXmlSimpleReaderPrivate::entityExist(const QString& e) const -
8012{ -
8013 if ( parameterEntities.find(e) == parameterEntities.end() &&
evaluated: parameterEntities.find(e) == parameterEntities.end()
TRUEFALSE
yes
Evaluation Count:873
yes
Evaluation Count:10
10-873
8014 externParameterEntities.find(e) == externParameterEntities.end() &&
partially evaluated: externParameterEntities.find(e) == externParameterEntities.end()
TRUEFALSE
yes
Evaluation Count:873
no
Evaluation Count:0
0-873
8015 externEntities.find(e) == externEntities.end() &&
partially evaluated: externEntities.find(e) == externEntities.end()
TRUEFALSE
yes
Evaluation Count:873
no
Evaluation Count:0
0-873
8016 entities.find(e) == entities.end()) {
evaluated: entities.find(e) == entities.end()
TRUEFALSE
yes
Evaluation Count:847
yes
Evaluation Count:26
26-847
8017 return false;
executed: return false;
Execution Count:847
847
8018 } else { -
8019 return true;
executed: return true;
Execution Count:36
36
8020 } -
8021} -
8022 -
8023void QXmlSimpleReaderPrivate::reportParseError(const QString& error) -
8024{ -
8025 this->error = error;
executed (the execution status of this line is deduced): this->error = error;
-
8026 if (errorHnd) {
partially evaluated: errorHnd
TRUEFALSE
yes
Evaluation Count:158
no
Evaluation Count:0
0-158
8027 if (this->error.isNull()) {
partially evaluated: this->error.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:158
0-158
8028 const QXmlParseException ex(QLatin1String(XMLERR_OK), columnNr+1, lineNr+1,
never executed (the execution status of this line is deduced): const QXmlParseException ex(QLatin1String("no error occurred"), columnNr+1, lineNr+1,
-
8029 thisPublicId, thisSystemId);
never executed (the execution status of this line is deduced): thisPublicId, thisSystemId);
-
8030 errorHnd->fatalError(ex);
never executed (the execution status of this line is deduced): errorHnd->fatalError(ex);
-
8031 } else {
never executed: }
0
8032 const QXmlParseException ex(this->error, columnNr+1, lineNr+1,
executed (the execution status of this line is deduced): const QXmlParseException ex(this->error, columnNr+1, lineNr+1,
-
8033 thisPublicId, thisSystemId);
executed (the execution status of this line is deduced): thisPublicId, thisSystemId);
-
8034 errorHnd->fatalError(ex);
executed (the execution status of this line is deduced): errorHnd->fatalError(ex);
-
8035 }
executed: }
Execution Count:158
158
8036 } -
8037}
executed: }
Execution Count:158
158
8038 -
8039/* -
8040 This private function is called when a parsing function encounters an -
8041 unexpected EOF. It decides what to do (depending on incremental parsing or -
8042 not). \a where is a pointer to the function where the error occurred and \a -
8043 state is the parsing state in this function. -
8044*/ -
8045void QXmlSimpleReaderPrivate::unexpectedEof(ParseFunction where, int state) -
8046{ -
8047 if (parseStack == 0) {
evaluated: parseStack == 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:44467
12-44467
8048 reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF));
executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected end of file"));
-
8049 } else {
executed: }
Execution Count:12
12
8050 if (c == QXmlInputSource::EndOfDocument) {
partially evaluated: c == QXmlInputSource::EndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44467
0-44467
8051 reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF));
never executed (the execution status of this line is deduced): reportParseError(QLatin1String("unexpected end of file"));
-
8052 } else {
never executed: }
0
8053 pushParseState(where, state);
executed (the execution status of this line is deduced): pushParseState(where, state);
-
8054 }
executed: }
Execution Count:44467
44467
8055 } -
8056} -
8057 -
8058/* -
8059 This private function is called when a parse...() function returned false. It -
8060 determines if there was an error or if incremental parsing simply went out of -
8061 data and does the right thing for the case. \a where is a pointer to the -
8062 function where the error occurred and \a state is the parsing state in this -
8063 function. -
8064*/ -
8065void QXmlSimpleReaderPrivate::parseFailed(ParseFunction where, int state) -
8066{ -
8067 if (parseStack!=0 && error.isNull()) {
evaluated: parseStack!=0
TRUEFALSE
yes
Evaluation Count:111660
yes
Evaluation Count:331
partially evaluated: error.isNull()
TRUEFALSE
yes
Evaluation Count:111660
no
Evaluation Count:0
0-111660
8068 pushParseState(where, state);
executed (the execution status of this line is deduced): pushParseState(where, state);
-
8069 }
executed: }
Execution Count:111660
111660
8070}
executed: }
Execution Count:111991
111991
8071 -
8072/* -
8073 This private function pushes the function pointer \a function and state \a -
8074 state to the parse stack. This is used when you are doing an incremental -
8075 parsing and reach the end of file too early. -
8076 -
8077 Only call this function when d->parseStack!=0. -
8078*/ -
8079void QXmlSimpleReaderPrivate::pushParseState(ParseFunction function, int state) -
8080{ -
8081 QXmlSimpleReaderPrivate::ParseState ps;
executed (the execution status of this line is deduced): QXmlSimpleReaderPrivate::ParseState ps;
-
8082 ps.function = function;
executed (the execution status of this line is deduced): ps.function = function;
-
8083 ps.state = state;
executed (the execution status of this line is deduced): ps.state = state;
-
8084 parseStack->push(ps);
executed (the execution status of this line is deduced): parseStack->push(ps);
-
8085}
executed: }
Execution Count:201035
201035
8086 -
8087inline static void updateValue(QString &value, const QChar *array, int &arrayPos, int &valueLen) -
8088{ -
8089 value.resize(valueLen + arrayPos);
executed (the execution status of this line is deduced): value.resize(valueLen + arrayPos);
-
8090 memcpy(value.data() + valueLen, array, arrayPos * sizeof(QChar));
executed (the execution status of this line is deduced): memcpy(value.data() + valueLen, array, arrayPos * sizeof(QChar));
-
8091 valueLen += arrayPos;
executed (the execution status of this line is deduced): valueLen += arrayPos;
-
8092 arrayPos = 0;
executed (the execution status of this line is deduced): arrayPos = 0;
-
8093}
executed: }
Execution Count:287706
287706
8094 -
8095// use buffers instead of QString::operator+= when single characters are read -
8096const QString& QXmlSimpleReaderPrivate::string() -
8097{ -
8098 updateValue(stringValue, stringArray, stringArrayPos, stringValueLen);
executed (the execution status of this line is deduced): updateValue(stringValue, stringArray, stringArrayPos, stringValueLen);
-
8099 return stringValue;
executed: return stringValue;
Execution Count:148829
148829
8100} -
8101const QString& QXmlSimpleReaderPrivate::name() -
8102{ -
8103 updateValue(nameValue, nameArray, nameArrayPos, nameValueLen);
executed (the execution status of this line is deduced): updateValue(nameValue, nameArray, nameArrayPos, nameValueLen);
-
8104 return nameValue;
executed: return nameValue;
Execution Count:119204
119204
8105} -
8106const QString& QXmlSimpleReaderPrivate::ref() -
8107{ -
8108 updateValue(refValue, refArray, refArrayPos, refValueLen);
executed (the execution status of this line is deduced): updateValue(refValue, refArray, refArrayPos, refValueLen);
-
8109 return refValue;
executed: return refValue;
Execution Count:17665
17665
8110} -
8111 -
8112void QXmlSimpleReaderPrivate::stringAddC(QChar ch) -
8113{ -
8114 if (stringArrayPos == 256)
evaluated: stringArrayPos == 256
TRUEFALSE
yes
Evaluation Count:2008
yes
Evaluation Count:2189263
2008-2189263
8115 updateValue(stringValue, stringArray, stringArrayPos, stringValueLen);
executed: updateValue(stringValue, stringArray, stringArrayPos, stringValueLen);
Execution Count:2008
2008
8116 stringArray[stringArrayPos++] = ch;
executed (the execution status of this line is deduced): stringArray[stringArrayPos++] = ch;
-
8117}
executed: }
Execution Count:2191271
2191271
8118void QXmlSimpleReaderPrivate::nameAddC(QChar ch) -
8119{ -
8120 if (nameArrayPos == 256)
partially evaluated: nameArrayPos == 256
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:448708
0-448708
8121 updateValue(nameValue, nameArray, nameArrayPos, nameValueLen);
never executed: updateValue(nameValue, nameArray, nameArrayPos, nameValueLen);
0
8122 nameArray[nameArrayPos++] = ch;
executed (the execution status of this line is deduced): nameArray[nameArrayPos++] = ch;
-
8123}
executed: }
Execution Count:448708
448708
8124void QXmlSimpleReaderPrivate::refAddC(QChar ch) -
8125{ -
8126 if (refArrayPos == 256)
partially evaluated: refArrayPos == 256
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37949
0-37949
8127 updateValue(refValue, refArray, refArrayPos, refValueLen);
never executed: updateValue(refValue, refArray, refArrayPos, refValueLen);
0
8128 refArray[refArrayPos++] = ch;
executed (the execution status of this line is deduced): refArray[refArrayPos++] = ch;
-
8129}
executed: }
Execution Count:37949
37949
8130QT_END_NAMESPACE -
8131 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial