src: Added logic and UI for excluding files and directories from analysis

bug id = 68, 47
This commit is contained in:
Eberhard Graether
2016-06-07 10:46:36 +02:00
parent 6edcd77eb2
commit b10c55e7f9
10 changed files with 113 additions and 7 deletions
+25
View File
@@ -23,10 +23,12 @@ const std::vector<FilePath>& FileManager::getSourcePaths() const
void FileManager::setPaths(
std::vector<FilePath> sourcePaths,
std::vector<FilePath> headerPaths,
std::vector<FilePath> excludePaths,
std::vector<std::string> sourceExtensions
){
m_sourcePaths = sourcePaths;
m_headerPaths = headerPaths;
m_excludePaths = excludePaths;
m_sourceExtensions = sourceExtensions;
}
@@ -65,6 +67,11 @@ void FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
for (FileInfo fileInfo: fileInfos)
{
const FilePath& filePath = fileInfo.path;
if (isExcluded(filePath))
{
continue;
}
std::map<FilePath, FileInfo>::iterator it = m_files.find(filePath);
if (it != m_files.end())
{
@@ -110,6 +117,11 @@ bool FileManager::hasFilePath(const FilePath& filePath) const
return true;
}
if (isExcluded(filePath))
{
return false;
}
for (FilePath path : m_headerPaths)
{
if (path == filePath || path.contains(filePath))
@@ -137,3 +149,16 @@ const FileInfo FileManager::getFileInfo(const FilePath& filePath) const
return it->second;
}
bool FileManager::isExcluded(const FilePath& filePath) const
{
for (FilePath path : m_excludePaths)
{
if (path == filePath || path.contains(filePath))
{
return true;
}
}
return false;
}
+4 -1
View File
@@ -18,6 +18,7 @@ public:
void setPaths(
std::vector<FilePath> sourcePaths,
std::vector<FilePath> headerPaths,
std::vector<FilePath> excludePaths,
std::vector<std::string> sourceExtensions
);
@@ -33,13 +34,15 @@ public:
virtual const FileInfo getFileInfo(const FilePath& filePath) const;
private:
bool isExcluded(const FilePath& filePath) const;
std::map<FilePath, FileInfo> m_files;
std::vector<FilePath> m_sourcePaths;
std::vector<FilePath> m_headerPaths;
std::vector<FilePath> m_excludePaths;
std::vector<std::string> m_sourceExtensions;
std::vector<std::string> m_includeExtensions;
std::set<FilePath> m_addedFiles;
std::set<FilePath> m_updatedFiles;