|
Doxygen
|
Classes | |
| struct | FilterCacheItem |
Public Member Functions | |
| bool | getFileContents (const DString &fileName, size_t startLine, size_t endLine, std::string &str) |
Static Public Member Functions | |
| static FilterCache & | instance () |
Private Types | |
| using | LineOffsets = std::vector<size_t> |
Private Member Functions | |
| bool | getFileContentsPipe (const DString &fileName, const DString &filter, size_t startLine, size_t endLine, std::string &str) |
| bool | getFileContentsDisk (const DString &fileName, size_t startLine, size_t endLine, std::string &str) |
| void | compileLineOffsets (const DString &fileName, const std::string &str) |
| auto | getFragmentLocation (const LineOffsets &lineOffsets, size_t startLine, size_t endLine) -> std::tuple< size_t, size_t > |
| void | shrinkBuffer (std::string &str, const DString &fileName, size_t startLine, size_t endLine) |
| void | readFragmentFromFile (std::string &str, const DString &fileName, size_t startOffset, size_t size=0) |
| 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 541 of file definition.cpp.
|
private |
Definition at line 549 of file definition.cpp.
|
inlineprivate |
Definition at line 733 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 677 of file definition.cpp.
References DString::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 558 of file definition.cpp.
References Config_getBool, DString::empty(), getFileContentsDisk(), getFileContentsPipe(), and getFileFilter().
Referenced by readCodeFragment().
|
inlineprivate |
reads the fragment start at startLine and ending at endLine from file fileName into buffer str
Definition at line 651 of file definition.cpp.
References getFragmentLocation(), m_lineOffsets, m_mutex, readFragmentFromFile(), shrinkBuffer(), and DString::str().
Referenced by getFileContents().
|
inlineprivate |
Definition at line 567 of file definition.cpp.
References ASSERT, 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 DString::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 693 of file definition.cpp.
References ASSERT.
Referenced by getFileContentsDisk(), getFileContentsPipe(), and shrinkBuffer().
|
static |
Definition at line 740 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 724 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 707 of file definition.cpp.
References ASSERT, compileLineOffsets(), getFragmentLocation(), m_lineOffsets, and DString::str().
Referenced by getFileContentsDisk(), and getFileContentsPipe().
|
private |
Definition at line 734 of file definition.cpp.
Referenced by getFileContentsPipe().
|
private |
Definition at line 737 of file definition.cpp.
Referenced by FilterCache(), and getFileContentsPipe().
|
private |
Definition at line 735 of file definition.cpp.
Referenced by compileLineOffsets(), getFileContentsDisk(), getFileContentsPipe(), and shrinkBuffer().
|
private |
Definition at line 736 of file definition.cpp.
Referenced by getFileContentsDisk(), and getFileContentsPipe().