Doxygen
|
Classes | |
struct | FilterCacheItem |
Public Member Functions | |
bool | getFileContents (const QCString &fileName, size_t startLine, size_t endLine, std::string &str) |
collects the part of file fileName starting at startLine and ending at endLine into buffer str. | |
Static Public Member Functions | |
static FilterCache & | instance () |
Private Types | |
using | LineOffsets = std::vector<size_t> |
Private Member Functions | |
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) |
reads the fragment start at startLine and ending at endLine from file fileName into buffer str | |
void | compileLineOffsets (const QCString &fileName, const std::string &str) |
computes the starting offset for each line for file fileName, whose contents should already be stored in buffer str. | |
auto | getFragmentLocation (const LineOffsets &lineOffsets, size_t startLine, size_t endLine) -> std::tuple< size_t, size_t > |
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. | |
void | shrinkBuffer (std::string &str, const QCString &fileName, size_t startLine, size_t endLine) |
Shrinks buffer str which should hold the contents of fileName to the fragment starting a line startLine and ending at line endLine. | |
void | readFragmentFromFile (std::string &str, const QCString &fileName, size_t startOffset, size_t size=0) |
Reads the fragment start at byte offset startOffset of file fileName into buffer str. | |
FilterCache () | |
Private Attributes | |
std::unordered_map< std::string, FilterCacheItem > | m_cache |
std::unordered_map< std::string, LineOffsets > | m_lineOffsets |
std::mutex | m_mutex |
size_t | m_endPos |
Cache for storing the result of filtering a file
Definition at line 530 of file definition.cpp.
|
private |
Definition at line 538 of file definition.cpp.
|
inlineprivate |
Definition at line 722 of file definition.cpp.
References m_endPos.
Referenced by instance().
|
inlineprivate |
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().
|
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().
|
inlineprivate |
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().
|
inlineprivate |
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(), qPrint(), readFragmentFromFile(), shrinkBuffer(), and QCString::str().
Referenced by getFileContents().
|
inlineprivate |
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().
|
static |
Definition at line 729 of file definition.cpp.
References FilterCache().
Referenced by readCodeFragment().
|
inlineprivate |
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.
References Portable::openInputStream().
Referenced by getFileContentsDisk(), and getFileContentsPipe().
|
inlineprivate |
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 |
Definition at line 723 of file definition.cpp.
Referenced by getFileContentsPipe().
|
private |
Definition at line 726 of file definition.cpp.
Referenced by FilterCache(), and getFileContentsPipe().
|
private |
Definition at line 724 of file definition.cpp.
Referenced by compileLineOffsets(), getFileContentsDisk(), getFileContentsPipe(), and shrinkBuffer().
|
private |
Definition at line 725 of file definition.cpp.
Referenced by getFileContentsDisk(), and getFileContentsPipe().