MCPcopy Create free account
hub / github.com/KDE/kdevelop / languagesForMimetype

Method languagesForMimetype

kdevplatform/shell/languagecontroller.cpp:352–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352QList<ILanguageSupport*> LanguageController::languagesForMimetype(const QString& mimetype)
353{
354 Q_D(LanguageController);
355
356 QMutexLocker lock(&d->dataMutex);
357
358 QList<ILanguageSupport*> languages;
359 LanguageCache::ConstIterator it = d->languageCache.constFind(mimetype);
360 if (it != d->languageCache.constEnd()) {
361 languages = it.value();
362 } else {
363 QVariantMap constraints;
364 constraints.insert(KEY_SupportedMimeTypes(), mimetype);
365 const QList<IPlugin*> supports = Core::self()->pluginController()->allPluginsForExtension(KEY_ILanguageSupport(), constraints);
366
367 if (supports.isEmpty()) {
368 qCDebug(SHELL) << "no languages for mimetype:" << mimetype;
369 d->languageCache.insert(mimetype, QList<ILanguageSupport*>());
370 } else {
371 for (IPlugin *support : supports) {
372 auto* languageSupport = support->extension<ILanguageSupport>();
373 qCDebug(SHELL) << "language-support:" << languageSupport;
374 if(languageSupport) {
375 d->addLanguageSupport(languageSupport);
376 languages << languageSupport;
377 }
378 }
379 }
380 }
381 return languages;
382}
383
384QList<QString> LanguageController::mimetypesForLanguageName(const QString& languageName)
385{

Callers

nothing calls this directly

Calls 10

KEY_SupportedMimeTypesFunction · 0.85
KEY_ILanguageSupportFunction · 0.85
constEndMethod · 0.80
pluginControllerMethod · 0.80
addLanguageSupportMethod · 0.80
constFindMethod · 0.45
valueMethod · 0.45
insertMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected