| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | QMimeTypePrivate::QMimeTypePrivate() | - |
| 10 | : loaded(false) | - |
| 11 | {} executed: }Execution Count:5476 | 5476 |
| 12 | | - |
| 13 | QMimeTypePrivate::QMimeTypePrivate(const QMimeType &other) | - |
| 14 | : name(other.d->name), | - |
| 15 | localeComments(other.d->localeComments), | - |
| 16 | genericIconName(other.d->genericIconName), | - |
| 17 | iconName(other.d->iconName), | - |
| 18 | globPatterns(other.d->globPatterns), | - |
| 19 | loaded(other.d->loaded) | - |
| 20 | {} | 0 |
| 21 | | - |
| 22 | void QMimeTypePrivate::clear() | - |
| 23 | { | - |
| 24 | name.clear(); | - |
| 25 | localeComments.clear(); | - |
| 26 | genericIconName.clear(); | - |
| 27 | iconName.clear(); | - |
| 28 | globPatterns.clear(); | - |
| 29 | loaded = false; | - |
| 30 | } | 0 |
| 31 | | - |
| 32 | void QMimeTypePrivate::addGlobPattern(const QString &pattern) | - |
| 33 | { | - |
| 34 | globPatterns.append(pattern); | - |
| 35 | } | 0 |
| 36 | QMimeType::QMimeType() : | - |
| 37 | d(new QMimeTypePrivate()) | - |
| 38 | { | - |
| 39 | } executed: }Execution Count:18 | 18 |
| 40 | | - |
| 41 | | - |
| 42 | | - |
| 43 | | - |
| 44 | | - |
| 45 | QMimeType::QMimeType(const QMimeType &other) : | - |
| 46 | d(other.d) | - |
| 47 | { | - |
| 48 | } executed: }Execution Count:3388 | 3388 |
| 49 | | - |
| 50 | | - |
| 51 | | - |
| 52 | | - |
| 53 | | - |
| 54 | QMimeType &QMimeType::operator=(const QMimeType &other) | - |
| 55 | { | - |
| 56 | if (d != other.d) partially evaluated: d != other.d| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 57 | d = other.d; executed: d = other.d;Execution Count:16 | 16 |
| 58 | return *this; executed: return *this;Execution Count:16 | 16 |
| 59 | } | - |
| 60 | | - |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | QMimeType::QMimeType(const QMimeTypePrivate &dd) : | - |
| 67 | d(new QMimeTypePrivate(dd)) | - |
| 68 | { | - |
| 69 | } executed: }Execution Count:5458 | 5458 |
| 70 | QMimeType::~QMimeType() | - |
| 71 | { | - |
| 72 | } | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | bool QMimeType::operator==(const QMimeType &other) const | - |
| 81 | { | - |
| 82 | return d == other.d || d->name == other.d->name; never executed: return d == other.d || d->name == other.d->name; | 0 |
| 83 | } | - |
| 84 | bool QMimeType::isValid() const | - |
| 85 | { | - |
| 86 | return !d->name.isEmpty(); executed: return !d->name.isEmpty();Execution Count:2118 | 2118 |
| 87 | } | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | bool QMimeType::isDefault() const | - |
| 95 | { | - |
| 96 | return d->name == QMimeDatabasePrivate::instance()->defaultMimeType(); executed: return d->name == QMimeDatabasePrivate::instance()->defaultMimeType();Execution Count:9 | 9 |
| 97 | } | - |
| 98 | | - |
| 99 | | - |
| 100 | | - |
| 101 | | - |
| 102 | | - |
| 103 | QString QMimeType::name() const | - |
| 104 | { | - |
| 105 | return d->name; executed: return d->name;Execution Count:4837 | 4837 |
| 106 | } | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | QString QMimeType::comment() const | - |
| 114 | { | - |
| 115 | QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d); | - |
| 116 | | - |
| 117 | QStringList languageList; | - |
| 118 | languageList << QLocale::system().name(); | - |
| 119 | languageList << QLocale::system().uiLanguages(); | - |
| 120 | for (QForeachContainer<__typeof__(languageList)> _container_(languageList); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &language = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 121 | const QString lang = language == QLatin1String("C") ? QLatin1String("en_US") : language; partially evaluated: language == QLatin1String("C")| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 122 | const QString comm = d->localeComments.value(lang); | - |
| 123 | if (!comm.isEmpty()) partially evaluated: !comm.isEmpty()| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 124 | return comm; executed: return comm;Execution Count:6 | 6 |
| 125 | const int pos = lang.indexOf(QLatin1Char('_')); | - |
| 126 | if (pos != -1) { never evaluated: pos != -1 | 0 |
| 127 | | - |
| 128 | const QString shortLang = lang.left(pos); | - |
| 129 | const QString commShort = d->localeComments.value(shortLang); | - |
| 130 | if (!commShort.isEmpty()) never evaluated: !commShort.isEmpty() | 0 |
| 131 | return commShort; never executed: return commShort; | 0 |
| 132 | } | 0 |
| 133 | } | 0 |
| 134 | | - |
| 135 | | - |
| 136 | return d->name; never executed: return d->name; | 0 |
| 137 | } | - |
| 138 | QString QMimeType::genericIconName() const | - |
| 139 | { | - |
| 140 | QMimeDatabasePrivate::instance()->provider()->loadGenericIcon(*d); | - |
| 141 | if (d->genericIconName.isEmpty()) { evaluated: d->genericIconName.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 142 | | - |
| 143 | | - |
| 144 | | - |
| 145 | | - |
| 146 | | - |
| 147 | QString group = name(); | - |
| 148 | const int slashindex = group.indexOf(QLatin1Char('/')); | - |
| 149 | if (slashindex != -1) partially evaluated: slashindex != -1| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 150 | group = group.left(slashindex); executed: group = group.left(slashindex);Execution Count:2 | 2 |
| 151 | return group + QLatin1String("-x-generic"); executed: return group + QLatin1String("-x-generic");Execution Count:2 | 2 |
| 152 | } | - |
| 153 | return d->genericIconName; executed: return d->genericIconName;Execution Count:2 | 2 |
| 154 | } | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | | - |
| 160 | | - |
| 161 | | - |
| 162 | QString QMimeType::iconName() const | - |
| 163 | { | - |
| 164 | QMimeDatabasePrivate::instance()->provider()->loadIcon(*d); | - |
| 165 | if (d->iconName.isEmpty()) { partially evaluated: d->iconName.isEmpty()| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 166 | | - |
| 167 | d->iconName = name(); | - |
| 168 | const int slashindex = d->iconName.indexOf(QLatin1Char('/')); | - |
| 169 | if (slashindex != -1) partially evaluated: slashindex != -1| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 170 | d->iconName[slashindex] = QLatin1Char('-'); executed: d->iconName[slashindex] = QLatin1Char('-');Execution Count:4 | 4 |
| 171 | } executed: }Execution Count:4 | 4 |
| 172 | return d->iconName; executed: return d->iconName;Execution Count:4 | 4 |
| 173 | } | - |
| 174 | | - |
| 175 | | - |
| 176 | | - |
| 177 | | - |
| 178 | | - |
| 179 | QStringList QMimeType::globPatterns() const | - |
| 180 | { | - |
| 181 | QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d); | - |
| 182 | return d->globPatterns; executed: return d->globPatterns;Execution Count:9 | 9 |
| 183 | } | - |
| 184 | QStringList QMimeType::parentMimeTypes() const | - |
| 185 | { | - |
| 186 | return QMimeDatabasePrivate::instance()->provider()->parents(d->name); executed: return QMimeDatabasePrivate::instance()->provider()->parents(d->name);Execution Count:8 | 8 |
| 187 | } | - |
| 188 | | - |
| 189 | static void collectParentMimeTypes(const QString &mime, QStringList &allParents) | - |
| 190 | { | - |
| 191 | QStringList parents = QMimeDatabasePrivate::instance()->provider()->parents(mime); | - |
| 192 | for (QForeachContainer<__typeof__(parents)> _container_(parents); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &parent = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 193 | | - |
| 194 | if (!allParents.contains(parent)) evaluated: !allParents.contains(parent)| yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
| 195 | allParents.append(parent); executed: allParents.append(parent);Execution Count:12 | 12 |
| 196 | } executed: }Execution Count:14 | 14 |
| 197 | | - |
| 198 | | - |
| 199 | for (QForeachContainer<__typeof__(parents)> _container_(parents); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &parent = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 200 | collectParentMimeTypes(parent, allParents); | - |
| 201 | } executed: }Execution Count:14 | 14 |
| 202 | } executed: }Execution Count:18 | 18 |
| 203 | QStringList QMimeType::allAncestors() const | - |
| 204 | { | - |
| 205 | QStringList allParents; | - |
| 206 | collectParentMimeTypes(d->name, allParents); | - |
| 207 | return allParents; executed: return allParents;Execution Count:4 | 4 |
| 208 | } | - |
| 209 | QStringList QMimeType::aliases() const | - |
| 210 | { | - |
| 211 | return QMimeDatabasePrivate::instance()->provider()->listAliases(d->name); executed: return QMimeDatabasePrivate::instance()->provider()->listAliases(d->name);Execution Count:4 | 4 |
| 212 | } | - |
| 213 | | - |
| 214 | | - |
| 215 | | - |
| 216 | | - |
| 217 | | - |
| 218 | QStringList QMimeType::suffixes() const | - |
| 219 | { | - |
| 220 | QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d); | - |
| 221 | | - |
| 222 | QStringList result; | - |
| 223 | for (QForeachContainer<__typeof__(d->globPatterns)> _container_(d->globPatterns); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &pattern = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 224 | | - |
| 225 | if (pattern.startsWith(QLatin1String("*.")) && evaluated: pattern.startsWith(QLatin1String("*."))| yes Evaluation Count:16 | yes Evaluation Count:2 |
| 2-16 |
| 226 | pattern.length() > 2 && partially evaluated: pattern.length() > 2| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 227 | pattern.indexOf(QLatin1Char('*'), 2) < 0 && pattern.indexOf(QLatin1Char('?'), 2) < 0) { partially evaluated: pattern.indexOf(QLatin1Char('*'), 2) < 0| yes Evaluation Count:16 | no Evaluation Count:0 |
partially evaluated: pattern.indexOf(QLatin1Char('?'), 2) < 0| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 228 | const QString suffix = pattern.mid(2); | - |
| 229 | result.append(suffix); | - |
| 230 | } executed: }Execution Count:16 | 16 |
| 231 | } executed: }Execution Count:18 | 18 |
| 232 | | - |
| 233 | return result; executed: return result;Execution Count:9 | 9 |
| 234 | } | - |
| 235 | | - |
| 236 | | - |
| 237 | | - |
| 238 | | - |
| 239 | | - |
| 240 | | - |
| 241 | QString QMimeType::preferredSuffix() const | - |
| 242 | { | - |
| 243 | const QStringList suffixList = suffixes(); | - |
| 244 | return suffixList.isEmpty() ? QString() : suffixList.at(0); executed: return suffixList.isEmpty() ? QString() : suffixList.at(0);Execution Count:9 | 9 |
| 245 | } | - |
| 246 | | - |
| 247 | | - |
| 248 | | - |
| 249 | | - |
| 250 | | - |
| 251 | QString QMimeType::filterString() const | - |
| 252 | { | - |
| 253 | QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d); | - |
| 254 | QString filter; | - |
| 255 | | - |
| 256 | if (!d->globPatterns.empty()) { never evaluated: !d->globPatterns.empty() | 0 |
| 257 | filter += comment() + QLatin1String(" ("); | - |
| 258 | for (int i = 0; i < d->globPatterns.size(); ++i) { never evaluated: i < d->globPatterns.size() | 0 |
| 259 | if (i != 0) | 0 |
| 260 | filter += QLatin1Char(' '); never executed: filter += QLatin1Char(' '); | 0 |
| 261 | filter += d->globPatterns.at(i); | - |
| 262 | } | 0 |
| 263 | filter += QLatin1Char(')'); | - |
| 264 | } | 0 |
| 265 | | - |
| 266 | return filter; never executed: return filter; | 0 |
| 267 | } | - |
| 268 | | - |
| 269 | | - |
| 270 | | - |
| 271 | | - |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | bool QMimeType::inherits(const QString &mimeTypeName) const | - |
| 276 | { | - |
| 277 | if (d->name == mimeTypeName) evaluated: d->name == mimeTypeName| yes Evaluation Count:2 | yes Evaluation Count:26 |
| 2-26 |
| 278 | return true; executed: return true;Execution Count:2 | 2 |
| 279 | return QMimeDatabasePrivate::instance()->inherits(d->name, mimeTypeName); executed: return QMimeDatabasePrivate::instance()->inherits(d->name, mimeTypeName);Execution Count:26 | 26 |
| 280 | } | - |
| 281 | | - |
| 282 | | - |
| 283 | | - |
| | |