forked from qt-creator/qt-creator
Remove some lambdas from Utils::transform calls
It is often possible to user (member) functions or members directly. That improves readablility and potentially reduces the total number of symbols. Also use qobject_container_cast at places where it is appropriate. Change-Id: Ia2591bca356591e001e2c53eeebcf753e5bc3c37 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -491,7 +491,7 @@ CMakeConfig CMakeConfigurationKitInformation::configuration(const Kit *k)
|
||||
if (!k)
|
||||
return CMakeConfig();
|
||||
const QStringList tmp = k->value(CONFIGURATION_ID).toStringList();
|
||||
return Utils::transform(tmp, [](const QString &s) { return CMakeConfigItem::fromString(s); });
|
||||
return Utils::transform(tmp, &CMakeConfigItem::fromString);
|
||||
}
|
||||
|
||||
void CMakeConfigurationKitInformation::setConfiguration(Kit *k, const CMakeConfig &config)
|
||||
|
||||
@@ -476,7 +476,7 @@ void CMakeProject::startParsing(int reparseParameters)
|
||||
|
||||
QStringList CMakeProject::buildTargetTitles() const
|
||||
{
|
||||
return transform(buildTargets(), [](const CMakeBuildTarget &ct) { return ct.title; });
|
||||
return transform(buildTargets(), &CMakeBuildTarget::title);
|
||||
}
|
||||
|
||||
Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||
@@ -671,7 +671,7 @@ void CMakeProject::createGeneratedCodeModelSupport()
|
||||
ExtraCompilerFactory::extraCompilerFactories();
|
||||
|
||||
const QSet<QString> fileExtensions
|
||||
= Utils::transform<QSet>(factories, [](const ExtraCompilerFactory *f) { return f->sourceTag(); });
|
||||
= Utils::transform<QSet>(factories, &ExtraCompilerFactory::sourceTag);
|
||||
|
||||
// Find all files generated by any of the extra compilers, in a rather crude way.
|
||||
const FileNameList fileList = files([&fileExtensions](const Node *n) {
|
||||
|
||||
@@ -271,7 +271,7 @@ void TeaLeafReader::generateProjectTree(CMakeProjectNode *root, const QList<cons
|
||||
|
||||
// Delete no longer necessary file watcher based on m_cmakeFiles:
|
||||
const QSet<FileName> currentWatched
|
||||
= transform(m_watchedFiles, [](CMakeFile *cmf) { return cmf->filePath(); });
|
||||
= transform(m_watchedFiles, &CMakeFile::filePath);
|
||||
const QSet<FileName> toWatch = m_cmakeFiles;
|
||||
QSet<FileName> toDelete = currentWatched;
|
||||
toDelete.subtract(toWatch);
|
||||
@@ -383,7 +383,7 @@ void TeaLeafReader::updateCodeModel(CppTools::RawProjectParts &rpps)
|
||||
|
||||
rpp.setMacros(cbt.macros);
|
||||
rpp.setDisplayName(cbt.title);
|
||||
rpp.setFiles(transform(cbt.files, [](const FileName &fn) { return fn.toString(); }));
|
||||
rpp.setFiles(transform(cbt.files, &FileName::toString));
|
||||
|
||||
const bool isExecutable = cbt.targetType == ExecutableType;
|
||||
rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable
|
||||
|
||||
Reference in New Issue
Block a user