mummy  1.0.2
Public Member Functions | Private Attributes
MummyLineOrientedTextFileReader Class Reference

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>

List of all members.

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< LineDataLines
bool ExcludeMarkedLines
gxsys_stl::string BeginExcludeRegex
gxsys_stl::string EndExcludeRegex

Detailed Description

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.


Constructor & Destructor Documentation

Definition at line 23 of file MummyLineOrientedTextFileReader.cxx.

References ExcludeMarkedLines.

Definition at line 34 of file MummyLineOrientedTextFileReader.cxx.


Member Function Documentation

Get the regular expression that delineates a line as the beginning of a "marked as excluded" block.

Returns:
"Begin excluding" regular expression

Definition at line 77 of file MummyLineOrientedTextFileReader.cxx.

References BeginExcludeRegex.

Referenced by Update().

int MummyLineOrientedTextFileReader::GetBtxEtxLevel ( unsigned int  lineNumber) [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.

Parameters:
lineNumber1-based line number
Returns:
Whether the line is in between BTX and ETX markers. 0 if lineNumber is invalid.

Definition at line 262 of file MummyLineOrientedTextFileReader.cxx.

References GetNumberOfLines(), Lines, LogWarning, and mw_NoSuchLineNumber.

Referenced by GetCommentBlockBefore(), GetFirstCommentBlock(), and IsLineExcluded().

Here is the call graph for this function:

void MummyLineOrientedTextFileReader::GetCommentBlockBefore ( unsigned int  lineNumber,
gxsys_stl::vector< gxsys_stl::string > &  block,
unsigned int  smallestAcceptableLineNumber 
) [virtual]

Retrieve the nearest preceding block of comment lines relative to line number 'lineNumber'. Valid 'lineNumber' values are 2 through GetNumberOfLines inclusive.

Parameters:
lineNumber1-based line number
blockvector of strings, one per line
smallestAcceptableLineNumberif 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().

Here is the call graph for this function:

gxsys_stl::string MummyLineOrientedTextFileReader::GetEndExcludeRegex ( ) [virtual]

Get the regular expression that delineates a line as the end of a "marked as excluded" block.

Returns:
"End excluding" regular expression

Definition at line 91 of file MummyLineOrientedTextFileReader.cxx.

References EndExcludeRegex.

Referenced by Update().

Get whether to exclude lines between beginExcludeRegex and endExcludeRegex matching lines when considering lines for documentation.

Returns:
Exclude flag.

Definition at line 63 of file MummyLineOrientedTextFileReader.cxx.

References ExcludeMarkedLines.

Referenced by IsLineExcluded().

gxsys_stl::string MummyLineOrientedTextFileReader::GetFileName ( ) [virtual]

Get the filename.

Returns:
Filename as a string.

Definition at line 40 of file MummyLineOrientedTextFileReader.cxx.

References FileName.

Referenced by MummyGenerator::GetHeaderFileReader(), and Update().

void MummyLineOrientedTextFileReader::GetFirstCommentBlock ( gxsys_stl::vector< gxsys_stl::string > &  block) [virtual]

Retrieve the first block of comment lines, if any, in the file.

Parameters:
blockvector of strings, one per line

Definition at line 382 of file MummyLineOrientedTextFileReader.cxx.

References GetBtxEtxLevel(), GetCommentBlockBefore(), GetIsLineComment(), and GetNumberOfLines().

Referenced by MummyCsharpGenerator::EmitCSharpWrapperClass().

Here is the call graph for this function:

bool MummyLineOrientedTextFileReader::GetIsLineComment ( unsigned int  lineNumber) [virtual]

Query if line number 'lineNumber' is a "line comment." Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive.

Parameters:
lineNumber1-based line number
Returns:
Whether the line is a comment. false if lineNumber is invalid.

Definition at line 249 of file MummyLineOrientedTextFileReader.cxx.

References GetNumberOfLines(), Lines, LogWarning, and mw_NoSuchLineNumber.

Referenced by GetCommentBlockBefore(), and GetFirstCommentBlock().

Here is the call graph for this function:

gxsys_stl::string MummyLineOrientedTextFileReader::GetLine ( unsigned int  lineNumber) [virtual]

Retrieve line number 'lineNumber' as a string from the currently cached text file. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive.

Parameters:
lineNumber1-based line number
Returns:
The line as a string. Empty string if lineNumber is invalid.

Definition at line 236 of file MummyLineOrientedTextFileReader.cxx.

References GetNumberOfLines(), Lines, LogWarning, and mw_NoSuchLineNumber.

Referenced by MummyCsharpGenerator::CacheExternalHints(), and GetCommentBlockBefore().

Here is the call graph for this function:

Retrieve the total number of lines currently cached.

Returns:
The total number of lines.

Definition at line 229 of file MummyLineOrientedTextFileReader.cxx.

References Lines.

Referenced by MummyCsharpGenerator::CacheExternalHints(), GetBtxEtxLevel(), GetCommentBlockBefore(), GetFirstCommentBlock(), GetIsLineComment(), and GetLine().

bool MummyLineOrientedTextFileReader::IsLineExcluded ( unsigned int  lineNumber) [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.

Parameters:
lineNumber1-based line number
Returns:
Whether the line should be excluded.

Definition at line 275 of file MummyLineOrientedTextFileReader.cxx.

References GetBtxEtxLevel(), and GetExcludeMarkedLines().

Referenced by MummyCsharpGenerator::MethodIsWrappable().

Here is the call graph for this function:

void MummyLineOrientedTextFileReader::SetBeginExcludeRegex ( const gxsys_stl::string &  beginExcludeRegex) [virtual]

Set the regular expression that delineates a line as the beginning of a "marked as excluded" block.

Parameters:
beginExcludeRegex"Begin excluding" regular expression

Definition at line 84 of file MummyLineOrientedTextFileReader.cxx.

References BeginExcludeRegex.

Referenced by MummyGenerator::GetHeaderFileReader().

void MummyLineOrientedTextFileReader::SetEndExcludeRegex ( const gxsys_stl::string &  endExcludeRegex) [virtual]

Set the regular expression that delineates a line as the end of a "marked as excluded" block.

Parameters:
endExcludeRegex"End excluding" regular expression

Definition at line 98 of file MummyLineOrientedTextFileReader.cxx.

References EndExcludeRegex.

Referenced by MummyGenerator::GetHeaderFileReader().

void MummyLineOrientedTextFileReader::SetExcludeMarkedLines ( bool  excludeMarkedLines) [virtual]

Set whether to exclude lines between beginExcludeRegex and endExcludeRegex matching lines when considering lines for documentation.

Parameters:
excludeMarkedLinesExclude flag.

Definition at line 70 of file MummyLineOrientedTextFileReader.cxx.

References ExcludeMarkedLines.

Referenced by MummyGenerator::GetHeaderFileReader().

void MummyLineOrientedTextFileReader::SetFileName ( const char *  filename) [virtual]

Set the filename.

Parameters:
filenameFilename

Definition at line 47 of file MummyLineOrientedTextFileReader.cxx.

References FileName, and Update().

Referenced by MummyCsharpGenerator::CacheExternalHints(), MummyGenerator::GetHeaderFileReader(), and IncreaseCoverage().

Here is the call graph for this function:

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().

Here is the call graph for this function:


Member Data Documentation

gxsys_stl::string MummyLineOrientedTextFileReader::FileName [private]
gxsys_stl::vector<LineData> MummyLineOrientedTextFileReader::Lines [private]

The documentation for this class was generated from the following files: