Files
Sourcetrail/src/lib/utility/file/FileRegister.cpp
T
malte_langkabel 4563cbe90a logic: indexer commands
* replaced parser arguments by project specific IndexerCommands that know everything the indexer needs to know to do its job
* added different language and project specific indexers that know how to handle a certain kind of indexer command
* refactored FileManager and FileRegister to have less overhead
* removed no-rtti restriction for clang files in lib cxx
* uncommented deprecated interprocess code.

fortune cookie message = Happiness will bring you good luck.
2017-02-22 16:42:20 +01:00

76 lines
1.4 KiB
C++

#include "utility/file/FileRegister.h"
FileRegister::FileRegister(const FileRegisterStateData& stateData, const std::set<FilePath>& indexedPaths, const std::set<FilePath>& excludedPaths)
: m_stateData(stateData)
, m_indexedPaths(indexedPaths)
, m_excludedPaths(excludedPaths)
, m_hasFilePathCache(
[&](std::string filePath){
bool ret = false;
for (const FilePath& indexedPath: m_indexedPaths)
{
if (indexedPath.contains(filePath))
{
ret = true;
break;
}
}
if (ret)
{
for (const FilePath& excluded: m_excludedPaths)
{
if (excluded.isDirectory())
{
if (excluded.contains(filePath))
{
ret = false;
break;
}
}
else
{
if (excluded == filePath)
{
ret = false;
break;
}
}
}
}
return ret;
}
)
{
}
FileRegister::~FileRegister()
{
}
FileRegisterStateData FileRegister::getStateData() const
{
return m_stateData;
}
void FileRegister::markFileIndexing(const FilePath& filePath)
{
m_stateData.markFileIndexing(filePath);
}
void FileRegister::markIndexingFilesIndexed()
{
m_stateData.markIndexingFilesIndexed();
}
bool FileRegister::fileIsIndexed(const FilePath& filePath) const
{
return m_stateData.fileIsIndexed(filePath);
}
bool FileRegister::hasFilePath(const FilePath& filePath) const
{
return m_hasFilePathCache.getValue(filePath.str());
}