logic: added exclude filters for cbp sourcegroups

This commit is contained in:
mlangkabel
2018-06-15 18:33:04 +02:00
parent 0a6347fa43
commit b6588cd6ba
8 changed files with 62 additions and 17 deletions
@@ -44,16 +44,36 @@ std::set<FilePath> SourceGroupCxxCodeblocks::filterToContainedFilePaths(const st
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute())
);
const std::vector<FilePathFilter> excludeFilters = m_settings->getExcludeFiltersExpandedAndAbsolute();
for (const FilePath& filePath : filePaths)
{
bool isInIndexedPaths = false;
for (const FilePath& indexedPath : indexedPaths)
{
if (indexedPath == filePath || indexedPath.contains(filePath))
{
containedFilePaths.insert(filePath);
isInIndexedPaths = true;
break;
}
}
if (isInIndexedPaths)
{
for (const FilePathFilter& excludeFilter : excludeFilters)
{
if (excludeFilter.isMatching(filePath))
{
isInIndexedPaths = false;
break;
}
}
}
if (isInIndexedPaths)
{
containedFilePaths.insert(filePath);
}
}
return containedFilePaths;
@@ -66,9 +86,21 @@ std::set<FilePath> SourceGroupCxxCodeblocks::getAllSourceFilePaths() const
m_settings->getCodeblocksProjectPathExpandedAndAbsolute()
))
{
for (const FilePath& filePath : project->getAllSourceFilePathsCanonical(m_settings))
const std::vector<FilePathFilter> excludeFilters = m_settings->getExcludeFiltersExpandedAndAbsolute();
for (const FilePath& filePath : project->getAllSourceFilePathsCanonical(m_settings->getSourceExtensions()))
{
if (filePath.exists())
bool isExcluded = false;
for (const FilePathFilter& excludeFilter : excludeFilters)
{
if (excludeFilter.isMatching(filePath))
{
isExcluded = true;
break;
}
}
if (!isExcluded && filePath.exists())
{
sourceFilePaths.insert(filePath);
}