The FilterCache
Class Reference
Declaration
Private Member Typedefs Index
using | LineOffsets = std::vector< size_t > |
Private Constructors Index
FilterCache () | |
Public Member Functions Index
bool | getFileContents (const QCString &fileName, size_t startLine, size_t endLine, std::string &str) |
Private Member Functions Index
bool | getFileContentsPipe (const QCString &fileName, const QCString &filter, size_t startLine, size_t endLine, std::string &str) |
bool | getFileContentsDisk (const QCString &fileName, size_t startLine, size_t endLine, std::string &str) |
void | compileLineOffsets (const QCString &fileName, const std::string &str) |
std::tuple< size_t, size_t > | getFragmentLocation (const LineOffsets &lineOffsets, size_t startLine, size_t endLine) |
void | shrinkBuffer (std::string &str, const QCString &fileName, size_t startLine, size_t endLine) |
void | readFragmentFromFile (std::string &str, const QCString &fileName, size_t startOffset, size_t size=0) |
Private Member Attributes Index
std::unordered_map< std::string, FilterCacheItem > | m_cache |
std::unordered_map< std::string, LineOffsets > | m_lineOffsets |
std::mutex | m_mutex |
size_t | m_endPos |
Public Static Functions Index
static FilterCache & | instance () |
Description
Cache for storing the result of filtering a file
Definition at line 530 of file definition.cpp.
Private Member Typedefs
LineOffsets
|
Definition at line 538 of file definition.cpp.
Private Constructors
FilterCache()
| inline |
Definition at line 722 of file definition.cpp.
Reference m_endPos.
Referenced by instance.
Public Member Functions
getFileContents()
| inline |
collects the part of file fileName starting at startLine and ending at endLine into buffer str. Applies filtering if FILTER_SOURCE_FILES is enabled and the file extension matches a filter. Caches file information so that subsequent extraction of blocks from the same file can be performed efficiently
Definition at line 547 of file definition.cpp.
References Config_getBool, getFileContentsDisk, getFileContentsPipe, getFileFilter, QCString::isEmpty and TRUE.
Referenced by readCodeFragment.
Private Member Functions
compileLineOffsets()
| inline |
computes the starting offset for each line for file fileName, whose contents should already be stored in buffer str.
Definition at line 666 of file definition.cpp.
References QCString::data and m_lineOffsets.
Referenced by shrinkBuffer.
getFileContentsDisk()
| inline |
reads the fragment start at startLine and ending at endLine from file fileName into buffer str
Definition at line 640 of file definition.cpp.
References getFragmentLocation, m_lineOffsets, m_mutex, readFragmentFromFile, shrinkBuffer and QCString::str.
Referenced by getFileContents.
getFileContentsPipe()
| inline |
Definition at line 556 of file definition.cpp.
References err, Debug::ExtCmd, FilterCache::FilterCacheItem::filePos, FilterCache::FilterCacheItem::fileSize, Doxygen::filterDBFileName, Debug::FilterOutput, Portable::fopen, getFragmentLocation, m_cache, m_endPos, m_lineOffsets, m_mutex, Portable::pclose, Portable::popen, Debug::print, readFragmentFromFile, shrinkBuffer and QCString::str.
Referenced by getFileContents.
getFragmentLocation()
| inline |
Returns the byte offset and size within a file of a fragment given the array of line offsets and the start and end line of the fragment.
Definition at line 682 of file definition.cpp.
Referenced by getFileContentsDisk, getFileContentsPipe and shrinkBuffer.
readFragmentFromFile()
| inline |
Reads the fragment start at byte offset startOffset of file fileName into buffer str. Result will be a null terminated. If size==0 the whole file will be read and startOffset is ignored. If size>0, size bytes will be read.
Definition at line 713 of file definition.cpp.
Reference Portable::openInputStream.
Referenced by getFileContentsDisk and getFileContentsPipe.
shrinkBuffer()
| inline |
Shrinks buffer str which should hold the contents of fileName to the fragment starting a line startLine and ending at line endLine
Definition at line 696 of file definition.cpp.
References compileLineOffsets, getFragmentLocation, m_lineOffsets and QCString::str.
Referenced by getFileContentsDisk and getFileContentsPipe.
Private Member Attributes
m_cache
|
Definition at line 723 of file definition.cpp.
Referenced by getFileContentsPipe.
m_endPos
|
Definition at line 726 of file definition.cpp.
Referenced by FilterCache and getFileContentsPipe.
m_lineOffsets
|
Definition at line 724 of file definition.cpp.
Referenced by compileLineOffsets, getFileContentsDisk, getFileContentsPipe and shrinkBuffer.
m_mutex
|
Definition at line 725 of file definition.cpp.
Referenced by getFileContentsDisk and getFileContentsPipe.
Public Static Functions
instance()
| static |
Definition at line 541 of file definition.cpp.
Reference FilterCache.
Referenced by readCodeFragment.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus by Doxygen 1.14.0.