#include "SourceGroup.h" #include "FilePath.h" #include "FilePathFilter.h" #include "MemoryIndexerCommandProvider.h" #include "ProjectSettings.h" #include "SourceGroupSettings.h" #include "TaskLambda.h" std::shared_ptr SourceGroup::getIndexerCommandProvider(const RefreshInfo& info) const { return std::make_shared(getIndexerCommands(info)); } std::shared_ptr SourceGroup::getPreIndexTask( std::shared_ptr storageProvider, std::shared_ptr dialogView) const { return std::make_shared([]() {}); } SourceGroupType SourceGroup::getType() const { return getSourceGroupSettings()->getType(); } LanguageType SourceGroup::getLanguage() const { return getSourceGroupSettings()->getLanguage(); } SourceGroupStatusType SourceGroup::getStatus() const { return getSourceGroupSettings()->getStatus(); } bool SourceGroup::prepareIndexing() { return true; } bool SourceGroup::allowsPartialClearing() const { return true; } bool SourceGroup::allowsShallowIndexing() const { return false; } std::set SourceGroup::filterToContainedSourceFilePath(const std::set& sourceFilePaths) const { std::set filteredSourceFilePaths; for (const FilePath& sourceFilePath: getAllSourceFilePaths()) { if (sourceFilePaths.find(sourceFilePath) == sourceFilePaths.end()) { filteredSourceFilePaths.insert(sourceFilePath); } } return filteredSourceFilePaths; } bool SourceGroup::containsSourceFilePath(const FilePath& sourceFilePath) const { return !filterToContainedSourceFilePath({ sourceFilePath }).empty(); } std::set SourceGroup::filterToContainedFilePaths( const std::set& filePaths, const std::set& indexedFilePaths, const std::set& indexedFileOrDirectoryPaths, const std::vector& excludeFilters) const { std::set containedFilePaths; for (const FilePath& filePath : filePaths) { bool isInIndexedPaths = false; for (const FilePath& indexedFileOrDirectoryPath : indexedFileOrDirectoryPaths) { if (indexedFileOrDirectoryPath == filePath || indexedFileOrDirectoryPath.contains(filePath)) { isInIndexedPaths = true; break; } } if (!isInIndexedPaths && indexedFilePaths.find(filePath) != indexedFilePaths.end()) { isInIndexedPaths = true; } if (isInIndexedPaths) { for (const FilePathFilter& excludeFilter : excludeFilters) { if (excludeFilter.isMatching(filePath)) { isInIndexedPaths = false; break; } } } if (isInIndexedPaths) { containedFilePaths.insert(filePath); } } return containedFilePaths; }