C# Class TextParser.Parser

Show file Open project: gratianlup/SecureDelete Class Usage Examples

Public Methods

Method Description
AddFieldsFromAssembly ( string name ) : bool

Add the field from the given assembly as field filters.

AddFieldsFromAssembly ( string name, bool addReferences ) : bool

Add the field from the given assembly as field filters.

AddFieldsFromAssembly ( string name, bool addReferences, string fromNamespace ) : bool

Add the field from the given assembly as field filters.

GetLineNumber ( ) : int

Gets the number of lines the text has.

GetNextBlock ( ) : TextBlock?

Get the next block of text.

InitParsing ( ) : bool

Initialize the parsing engine.

InitParsing ( int startIndex ) : bool

Initialize the parsing engine.

LoadFilters ( IParserFilters filters ) : void

Load the filters from the given IParserFilters object.

LoadText ( StreamReader stream ) : bool

Loads the text from the given stream.

Parser ( ) : System

Default constructor.

Parser ( IParserFilters filters ) : System

Constructor with the possibility to load the word filters.

RemoveAllFilters ( ) : void

Removes all loaded filters.

ResetParser ( ) : void

Resets the parser.

ResetParser ( int startIndex ) : void

Resets the parser.

Private Methods

Method Description
InitParser ( ) : void

Initializes the structures used by the parser.

Called by the constructor.

IsCommentSeparator ( string s ) : TextSeparator?

Checks if the given string is a comment separator.

IsField ( string s ) : bool

Checks if the given string is a field.

Optimized

IsKeyword ( string s ) : bool

Checks if the given string is a keyword.

Optimized

IsNumber ( string s ) : bool

Checks if a string represents a number;

IsOperator ( string s ) : bool

Checks if the given string is an operator.

Optimized

IsPartOfKeywordInvalid ( char c ) : bool

Checks if the given character is part of a string or comment separator.

IsSeparator ( char c ) : bool

Checks if the given string is a separator.

IsStringSeparator ( string s ) : TextSeparator?

Checks if the given string is a string separator.

StringContainsChar ( string s, char c ) : bool

Checks if a string contains a specific character.

Method Details

AddFieldsFromAssembly() public method

Add the field from the given assembly as field filters.
public AddFieldsFromAssembly ( string name ) : bool
name string The name of the assembly or the exact path to it.
return bool

AddFieldsFromAssembly() public method

Add the field from the given assembly as field filters.
public AddFieldsFromAssembly ( string name, bool addReferences ) : bool
name string The name of the assembly or the exact path to it.
addReferences bool Add the fields from the assemblies referenced by the given one.
return bool

AddFieldsFromAssembly() public method

Add the field from the given assembly as field filters.
public AddFieldsFromAssembly ( string name, bool addReferences, string fromNamespace ) : bool
name string The name of the assembly or the exact path to it.
addReferences bool Add the fields from the assemblies referenced by the given one.
fromNamespace string Add fields only from the given namespaces.
return bool

GetLineNumber() public method

Gets the number of lines the text has.
public GetLineNumber ( ) : int
return int

GetNextBlock() public method

Get the next block of text.
public GetNextBlock ( ) : TextBlock?
return TextBlock?

InitParsing() public method

Initialize the parsing engine.
public InitParsing ( ) : bool
return bool

InitParsing() public method

Initialize the parsing engine.
public InitParsing ( int startIndex ) : bool
startIndex int The index in the text from where to start parsing.
return bool

LoadFilters() public method

Load the filters from the given IParserFilters object.
public LoadFilters ( IParserFilters filters ) : void
filters IParserFilters The IParserFilters derived class from where to load the filters.
return void

LoadText() public method

Loads the text from the given stream.
public LoadText ( StreamReader stream ) : bool
stream System.IO.StreamReader The stream from where to load the filters.
return bool

Parser() public method

Default constructor.
public Parser ( ) : System
return System

Parser() public method

Constructor with the possibility to load the word filters.
public Parser ( IParserFilters filters ) : System
filters IParserFilters
return System

RemoveAllFilters() public method

Removes all loaded filters.
public RemoveAllFilters ( ) : void
return void

ResetParser() public method

Resets the parser.
public ResetParser ( ) : void
return void

ResetParser() public method

Resets the parser.
public ResetParser ( int startIndex ) : void
startIndex int The index in the text from where to start parsing.
return void