qmimetype.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/mimetypes/qmimetype.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>-
5** Contact: http://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL21$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see http://www.qt.io/terms-conditions. For further-
16** information use the contact form at http://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 2.1 or version 3 as published by the Free-
21** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
22** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
23** following information to ensure the GNU Lesser General Public License-
24** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
25** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
26**-
27** As a special exception, The Qt Company gives you certain additional-
28** rights. These rights are described in The Qt Company LGPL Exception-
29** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
30**-
31** $QT_END_LICENSE$-
32**-
33****************************************************************************/-
34-
35#include "qmimetype.h"-
36-
37#ifndef QT_NO_MIMETYPE-
38-
39#include "qmimetype_p.h"-
40#include "qmimedatabase_p.h"-
41#include "qmimeprovider_p.h"-
42-
43#include "qmimeglobpattern_p.h"-
44-
45#include <QtCore/QDebug>-
46#include <QtCore/QLocale>-
47#include <QtCore/QHashFunctions>-
48-
49#include <memory>-
50-
51QT_BEGIN_NAMESPACE-
52-
53QMimeTypePrivate::QMimeTypePrivate()-
54 : loaded(false)-
55{}
executed 5545 times by 3 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QMimeDatabase
  • tst_qmimetype
5545
56-
57QMimeTypePrivate::QMimeTypePrivate(const QMimeType &other)-
58 : loaded(other.d->loaded),-
59 name(other.d->name),-
60 localeComments(other.d->localeComments),-
61 genericIconName(other.d->genericIconName),-
62 iconName(other.d->iconName),-
63 globPatterns(other.d->globPatterns)-
64{}
never executed: end of block
0
65-
66void QMimeTypePrivate::clear()-
67{-
68 name.clear();-
69 localeComments.clear();-
70 genericIconName.clear();-
71 iconName.clear();-
72 globPatterns.clear();-
73 loaded = false;-
74}
executed 3319 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
3319
75-
76void QMimeTypePrivate::addGlobPattern(const QString &pattern)-
77{-
78 globPatterns.append(pattern);-
79}
executed 4136 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
4136
80-
81/*!-
82 \class QMimeType-
83 \inmodule QtCore-
84 \ingroup shared-
85 \brief The QMimeType class describes types of file or data, represented by a MIME type string.-
86-
87 \since 5.0-
88-
89 For instance a file named "readme.txt" has the MIME type "text/plain".-
90 The MIME type can be determined from the file name, or from the file-
91 contents, or from both. MIME type determination can also be done on-
92 buffers of data not coming from files.-
93-
94 Determining the MIME type of a file can be useful to make sure your-
95 application supports it. It is also useful in file-manager-like applications-
96 or widgets, in order to display an appropriate \l {QMimeType::iconName}{icon} for the file, or even-
97 the descriptive \l {QMimeType::comment()}{comment} in detailed views.-
98-
99 To check if a file has the expected MIME type, you should use inherits()-
100 rather than a simple string comparison based on the name(). This is because-
101 MIME types can inherit from each other: for instance a C source file is-
102 a specific type of plain text file, so text/x-csrc inherits text/plain.-
103-
104 \sa QMimeDatabase-
105 */-
106-
107/*!-
108 \fn QMimeType &QMimeType::operator=(QMimeType &&other)-
109-
110 Move-assigns \a other to this QMimeType instance.-
111-
112 \since 5.2-
113*/-
114-
115/*!-
116 \fn QMimeType::QMimeType();-
117 Constructs this QMimeType object initialized with default property values that indicate an invalid MIME type.-
118 */-
119QMimeType::QMimeType() :-
120 d(new QMimeTypePrivate())-
121{-
122}
executed 40 times by 3 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QMimeDatabase
  • tst_qmimetype
40
123-
124/*!-
125 \fn QMimeType::QMimeType(const QMimeType &other);-
126 Constructs this QMimeType object as a copy of \a other.-
127 */-
128QMimeType::QMimeType(const QMimeType &other) :-
129 d(other.d)-
130{-
131}
executed 12290 times by 2 tests: end of block
Executed by:
  • tst_QMimeDatabase
  • tst_qmimetype
12290
132-
133/*!-
134 \fn QMimeType &QMimeType::operator=(const QMimeType &other);-
135 Assigns the data of \a other to this QMimeType object, and returns a reference to this object.-
136 */-
137QMimeType &QMimeType::operator=(const QMimeType &other)-
138{-
139 if (d != other.d)
d != other.dDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
0-4
140 d = other.d;
executed 4 times by 1 test: d = other.d;
Executed by:
  • tst_QMimeDatabase
4
141 return *this;
executed 4 times by 1 test: return *this;
Executed by:
  • tst_QMimeDatabase
4
142}-
143-
144/*!-
145 \fn QMimeType::QMimeType(const QMimeTypePrivate &dd);-
146 Assigns the data of the QMimeTypePrivate \a dd to this QMimeType object, and returns a reference to this object.-
147 \internal-
148 */-
149QMimeType::QMimeType(const QMimeTypePrivate &dd) :-
150 d(new QMimeTypePrivate(dd))-
151{-
152}
executed 8807 times by 3 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QMimeDatabase
  • tst_qmimetype
8807
153-
154/*!-
155 \fn void QMimeType::swap(QMimeType &other);-
156 Swaps QMimeType \a other with this QMimeType object.-
157-
158 This operation is very fast and never fails.-
159-
160 The swap() method helps with the implementation of assignment-
161 operators in an exception-safe way. For more information consult-
162 \l {http://en.wikibooks.org/wiki/More_C++_Idioms/Copy-and-swap}-
163 {More C++ Idioms - Copy-and-swap}.-
164 */-
165-
166/*!-
167 \fn QMimeType::~QMimeType();-
168 Destroys the QMimeType object, and releases the d pointer.-
169 */-
170QMimeType::~QMimeType()-
171{-
172}-
173-
174/*!-
175 \fn bool QMimeType::operator==(const QMimeType &other) const;-
176 Returns \c true if \a other equals this QMimeType object, otherwise returns \c false.-
177 The name is the unique identifier for a mimetype, so two mimetypes with-
178 the same name, are equal.-
179 */-
180bool QMimeType::operator==(const QMimeType &other) const-
181{-
182 return d == other.d || d->name == other.d->name;
executed 3 times by 1 test: return d == other.d || d->name == other.d->name;
Executed by:
  • tst_qmimetype
d == other.dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qmimetype
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qmimetype
d->name == other.d->nameDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qmimetype
0-3
183}-
184-
185/*!-
186 \since 5.6-
187 \relates QMimeType-
188-
189 Returns the hash value for \a key, using-
190 \a seed to seed the calculation.-
191 */-
192uint qHash(const QMimeType &key, uint seed) Q_DECL_NOTHROW-
193{-
194 return qHash(key.d->name, seed);
never executed: return qHash(key.d->name, seed);
0
195}-
196-
197/*!-
198 \fn bool QMimeType::operator!=(const QMimeType &other) const;-
199 Returns \c true if \a other does not equal this QMimeType object, otherwise returns \c false.-
200 */-
201-
202/*!-
203 \fn bool QMimeType::isValid() const;-
204 Returns \c true if the QMimeType object contains valid data, otherwise returns \c false.-
205 A valid MIME type has a non-empty name().-
206 The invalid MIME type is the default-constructed QMimeType.-
207 */-
208bool QMimeType::isValid() const-
209{-
210 return !d->name.isEmpty();
executed 4265 times by 3 tests: return !d->name.isEmpty();
Executed by:
  • tst_QDebug
  • tst_QMimeDatabase
  • tst_qmimetype
4265
211}-
212-
213/*!-
214 \fn bool QMimeType::isDefault() const;-
215 Returns \c true if this MIME type is the default MIME type which-
216 applies to all files: application/octet-stream.-
217 */-
218bool QMimeType::isDefault() const-
219{-
220 return d->name == QMimeDatabasePrivate::instance()->defaultMimeType();
executed 18 times by 1 test: return d->name == QMimeDatabasePrivate::instance()->defaultMimeType();
Executed by:
  • tst_QMimeDatabase
18
221}-
222-
223/*!-
224 \fn QString QMimeType::name() const;-
225 Returns the name of the MIME type.-
226 */-
227QString QMimeType::name() const-
228{-
229 return d->name;
executed 12508 times by 3 tests: return d->name;
Executed by:
  • tst_QDebug
  • tst_QMimeDatabase
  • tst_qmimetype
12508
230}-
231-
232/*!-
233 Returns the description of the MIME type to be displayed on user interfaces.-
234-
235 The default language (QLocale().name()) is used to select the appropriate translation.-
236 */-
237QString QMimeType::comment() const-
238{-
239 QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);-
240-
241 QStringList languageList;-
242 languageList << QLocale().name();-
243 languageList << QLocale().uiLanguages();-
244 Q_FOREACH (const QString &language, languageList) {-
245 const QString lang = language == QLatin1String("C") ? QLatin1String("en_US") : language;
language == QLatin1String("C")Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
4-14
246 const QString comm = d->localeComments.value(lang);-
247 if (!comm.isEmpty())
!comm.isEmpty()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
4-14
248 return comm;
executed 14 times by 1 test: return comm;
Executed by:
  • tst_QMimeDatabase
14
249 const int pos = lang.indexOf(QLatin1Char('_'));-
250 if (pos != -1) {
pos != -1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
0-4
251 // "pt_BR" not found? try just "pt"-
252 const QString shortLang = lang.left(pos);-
253 const QString commShort = d->localeComments.value(shortLang);-
254 if (!commShort.isEmpty())
!commShort.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
0-4
255 return commShort;
executed 4 times by 1 test: return commShort;
Executed by:
  • tst_QMimeDatabase
4
256 }
never executed: end of block
0
257 }
never executed: end of block
0
258-
259 // Use the mimetype name as fallback-
260 return d->name;
never executed: return d->name;
0
261}-
262-
263/*!-
264 \fn QString QMimeType::genericIconName() const;-
265 Returns the file name of a generic icon that represents the MIME type.-
266-
267 This should be used if the icon returned by iconName() cannot be found on-
268 the system. It is used for categories of similar types (like spreadsheets-
269 or archives) that can use a common icon.-
270 The freedesktop.org Icon Naming Specification lists a set of such icon names.-
271-
272 The icon name can be given to QIcon::fromTheme() in order to load the icon.-
273 */-
274QString QMimeType::genericIconName() const-
275{-
276 QMimeDatabasePrivate::instance()->provider()->loadGenericIcon(*d);-
277 if (d->genericIconName.isEmpty()) {
d->genericIconName.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QMimeDatabase
  • tst_qmimetype
4-5
278 // From the spec:-
279 // If the generic icon name is empty (not specified by the mimetype definition)-
280 // then the mimetype is used to generate the generic icon by using the top-level-
281 // media type (e.g. "video" in "video/ogg") and appending "-x-generic"-
282 // (i.e. "video-x-generic" in the previous example).-
283 QString group = name();-
284 const int slashindex = group.indexOf(QLatin1Char('/'));-
285 if (slashindex != -1)
slashindex != -1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
0-4
286 group = group.left(slashindex);
executed 4 times by 1 test: group = group.left(slashindex);
Executed by:
  • tst_QMimeDatabase
4
287 return group + QLatin1String("-x-generic");
executed 4 times by 1 test: return group + QLatin1String("-x-generic");
Executed by:
  • tst_QMimeDatabase
4
288 }-
289 return d->genericIconName;
executed 5 times by 2 tests: return d->genericIconName;
Executed by:
  • tst_QMimeDatabase
  • tst_qmimetype
5
290}-
291-
292/*!-
293 \fn QString QMimeType::iconName() const;-
294 Returns the file name of an icon image that represents the MIME type.-
295-
296 The icon name can be given to QIcon::fromTheme() in order to load the icon.-
297 */-
298QString QMimeType::iconName() const-
299{-
300 QMimeDatabasePrivate::instance()->provider()->loadIcon(*d);-
301 if (d->iconName.isEmpty()) {
d->iconName.isEmpty()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QMimeDatabase
  • tst_qmimetype
3-6
302 // Make default icon name from the mimetype name-
303 d->iconName = name();-
304 const int slashindex = d->iconName.indexOf(QLatin1Char('/'));-
305 if (slashindex != -1)
slashindex != -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEnever evaluated
0-6
306 d->iconName[slashindex] = QLatin1Char('-');
executed 6 times by 1 test: d->iconName[slashindex] = QLatin1Char('-');
Executed by:
  • tst_QMimeDatabase
6
307 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
6
308 return d->iconName;
executed 9 times by 2 tests: return d->iconName;
Executed by:
  • tst_QMimeDatabase
  • tst_qmimetype
9
309}-
310-
311/*!-
312 \fn QStringList QMimeType::globPatterns() const;-
313 Returns the list of glob matching patterns.-
314 */-
315QStringList QMimeType::globPatterns() const-
316{-
317 QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);-
318 return d->globPatterns;
executed 21 times by 2 tests: return d->globPatterns;
Executed by:
  • tst_QMimeDatabase
  • tst_qmimetype
21
319}-
320-
321/*!-
322 A type is a subclass of another type if any instance of the first type is-
323 also an instance of the second. For example, all image/svg+xml files are also-
324 text/xml, text/plain and application/octet-stream files. Subclassing is about-
325 the format, rather than the category of the data (for example, there is no-
326 'generic spreadsheet' class that all spreadsheets inherit from).-
327 Conversely, the parent mimetype of image/svg+xml is text/xml.-
328-
329 A mimetype can have multiple parents. For instance application/x-perl-
330 has two parents: application/x-executable and text/plain. This makes-
331 it possible to both execute perl scripts, and to open them in text editors.-
332*/-
333QStringList QMimeType::parentMimeTypes() const-
334{-
335 return QMimeDatabasePrivate::instance()->provider()->parents(d->name);
executed 16 times by 1 test: return QMimeDatabasePrivate::instance()->provider()->parents(d->name);
Executed by:
  • tst_QMimeDatabase
16
336}-
337-
338static void collectParentMimeTypes(const QString &mime, QStringList &allParents)-
339{-
340 QStringList parents = QMimeDatabasePrivate::instance()->provider()->parents(mime);-
341 foreach (const QString &parent, parents) {-
342 // I would use QSet, but since order matters I better not-
343 if (!allParents.contains(parent))
!allParents.contains(parent)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
4-24
344 allParents.append(parent);
executed 24 times by 1 test: allParents.append(parent);
Executed by:
  • tst_QMimeDatabase
24
345 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
28
346 // We want a breadth-first search, so that the least-specific parent (octet-stream) is last-
347 // This means iterating twice, unfortunately.-
348 foreach (const QString &parent, parents) {-
349 collectParentMimeTypes(parent, allParents);-
350 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
28
351}
executed 36 times by 1 test: end of block
Executed by:
  • tst_QMimeDatabase
36
352-
353/*!-
354 Return all the parent mimetypes of this mimetype, direct and indirect.-
355 This includes the parent(s) of its parent(s), etc.-
356-
357 For instance, for image/svg+xml the list would be:-
358 application/xml, text/plain, application/octet-stream.-
359-
360 Note that application/octet-stream is the ultimate parent for all types-
361 of files (but not directories).-
362*/-
363QStringList QMimeType::allAncestors() const-
364{-
365 QStringList allParents;-
366 collectParentMimeTypes(d->name, allParents);-
367 return allParents;
executed 8 times by 1 test: return allParents;
Executed by:
  • tst_QMimeDatabase
8
368}-
369-
370/*!-
371 Return the list of aliases of this mimetype.-
372-
373 For instance, for text/csv, the returned list would be:-
374 text/x-csv, text/x-comma-separated-values.-
375-
376 Note that all QMimeType instances refer to proper mimetypes,-
377 never to aliases directly.-
378-
379 The order of the aliases in the list is undefined.-
380*/-
381QStringList QMimeType::aliases() const-
382{-
383 return QMimeDatabasePrivate::instance()->provider()->listAliases(d->name);
executed 8 times by 1 test: return QMimeDatabasePrivate::instance()->provider()->listAliases(d->name);
Executed by:
  • tst_QMimeDatabase
8
384}-
385-
386/*!-
387 Returns the known suffixes for the MIME type.-
388 No leading dot is included, so for instance this would return "jpg", "jpeg" for image/jpeg.-
389 */-
390QStringList QMimeType::suffixes() const-
391{-
392 QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);-
393-
394 QStringList result;-
395 foreach (const QString &pattern, d->globPatterns) {-
396 // Not a simple suffix if it looks like: README or *. or *.* or *.JP*G or *.JP?-
397 if (pattern.startsWith(QLatin1String("*.")) &&
pattern.starts...1String("*."))Description
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QMimeDatabase
  • tst_qmimetype
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
4-33
398 pattern.length() > 2 &&
pattern.length() > 2Description
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QMimeDatabase
  • tst_qmimetype
FALSEnever evaluated
0-33
399 pattern.indexOf(QLatin1Char('*'), 2) < 0 && pattern.indexOf(QLatin1Char('?'), 2) < 0) {
pattern.indexO...r('*'), 2) < 0Description
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QMimeDatabase
  • tst_qmimetype
FALSEnever evaluated
pattern.indexO...r('?'), 2) < 0Description
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QMimeDatabase
  • tst_qmimetype
FALSEnever evaluated
0-33
400 const QString suffix = pattern.mid(2);-
401 result.append(suffix);-
402 }
executed 33 times by 2 tests: end of block
Executed by:
  • tst_QMimeDatabase
  • tst_qmimetype
33
403 }
executed 37 times by 2 tests: end of block
Executed by:
  • tst_QMimeDatabase
  • tst_qmimetype
37
404-
405 return result;
executed 19 times by 2 tests: return result;
Executed by:
  • tst_QMimeDatabase
  • tst_qmimetype
19
406}-
407-
408/*!-
409 Returns the preferred suffix for the MIME type.-
410 No leading dot is included, so for instance this would return "pdf" for application/pdf.-
411 The return value can be empty, for mime types which do not have any suffixes associated.-
412 */-
413QString QMimeType::preferredSuffix() const-
414{-
415 const QStringList suffixList = suffixes();-
416 return suffixList.isEmpty() ? QString() : suffixList.at(0);
executed 18 times by 1 test: return suffixList.isEmpty() ? QString() : suffixList.at(0);
Executed by:
  • tst_QMimeDatabase
suffixList.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
4-18
417}-
418-
419/*!-
420 \fn QString QMimeType::filterString() const;-
421 Returns a filter string usable for a file dialog.-
422*/-
423QString QMimeType::filterString() const-
424{-
425 QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);-
426 QString filter;-
427-
428 if (!d->globPatterns.empty()) {
!d->globPatterns.empty()Description
TRUEnever evaluated
FALSEnever evaluated
0
429 filter += comment() + QLatin1String(" (");-
430 for (int i = 0; i < d->globPatterns.size(); ++i) {
i < d->globPatterns.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
431 if (i != 0)
i != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
432 filter += QLatin1Char(' ');
never executed: filter += QLatin1Char(' ');
0
433 filter += d->globPatterns.at(i);-
434 }
never executed: end of block
0
435 filter += QLatin1Char(')');-
436 }
never executed: end of block
0
437-
438 return filter;
never executed: return filter;
0
439}-
440-
441/*!-
442 \fn bool QMimeType::inherits(const QString &mimeTypeName) const;-
443 Returns \c true if this mimetype is \a mimeTypeName,-
444 or inherits \a mimeTypeName (see parentMimeTypes()),-
445 or \a mimeTypeName is an alias for this mimetype.-
446 */-
447bool QMimeType::inherits(const QString &mimeTypeName) const-
448{-
449 if (d->name == mimeTypeName)
d->name == mimeTypeNameDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_QMimeDatabase
4-52
450 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_QMimeDatabase
4
451 return QMimeDatabasePrivate::instance()->inherits(d->name, mimeTypeName);
executed 52 times by 1 test: return QMimeDatabasePrivate::instance()->inherits(d->name, mimeTypeName);
Executed by:
  • tst_QMimeDatabase
52
452}-
453-
454#ifndef QT_NO_DEBUG_STREAM-
455QDebug operator<<(QDebug debug, const QMimeType &mime)-
456{-
457 QDebugStateSaver saver(debug);-
458 if (!mime.isValid()) {
!mime.isValid()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDebug
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDebug
1
459 debug.nospace() << "QMimeType(invalid)";-
460 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QDebug
1
461 debug.nospace() << "QMimeType(" << mime.name() << ")";-
462 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QDebug
1
463 return debug;
executed 2 times by 1 test: return debug;
Executed by:
  • tst_QDebug
2
464}-
465#endif-
466-
467QT_END_NAMESPACE-
468-
469#endif // QT_NO_MIMETYPE-
Source codeSwitch to Preprocessed file

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