YGP::ParseTextEsc Class Reference

Class to parse text until a certain abort-criteria (as in ParseText). More...

Inherits YGP::ParseText.

Inherited by YGP::CBParseTextEsc, YGP::OFParseTextEsc< T >, and YGP::ParseQuotedEsc.

List of all members.

Public Member Functions

 ParseTextEsc (const char *abort, const char *description, unsigned int max, unsigned int min=1, char escape= '\\', bool skipWhitespace=true, bool reportData=true)
 ParseTextEsc (const ParseTextEsc &other)
virtual ~ParseTextEsc ()
ParseTextEscoperator= (const ParseTextEsc &other)

Protected Member Functions

virtual int checkValue (char ch)

Protected Attributes

char esc
char last


Detailed Description

Class to parse text until a certain abort-criteria (as in ParseText).

However, parsing is continued if those characters are preceeded by a escape-character (which "escapes" the special meaning of that character).

Parsing of this element is stopped, if any of the characters in the abort-parameters is found (or the maximal cardinality is reached).

This class enables parsing analogue to strings in C. A C-string is terminated with a quote ("), except if the quote follows a single backslash (\). The only difference is that both quote and backslash can be specified and therefor be every charcter.

See ParseObject for a general description of the parser.


Constructor & Destructor Documentation

YGP::ParseTextEsc::ParseTextEsc ( const char *  abort,
const char *  description,
unsigned int  max,
unsigned int  min = 1,
char  escape = '\\',
bool  skipWhitespace = true,
bool  reportData = true 
)

Constructor; sets the neccessary data of this object.

Parameters:
abort List of valid characters
description Description of the object (what it parses)
max Maximal cardinality, how often can the object be parsed
min Minimal cardinality, how often must the object be parsed
escape Character which escapes characters in value
skipWhitespace Flag if trailing whitespaces should be skipped after sucessfully parsing the object
reportData Flag if parsed data should be stored and reported via the virtual found method
Precondition:
value != NULL && !ParseObjectcheckIntegrity ()

YGP::ParseTextEsc::ParseTextEsc ( const ParseTextEsc other  ) 

Copy-constructor.

Parameters:
other Object to clone

YGP::ParseTextEsc::~ParseTextEsc (  )  [virtual]

Destructor.


Member Function Documentation

int YGP::ParseTextEsc::checkValue ( char  ch  )  [protected, virtual]

Checks if the parsed value is according the abort-list of the object.

Valid are every characters NOT in pValue or even those if they are preceeded ("escaped") by the character specified by escape (unless this itself is preceeded by itself).

Parameters:
ch Char to check
Returns:
int Result; 1 if valid, 0 if not or -1 if character should be ignored

Reimplemented from YGP::ParseText.

Reimplemented in YGP::ParseQuotedEsc.

ParseTextEsc & YGP::ParseTextEsc::operator= ( const ParseTextEsc other  ) 

Assignment-operator.

Parameters:
other Object to clone
Returns:
ParseTextEsc& Reference to this


Member Data Documentation

char YGP::ParseTextEsc::esc [protected]

Character escaping the end character(s).

char YGP::ParseTextEsc::last [protected]

Last parsed character.


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

YGP Version 0.9.31 - Generated on Wed Nov 18 11:25:27 2009 by doxygen 1.5.8