qmimetypeparser.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/mimetypes/qmimetypeparser.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10static const char mimeInfoTagC[] = "mime-info";-
11static const char mimeTypeTagC[] = "mime-type";-
12static const char mimeTypeAttributeC[] = "type";-
13static const char subClassTagC[] = "sub-class-of";-
14static const char commentTagC[] = "comment";-
15static const char genericIconTagC[] = "generic-icon";-
16static const char iconTagC[] = "icon";-
17static const char nameAttributeC[] = "name";-
18static const char globTagC[] = "glob";-
19static const char aliasTagC[] = "alias";-
20static const char patternAttributeC[] = "pattern";-
21static const char weightAttributeC[] = "weight";-
22static const char caseSensitiveAttributeC[] = "case-sensitive";-
23static const char localeAttributeC[] = "xml:lang";-
24-
25static const char magicTagC[] = "magic";-
26static const char priorityAttributeC[] = "priority";-
27-
28static const char matchTagC[] = "match";-
29static const char matchValueAttributeC[] = "value";-
30static const char matchTypeAttributeC[] = "type";-
31static const char matchOffsetAttributeC[] = "offset";-
32static const char matchMaskAttributeC[] = "mask";-
33QMimeTypeParserBase::ParseState QMimeTypeParserBase::nextState(ParseState currentState, const QStringRef &startElement)-
34{-
35 switch (currentState) {-
36 case
executed 17 times by 1 test: case ParseBeginning:
Executed by:
  • tst_QMimeDatabase
ParseBeginning:
executed 17 times by 1 test: case ParseBeginning:
Executed by:
  • tst_QMimeDatabase
17
37 if (startElement == QLatin1String(mimeInfoTagC)
startElement =...(mimeInfoTagC)Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
)
0-17
38 return
executed 17 times by 1 test: return ParseMimeInfo;
Executed by:
  • tst_QMimeDatabase
ParseMimeInfo;
executed 17 times by 1 test: return ParseMimeInfo;
Executed by:
  • tst_QMimeDatabase
17
39 if (startElement == QLatin1String(mimeTypeTagC)
startElement =...(mimeTypeTagC)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
40 return
never executed: return ParseMimeType;
ParseMimeType;
never executed: return ParseMimeType;
0
41 return
never executed: return ParseError;
ParseError;
never executed: return ParseError;
0
42 case
executed 17 times by 1 test: case ParseMimeInfo:
Executed by:
  • tst_QMimeDatabase
ParseMimeInfo:
executed 17 times by 1 test: case ParseMimeInfo:
Executed by:
  • tst_QMimeDatabase
17
43 return
executed 17 times by 1 test: return startElement == QLatin1String(mimeTypeTagC) ? ParseMimeType : ParseError;
Executed by:
  • tst_QMimeDatabase
startElement == QLatin1String(mimeTypeTagC)
startElement =...(mimeTypeTagC)Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
? ParseMimeType : ParseError;
executed 17 times by 1 test: return startElement == QLatin1String(mimeTypeTagC) ? ParseMimeType : ParseError;
Executed by:
  • tst_QMimeDatabase
0-17
44 case
executed 3319 times by 1 test: case ParseMimeType:
Executed by:
  • tst_QMimeDatabase
ParseMimeType:
executed 3319 times by 1 test: case ParseMimeType:
Executed by:
  • tst_QMimeDatabase
3319
45 case
executed 134104 times by 1 test: case ParseComment:
Executed by:
  • tst_QMimeDatabase
ParseComment:
executed 134104 times by 1 test: case ParseComment:
Executed by:
  • tst_QMimeDatabase
134104
46 case
executed 1575 times by 1 test: case ParseGenericIcon:
Executed by:
  • tst_QMimeDatabase
ParseGenericIcon:
executed 1575 times by 1 test: case ParseGenericIcon:
Executed by:
  • tst_QMimeDatabase
1575
47 case
never executed: case ParseIcon:
ParseIcon:
never executed: case ParseIcon:
0
48 case
executed 4132 times by 1 test: case ParseGlobPattern:
Executed by:
  • tst_QMimeDatabase
ParseGlobPattern:
executed 4132 times by 1 test: case ParseGlobPattern:
Executed by:
  • tst_QMimeDatabase
4132
49 case
executed 1560 times by 1 test: case ParseSubClass:
Executed by:
  • tst_QMimeDatabase
ParseSubClass:
executed 1560 times by 1 test: case ParseSubClass:
Executed by:
  • tst_QMimeDatabase
1560
50 case
executed 975 times by 1 test: case ParseAlias:
Executed by:
  • tst_QMimeDatabase
ParseAlias:
executed 975 times by 1 test: case ParseAlias:
Executed by:
  • tst_QMimeDatabase
975
51 case
executed 1825 times by 1 test: case ParseOtherMimeTypeSubTag:
Executed by:
  • tst_QMimeDatabase
ParseOtherMimeTypeSubTag:
executed 1825 times by 1 test: case ParseOtherMimeTypeSubTag:
Executed by:
  • tst_QMimeDatabase
1825
52 case
executed 4052 times by 1 test: case ParseMagicMatchRule:
Executed by:
  • tst_QMimeDatabase
ParseMagicMatchRule:
executed 4052 times by 1 test: case ParseMagicMatchRule:
Executed by:
  • tst_QMimeDatabase
4052
53 if (startElement == QLatin1String(mimeTypeTagC)
startElement =...(mimeTypeTagC)Description
TRUEevaluated 3302 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 148240 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
3302-148240
54 return
executed 3302 times by 1 test: return ParseMimeType;
Executed by:
  • tst_QMimeDatabase
ParseMimeType;
executed 3302 times by 1 test: return ParseMimeType;
Executed by:
  • tst_QMimeDatabase
3302
55 if (startElement == QLatin1String(commentTagC )
startElement =...(commentTagC )Description
TRUEevaluated 134104 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 14136 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
14136-134104
56 return
executed 134104 times by 1 test: return ParseComment;
Executed by:
  • tst_QMimeDatabase
ParseComment;
executed 134104 times by 1 test: return ParseComment;
Executed by:
  • tst_QMimeDatabase
134104
57 if (startElement == QLatin1String(genericIconTagC)
startElement =...nericIconTagC)Description
TRUEevaluated 1575 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 12561 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
1575-12561
58 return
executed 1575 times by 1 test: return ParseGenericIcon;
Executed by:
  • tst_QMimeDatabase
ParseGenericIcon;
executed 1575 times by 1 test: return ParseGenericIcon;
Executed by:
  • tst_QMimeDatabase
1575
59 if (startElement == QLatin1String(iconTagC)
startElement =...ring(iconTagC)Description
TRUEnever evaluated
FALSEevaluated 12561 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
0-12561
60 return
never executed: return ParseIcon;
ParseIcon;
never executed: return ParseIcon;
0
61 if (startElement == QLatin1String(globTagC)
startElement =...ring(globTagC)Description
TRUEevaluated 4136 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 8425 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
4136-8425
62 return
executed 4136 times by 1 test: return ParseGlobPattern;
Executed by:
  • tst_QMimeDatabase
ParseGlobPattern;
executed 4136 times by 1 test: return ParseGlobPattern;
Executed by:
  • tst_QMimeDatabase
4136
63 if (startElement == QLatin1String(subClassTagC)
startElement =...(subClassTagC)Description
TRUEevaluated 1560 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 6865 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
1560-6865
64 return
executed 1560 times by 1 test: return ParseSubClass;
Executed by:
  • tst_QMimeDatabase
ParseSubClass;
executed 1560 times by 1 test: return ParseSubClass;
Executed by:
  • tst_QMimeDatabase
1560
65 if (startElement == QLatin1String(aliasTagC)
startElement =...ing(aliasTagC)Description
TRUEevaluated 975 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 5890 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
975-5890
66 return
executed 975 times by 1 test: return ParseAlias;
Executed by:
  • tst_QMimeDatabase
ParseAlias;
executed 975 times by 1 test: return ParseAlias;
Executed by:
  • tst_QMimeDatabase
975
67 if (startElement == QLatin1String(magicTagC)
startElement =...ing(magicTagC)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 4157 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
1733-4157
68 return
executed 1733 times by 1 test: return ParseMagic;
Executed by:
  • tst_QMimeDatabase
ParseMagic;
executed 1733 times by 1 test: return ParseMagic;
Executed by:
  • tst_QMimeDatabase
1733
69 if (startElement == QLatin1String(matchTagC)
startElement =...ing(matchTagC)Description
TRUEevaluated 2325 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 1832 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
1832-2325
70 return
executed 2325 times by 1 test: return ParseMagicMatchRule;
Executed by:
  • tst_QMimeDatabase
ParseMagicMatchRule;
executed 2325 times by 1 test: return ParseMagicMatchRule;
Executed by:
  • tst_QMimeDatabase
2325
71 return
executed 1832 times by 1 test: return ParseOtherMimeTypeSubTag;
Executed by:
  • tst_QMimeDatabase
ParseOtherMimeTypeSubTag;
executed 1832 times by 1 test: return ParseOtherMimeTypeSubTag;
Executed by:
  • tst_QMimeDatabase
1832
72 case
executed 1733 times by 1 test: case ParseMagic:
Executed by:
  • tst_QMimeDatabase
ParseMagic:
executed 1733 times by 1 test: case ParseMagic:
Executed by:
  • tst_QMimeDatabase
1733
73 if (startElement == QLatin1String(matchTagC)
startElement =...ing(matchTagC)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
)
0-1733
74 return
executed 1733 times by 1 test: return ParseMagicMatchRule;
Executed by:
  • tst_QMimeDatabase
ParseMagicMatchRule;
executed 1733 times by 1 test: return ParseMagicMatchRule;
Executed by:
  • tst_QMimeDatabase
1733
75 break;
never executed: break;
0
76 case
never executed: case ParseError:
ParseError:
never executed: case ParseError:
0
77 break;
never executed: break;
0
78 }-
79 return
never executed: return ParseError;
ParseError;
never executed: return ParseError;
0
80}-
81-
82-
83bool QMimeTypeParserBase::parseNumber(const QString &n, int *target, QString *errorMessage)-
84{-
85 bool ok;-
86 *target = n.toInt(&ok);-
87 if (!ok
!okDescription
TRUEnever evaluated
FALSEevaluated 9733 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
0-9733
88 *errorMessage = QString::fromLatin1("Not a number '%1'.").arg(n);-
89 return
never executed: return false;
false;
never executed: return false;
0
90 }-
91 return
executed 9733 times by 1 test: return true;
Executed by:
  • tst_QMimeDatabase
true;
executed 9733 times by 1 test: return true;
Executed by:
  • tst_QMimeDatabase
9733
92}-
93-
94-
95static QMimeMagicRule *createMagicMatchRule(const QXmlStreamAttributes &atts, QString *errorMessage)-
96{-
97 const QString type = atts.value(QLatin1String(matchTypeAttributeC)).toString();-
98 const QString value = atts.value(QLatin1String(matchValueAttributeC)).toString();-
99 const QString offsets = atts.value(QLatin1String(matchOffsetAttributeC)).toString();-
100 const QString mask = atts.value(QLatin1String(matchMaskAttributeC)).toString();-
101 return
executed 4058 times by 1 test: return new QMimeMagicRule(type, value.toUtf8(), offsets, mask.toLatin1(), errorMessage);
Executed by:
  • tst_QMimeDatabase
new QMimeMagicRule(type, value.toUtf8(), offsets, mask.toLatin1(), errorMessage);
executed 4058 times by 1 test: return new QMimeMagicRule(type, value.toUtf8(), offsets, mask.toLatin1(), errorMessage);
Executed by:
  • tst_QMimeDatabase
4058
102}-
103-
104-
105bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString *errorMessage)-
106{-
107-
108-
109-
110-
111-
112 QMimeTypePrivate data;-
113 int priority = 50;-
114 QStack<QMimeMagicRule *> currentRules;-
115 QList<QMimeMagicRule> rules;-
116 QXmlStreamReader reader(dev);-
117 ParseState ps = ParseBeginning;-
118 QXmlStreamAttributes atts;-
119 while (!reader.atEnd()
!reader.atEnd()Description
TRUEevaluated 333413 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
17-333413
120 switch (reader.readNext()) {-
121 case
executed 153309 times by 1 test: case QXmlStreamReader::StartElement:
Executed by:
  • tst_QMimeDatabase
QXmlStreamReader::StartElement:
executed 153309 times by 1 test: case QXmlStreamReader::StartElement:
Executed by:
  • tst_QMimeDatabase
153309
122 ps = nextState(ps, reader.name());-
123 atts = reader.attributes();-
124 switch (ps) {-
125 case
executed 3319 times by 1 test: case ParseMimeType:
Executed by:
  • tst_QMimeDatabase
ParseMimeType:
executed 3319 times by 1 test: case ParseMimeType:
Executed by:
  • tst_QMimeDatabase
{
3319
126 const QString name = atts.value(QLatin1String(mimeTypeAttributeC)).toString();-
127 if (name.isEmpty()
name.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 3319 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
0-3319
128 reader.raiseError(QString::fromLatin1("Missing '%1'-attribute").arg(QString::fromLatin1(mimeTypeAttributeC)));-
129 }
never executed: end of block
else {
0
130 data.name = name;-
131 }
executed 3319 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
3319
132 }-
133 break;
executed 3319 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
3319
134 case
executed 1575 times by 1 test: case ParseGenericIcon:
Executed by:
  • tst_QMimeDatabase
ParseGenericIcon:
executed 1575 times by 1 test: case ParseGenericIcon:
Executed by:
  • tst_QMimeDatabase
1575
135 data.genericIconName = atts.value(QLatin1String(nameAttributeC)).toString();-
136 break;
executed 1575 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
1575
137 case
never executed: case ParseIcon:
ParseIcon:
never executed: case ParseIcon:
0
138 data.iconName = atts.value(QLatin1String(nameAttributeC)).toString();-
139 break;
never executed: break;
0
140 case
executed 4136 times by 1 test: case ParseGlobPattern:
Executed by:
  • tst_QMimeDatabase
ParseGlobPattern:
executed 4136 times by 1 test: case ParseGlobPattern:
Executed by:
  • tst_QMimeDatabase
{
4136
141 const QString pattern = atts.value(QLatin1String(patternAttributeC)).toString();-
142 unsigned weight = atts.value(QLatin1String(weightAttributeC)).toString().toInt();-
143 const bool caseSensitive = atts.value(QLatin1String(caseSensitiveAttributeC)).toString() == QLatin1String("true");-
144-
145 if (weight == 0
weight == 0Description
TRUEevaluated 4126 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
10-4126
146 weight = QMimeGlobPattern::DefaultWeight;
executed 4126 times by 1 test: weight = QMimeGlobPattern::DefaultWeight;
Executed by:
  • tst_QMimeDatabase
4126
147-
148 ((!(!data.name.isEmpty())) ? qt_assert("!data.name.isEmpty()",__FILE__,222) : qt_noop());-
149 const QMimeGlobPattern glob(pattern, data.name, weight, caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);-
150 if (!process(glob, errorMessage)
!process(glob, errorMessage)Description
TRUEnever evaluated
FALSEevaluated 4136 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
0-4136
151 return
never executed: return false;
false;
never executed: return false;
0
152 data.addGlobPattern(pattern);-
153 }-
154 break;
executed 4136 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
4136
155 case
executed 1560 times by 1 test: case ParseSubClass:
Executed by:
  • tst_QMimeDatabase
ParseSubClass:
executed 1560 times by 1 test: case ParseSubClass:
Executed by:
  • tst_QMimeDatabase
{
1560
156 const QString inheritsFrom = atts.value(QLatin1String(mimeTypeAttributeC)).toString();-
157 if (!inheritsFrom.isEmpty()
!inheritsFrom.isEmpty()Description
TRUEevaluated 1560 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
)
0-1560
158 processParent(data.name, inheritsFrom);
executed 1560 times by 1 test: processParent(data.name, inheritsFrom);
Executed by:
  • tst_QMimeDatabase
1560
159 }-
160 break;
executed 1560 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
1560
161 case
executed 134104 times by 1 test: case ParseComment:
Executed by:
  • tst_QMimeDatabase
ParseComment:
executed 134104 times by 1 test: case ParseComment:
Executed by:
  • tst_QMimeDatabase
{
134104
162-
163 QString locale = atts.value(QLatin1String(localeAttributeC)).toString();-
164 const QString comment = reader.readElementText();-
165 if (locale.isEmpty()
locale.isEmpty()Description
TRUEevaluated 3319 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 130785 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
3319-130785
166 locale = QString::fromLatin1("en_US");
executed 3319 times by 1 test: locale = QString::fromLatin1("en_US");
Executed by:
  • tst_QMimeDatabase
3319
167 data.localeComments.insert(locale, comment);-
168 }-
169 break;
executed 134104 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
134104
170 case
executed 975 times by 1 test: case ParseAlias:
Executed by:
  • tst_QMimeDatabase
ParseAlias:
executed 975 times by 1 test: case ParseAlias:
Executed by:
  • tst_QMimeDatabase
{
975
171 const QString alias = atts.value(QLatin1String(mimeTypeAttributeC)).toString();-
172 if (!alias.isEmpty()
!alias.isEmpty()Description
TRUEevaluated 975 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
)
0-975
173 processAlias(alias, data.name);
executed 975 times by 1 test: processAlias(alias, data.name);
Executed by:
  • tst_QMimeDatabase
975
174 }-
175 break;
executed 975 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
975
176 case
executed 1733 times by 1 test: case ParseMagic:
Executed by:
  • tst_QMimeDatabase
ParseMagic:
executed 1733 times by 1 test: case ParseMagic:
Executed by:
  • tst_QMimeDatabase
{
1733
177 priority = 50;-
178 const QString priorityS = atts.value(QLatin1String(priorityAttributeC)).toString();-
179 if (!priorityS.isEmpty()
!priorityS.isEmpty()Description
TRUEevaluated 1617 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 116 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
116-1617
180 if (!parseNumber(priorityS, &priority, errorMessage)
!parseNumber(p... errorMessage)Description
TRUEnever evaluated
FALSEevaluated 1617 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
0-1617
181 return
never executed: return false;
false;
never executed: return false;
0
182-
183 }
executed 1617 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
1617
184 currentRules.clear();-
185-
186 }-
187 break;
executed 1733 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
1733
188 case
executed 4058 times by 1 test: case ParseMagicMatchRule:
Executed by:
  • tst_QMimeDatabase
ParseMagicMatchRule:
executed 4058 times by 1 test: case ParseMagicMatchRule:
Executed by:
  • tst_QMimeDatabase
{
4058
189 QString magicErrorMessage;-
190 QMimeMagicRule *rule = createMagicMatchRule(atts, &magicErrorMessage);-
191 if (!rule->isValid()
!rule->isValid()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 4052 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
6-4052
192 QMessageLogger(__FILE__, 266, __PRETTY_FUNCTION__).warning("QMimeDatabase: Error parsing %s\n%s", QString(fileName).toLocal8Bit().constData(), QString(magicErrorMessage).toLocal8Bit().constData());
executed 6 times by 1 test: QMessageLogger(__FILE__, 266, __PRETTY_FUNCTION__).warning("QMimeDatabase: Error parsing %s\n%s", QString(fileName).toLocal8Bit().constData(), QString(magicErrorMessage).toLocal8Bit().constData());
Executed by:
  • tst_QMimeDatabase
6
193 QList<QMimeMagicRule> *ruleList;-
194 if (currentRules.isEmpty()
currentRules.isEmpty()Description
TRUEevaluated 3018 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 1040 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
1040-3018
195 ruleList = &rules;
executed 3018 times by 1 test: ruleList = &rules;
Executed by:
  • tst_QMimeDatabase
3018
196 else-
197 ruleList = &currentRules.top()->m_subMatches;
executed 1040 times by 1 test: ruleList = &currentRules.top()->m_subMatches;
Executed by:
  • tst_QMimeDatabase
1040
198 ruleList->append(*rule);-
199-
200 currentRules.push(&ruleList->last());-
201 delete rule;-
202 break;
executed 4058 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
4058
203 }-
204 case
never executed: case ParseError:
ParseError:
never executed: case ParseError:
0
205 reader.raiseError(QString::fromLatin1("Unexpected element <%1>").-
206 arg(reader.name().toString()));-
207 break;
never executed: break;
0
208 default
executed 1849 times by 1 test: default:
Executed by:
  • tst_QMimeDatabase
:
executed 1849 times by 1 test: default:
Executed by:
  • tst_QMimeDatabase
1849
209 break;
executed 1849 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
1849
210 }-
211 break;
executed 153309 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
153309
212-
213 case
executed 19205 times by 1 test: case QXmlStreamReader::EndElement:
Executed by:
  • tst_QMimeDatabase
QXmlStreamReader::EndElement:
executed 19205 times by 1 test: case QXmlStreamReader::EndElement:
Executed by:
  • tst_QMimeDatabase
19205
214 {-
215 const QStringRef elementName = reader.name();-
216 if (elementName == QLatin1String(mimeTypeTagC)
elementName ==...(mimeTypeTagC)Description
TRUEevaluated 3319 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 15886 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
3319-15886
217 if (!process(QMimeType(data), errorMessage)
!process(QMime... errorMessage)Description
TRUEnever evaluated
FALSEevaluated 3319 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
)
0-3319
218 return
never executed: return false;
false;
never executed: return false;
0
219 data.clear();-
220 }
executed 3319 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
else if (elementName == QLatin1String(matchTagC)
elementName ==...ing(matchTagC)Description
TRUEevaluated 4058 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 11828 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
3319-11828
221-
222 currentRules.pop();-
223-
224 }
executed 4058 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
else if (elementName == QLatin1String(magicTagC)
elementName ==...ing(magicTagC)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 10095 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
1733-10095
225-
226-
227 QMimeMagicRuleMatcher ruleMatcher(data.name, priority);-
228 ruleMatcher.addRules(rules);-
229 processMagicMatcher(ruleMatcher);-
230 rules.clear();-
231 }
executed 1733 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
1733
232 break;
executed 19205 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
19205
233 }-
234 default
executed 160899 times by 1 test: default:
Executed by:
  • tst_QMimeDatabase
:
executed 160899 times by 1 test: default:
Executed by:
  • tst_QMimeDatabase
160899
235 break;
executed 160899 times by 1 test: break;
Executed by:
  • tst_QMimeDatabase
160899
236 }-
237 }-
238-
239 if (reader.hasError()
reader.hasError()Description
TRUEnever evaluated
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
) {
0-17
240 if (errorMessage
errorMessageDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
241 *
never executed: *errorMessage = QString::fromLatin1("An error has been encountered at line %1 of %2: %3:").arg(reader.lineNumber()).arg(fileName, reader.errorString());
errorMessage = QString::fromLatin1("An error has been encountered at line %1 of %2: %3:").arg(reader.lineNumber()).arg(fileName, reader.errorString());
never executed: *errorMessage = QString::fromLatin1("An error has been encountered at line %1 of %2: %3:").arg(reader.lineNumber()).arg(fileName, reader.errorString());
0
242 return
never executed: return false;
false;
never executed: return false;
0
243 }-
244-
245 return
executed 17 times by 1 test: return true;
Executed by:
  • tst_QMimeDatabase
true;
executed 17 times by 1 test: return true;
Executed by:
  • tst_QMimeDatabase
17
246-
247}-
248-
249-
Switch to Source codePreprocessed file

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