Project: Make Project::file take a std::function to match files

Make Project::files take a standard function to match files with instead
of an enum (and a std::function).

Change-Id: I6a24e40dba0e972ff96c0a57e775d2377e2545e0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2017-12-06 10:58:59 +01:00
parent 18f38ff18e
commit f542e24eca
5 changed files with 40 additions and 28 deletions

View File

@@ -728,7 +728,9 @@ void CMakeProject::createGeneratedCodeModelSupport()
= Utils::transform<QSet>(factories, [](const ExtraCompilerFactory *f) { return f->sourceTag(); });
// Find all files generated by any of the extra compilers, in a rather crude way.
const FileNameList fileList = files(SourceFiles, [&fileExtensions](const Node *n) {
const FileNameList fileList = files([&fileExtensions](const Node *n) {
if (!SourceFiles(n))
return false;
const QString fp = n->filePath().toString();
const int pos = fp.lastIndexOf('.');
return pos >= 0 && fileExtensions.contains(fp.mid(pos + 1));