Back to the WFC main page
CParsePoint
$Revision: 6 $
Description
This class is built for speed so it breaks all of the OO rules.
It basically is a smart index. It gives you a byte index,
line number and column number for parsing. It makes it easy
to report errors to the user like "Cannot parse gudfiddlebarb
beginning at line 47 column 3."
Construction
inline CParsePoint()
inline CParsePoint( const CParsePoint& source )
-
Constructs the object. The beginning line number is 1 and
the beginning column is 1.
Methods
inline void AutoIncrement( BYTE character )
-
Automatically increments the byte index. If
character
is a new line, line number is incremented and column number is reset to 1.
inline void Copy( const CParsePoint& source )
-
Copies
source
to this object.
inline void Empty( void )
-
Re-initializes the object. The byte index will be set to zero,
the line index and column index will be set to one.
inline DWORD GetIndex( void ) const
-
Returns the byte index.
inline DWORD GetLineIndex( void ) const
-
Returns the column number (beginning at 1) in the current line.
inline DWORD GetLineNumber( void ) const
-
Returns the current line number (beginning at 1).
inline void SetIndex( DWORD index )
-
Sets the byte index.
inline void SetLineIndex( DWORD column_number )
-
Sets the column number.
inline void SetLineNumber( DWORD line_number )
-
Sets the current line number.
inline void IncrementIndex( int steps = 1 )
-
Increments the byte index.
inline void IncrementLineIndex( int steps = 1 )
-
Increments the line column number.
inline void IncrementLineNumber( int steps = 1 )
-
Increments the line number.
Operators
inline CParsePoint& operator = ( const CParsePoint& source )
Calls Copy().
Example
void failed_at_location( const CParsePoint& location )
{
_tprintf( TEXT( "Failed parsing, field began at line number %lu column %lu\n",
location.GetLineNumber(),
location.GetLineIndex() );
}
Copyright, 2000, Samuel R. Blackburn
$Workfile: CParsePoint.cpp $
$Modtime: 1/04/00 5:18a $