ProjectExplorer: Add FolderNode::addNestedNodes taking unique_ptrs

Use that in CMake's tealeafreader.

Change-Id: Id1c372b083df380d0d930668cf7eec4ee89060c2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tobias Hunger
2018-04-26 16:39:15 +02:00
parent 1a23768563
commit bdd2dd371e
7 changed files with 56 additions and 41 deletions

View File

@@ -564,6 +564,14 @@ void FolderNode::addNestedNodes(const QList<FileNode *> &files, const Utils::Fil
addNestedNode(std::unique_ptr<FileNode>(fileNode), overrideBaseDir, factory);
}
void FolderNode::addNestedNodes(std::vector<std::unique_ptr<FileNode> > &&files,
const Utils::FileName &overrideBaseDir,
const FolderNode::FolderNodeFactory &factory)
{
for (std::unique_ptr<FileNode> &f : files)
addNestedNode(std::move(f), overrideBaseDir, factory);
}
// "Compress" a tree of foldernodes such that foldernodes with exactly one foldernode as a child
// are merged into one. This e.g. turns a sequence of FolderNodes "foo" "bar" "baz" into one
// FolderNode named "foo/bar/baz", saving a lot of clicks in the Project View to get to the actual