mummy
1.0.3
|
Class that reads a text file and caches its lines and information about those lines for quick queries based on line numbers. Primarily used to look up code comment documentation blocks just prior to class and method declarations in C++ header files. Initialize by calling SetFileName. More...
#include <MummyLineOrientedTextFileReader.h>
Public Member Functions | |
MummyLineOrientedTextFileReader () | |
virtual | ~MummyLineOrientedTextFileReader () |
virtual gxsys_stl::string | GetFileName () |
Get the filename. | |
virtual void | SetFileName (const char *filename) |
Set the filename. | |
virtual bool | GetExcludeMarkedLines () |
Get whether to exclude lines between beginExcludeRegex and endExcludeRegex matching lines when considering lines for documentation. | |
virtual void | SetExcludeMarkedLines (bool excludeMarkedLines) |
Set whether to exclude lines between beginExcludeRegex and endExcludeRegex matching lines when considering lines for documentation. | |
virtual gxsys_stl::string | GetBeginExcludeRegex () |
Get the regular expression that delineates a line as the beginning of a "marked as excluded" block. | |
virtual void | SetBeginExcludeRegex (const gxsys_stl::string &beginExcludeRegex) |
Set the regular expression that delineates a line as the beginning of a "marked as excluded" block. | |
virtual gxsys_stl::string | GetEndExcludeRegex () |
Get the regular expression that delineates a line as the end of a "marked as excluded" block. | |
virtual void | SetEndExcludeRegex (const gxsys_stl::string &endExcludeRegex) |
Set the regular expression that delineates a line as the end of a "marked as excluded" block. | |
virtual void | Update () |
Read the current text file and cache its lines for subsequent quick lookup by line number. This allows us to retrieve the comment blocks just prior to a given line number and allows us to parse and/or transfer the documentation from the source code to the generated code. | |
virtual unsigned int | GetNumberOfLines () |
Retrieve the total number of lines currently cached. | |
virtual gxsys_stl::string | GetLine (unsigned int lineNumber) |
Retrieve line number 'lineNumber' as a string from the currently cached text file. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive. | |
virtual bool | GetIsLineComment (unsigned int lineNumber) |
Query if line number 'lineNumber' is a "line comment." Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive. | |
virtual int | GetBtxEtxLevel (unsigned int lineNumber) |
Get the current nesting level at line number 'lineNumber' of "//BTX -
//ETX" style wrapper exclusion comments. This should be exactly 0 or 1 because the old VTK wrappers start ignoring at //BTX and do not resume wrapping until the closing //ETX occurs. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive. | |
virtual bool | IsLineExcluded (unsigned int lineNumber) |
Query whether the given line number should be excluded based on the exclude flag and the line number's BtxEtx level. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive. | |
virtual void | GetCommentBlockBefore (unsigned int lineNumber, gxsys_stl::vector< gxsys_stl::string > &block, unsigned int smallestAcceptableLineNumber) |
Retrieve the nearest preceding block of comment lines relative to line number 'lineNumber'. Valid 'lineNumber' values are 2 through GetNumberOfLines inclusive. | |
virtual void | GetFirstCommentBlock (gxsys_stl::vector< gxsys_stl::string > &block) |
Retrieve the first block of comment lines, if any, in the file. |
Private Attributes | |
gxsys_stl::string | FileName |
gxsys_stl::vector< LineData > | Lines |
bool | ExcludeMarkedLines |
gxsys_stl::string | BeginExcludeRegex |
gxsys_stl::string | EndExcludeRegex |
Class that reads a text file and caches its lines and information about those lines for quick queries based on line numbers. Primarily used to look up code comment documentation blocks just prior to class and method declarations in C++ header files. Initialize by calling SetFileName.
Definition at line 45 of file MummyLineOrientedTextFileReader.h.
MummyLineOrientedTextFileReader::MummyLineOrientedTextFileReader | ( | ) |
Definition at line 23 of file MummyLineOrientedTextFileReader.cxx.
References ExcludeMarkedLines.
|
virtual |
Definition at line 34 of file MummyLineOrientedTextFileReader.cxx.
|
virtual |
Get the regular expression that delineates a line as the beginning of a "marked as excluded" block.
Definition at line 77 of file MummyLineOrientedTextFileReader.cxx.
References BeginExcludeRegex.
Referenced by Update().
|
virtual |
Get the current nesting level at line number 'lineNumber' of "//BTX - //ETX" style wrapper exclusion comments. This should be exactly 0 or 1 because the old VTK wrappers start ignoring at //BTX and do not resume wrapping until the closing //ETX occurs. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive.
lineNumber | 1-based line number |
Definition at line 262 of file MummyLineOrientedTextFileReader.cxx.
References GetNumberOfLines(), Lines, LogWarning, and mw_NoSuchLineNumber.
Referenced by GetCommentBlockBefore(), GetFirstCommentBlock(), and IsLineExcluded().
|
virtual |
Retrieve the nearest preceding block of comment lines relative to line number 'lineNumber'. Valid 'lineNumber' values are 2 through GetNumberOfLines inclusive.
lineNumber | 1-based line number |
block | vector of strings, one per line |
smallestAcceptableLineNumber | if the comment block happens before this line an Undocumented Block is returned |
Definition at line 283 of file MummyLineOrientedTextFileReader.cxx.
References FileName, GetBtxEtxLevel(), GetIsLineComment(), GetLine(), GetNumberOfLines(), LogFileLineWarningMsg, LogWarning, mw_NoSuchLineNumber, and mw_UndocumentedEntity.
Referenced by MummyCsharpGenerator::EmitCSharpConstructor(), MummyCsharpGenerator::EmitCSharpDispose(), MummyCsharpGenerator::EmitCSharpEnums(), MummyCsharpGenerator::EmitCSharpEvent(), MummyCsharpGenerator::EmitCSharpMethod(), MummyCsharpGenerator::EmitCSharpProperty(), MummyCsharpGenerator::EmitCSharpWrapperClass(), MummyCsharpGenerator::EmitCSharpWrapperClassAsStruct(), and GetFirstCommentBlock().
|
virtual |
Get the regular expression that delineates a line as the end of a "marked as excluded" block.
Definition at line 91 of file MummyLineOrientedTextFileReader.cxx.
References EndExcludeRegex.
Referenced by Update().
|
virtual |
Get whether to exclude lines between beginExcludeRegex and endExcludeRegex matching lines when considering lines for documentation.
Definition at line 63 of file MummyLineOrientedTextFileReader.cxx.
References ExcludeMarkedLines.
Referenced by IsLineExcluded().
|
virtual |
Get the filename.
Definition at line 40 of file MummyLineOrientedTextFileReader.cxx.
References FileName.
Referenced by MummyGenerator::GetHeaderFileReader(), and Update().
|
virtual |
Retrieve the first block of comment lines, if any, in the file.
block | vector of strings, one per line |
Definition at line 382 of file MummyLineOrientedTextFileReader.cxx.
References GetBtxEtxLevel(), GetCommentBlockBefore(), GetIsLineComment(), and GetNumberOfLines().
Referenced by MummyCsharpGenerator::EmitCSharpWrapperClass().
|
virtual |
Query if line number 'lineNumber' is a "line comment." Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive.
lineNumber | 1-based line number |
Definition at line 249 of file MummyLineOrientedTextFileReader.cxx.
References GetNumberOfLines(), Lines, LogWarning, and mw_NoSuchLineNumber.
Referenced by GetCommentBlockBefore(), and GetFirstCommentBlock().
|
virtual |
Retrieve line number 'lineNumber' as a string from the currently cached text file. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive.
lineNumber | 1-based line number |
Definition at line 236 of file MummyLineOrientedTextFileReader.cxx.
References GetNumberOfLines(), Lines, LogWarning, and mw_NoSuchLineNumber.
Referenced by MummyCsharpGenerator::CacheExternalHints(), and GetCommentBlockBefore().
|
virtual |
Retrieve the total number of lines currently cached.
Definition at line 229 of file MummyLineOrientedTextFileReader.cxx.
References Lines.
Referenced by MummyCsharpGenerator::CacheExternalHints(), GetBtxEtxLevel(), GetCommentBlockBefore(), GetFirstCommentBlock(), GetIsLineComment(), and GetLine().
|
virtual |
Query whether the given line number should be excluded based on the exclude flag and the line number's BtxEtx level. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive.
lineNumber | 1-based line number |
Definition at line 275 of file MummyLineOrientedTextFileReader.cxx.
References GetBtxEtxLevel(), and GetExcludeMarkedLines().
Referenced by MummyCsharpGenerator::MethodIsWrappable().
|
virtual |
Set the regular expression that delineates a line as the beginning of a "marked as excluded" block.
beginExcludeRegex | "Begin excluding" regular expression |
Definition at line 84 of file MummyLineOrientedTextFileReader.cxx.
References BeginExcludeRegex.
Referenced by MummyGenerator::GetHeaderFileReader().
|
virtual |
Set the regular expression that delineates a line as the end of a "marked as excluded" block.
endExcludeRegex | "End excluding" regular expression |
Definition at line 98 of file MummyLineOrientedTextFileReader.cxx.
References EndExcludeRegex.
Referenced by MummyGenerator::GetHeaderFileReader().
|
virtual |
Set whether to exclude lines between beginExcludeRegex and endExcludeRegex matching lines when considering lines for documentation.
excludeMarkedLines | Exclude flag. |
Definition at line 70 of file MummyLineOrientedTextFileReader.cxx.
References ExcludeMarkedLines.
Referenced by MummyGenerator::GetHeaderFileReader().
|
virtual |
Set the filename.
filename | Filename |
Definition at line 47 of file MummyLineOrientedTextFileReader.cxx.
References FileName, and Update().
Referenced by MummyCsharpGenerator::CacheExternalHints(), MummyGenerator::GetHeaderFileReader(), and IncreaseCoverage().
|
virtual |
Read the current text file and cache its lines for subsequent quick lookup by line number. This allows us to retrieve the comment blocks just prior to a given line number and allows us to parse and/or transfer the documentation from the source code to the generated code.
Definition at line 105 of file MummyLineOrientedTextFileReader.cxx.
References BeginExcludeRegex, LineData::BtxEtxLevel, EndExcludeRegex, ExcludeMarkedLines, FileName, GetBeginExcludeRegex(), GetEndExcludeRegex(), GetFileName(), LineData::IsLineComment, LineData::Line, Lines, and Trace().
Referenced by SetFileName().
|
private |
Definition at line 199 of file MummyLineOrientedTextFileReader.h.
Referenced by GetBeginExcludeRegex(), SetBeginExcludeRegex(), and Update().
|
private |
Definition at line 200 of file MummyLineOrientedTextFileReader.h.
Referenced by GetEndExcludeRegex(), SetEndExcludeRegex(), and Update().
|
private |
Definition at line 198 of file MummyLineOrientedTextFileReader.h.
Referenced by GetExcludeMarkedLines(), MummyLineOrientedTextFileReader(), SetExcludeMarkedLines(), and Update().
|
private |
Definition at line 196 of file MummyLineOrientedTextFileReader.h.
Referenced by GetCommentBlockBefore(), GetFileName(), SetFileName(), and Update().
|
private |
Definition at line 197 of file MummyLineOrientedTextFileReader.h.
Referenced by GetBtxEtxLevel(), GetIsLineComment(), GetLine(), GetNumberOfLines(), and Update().