YGP::ParseSelection Class Reference

Class to parse a selection of one ParseObject out of a list. More...

Inherits YGP::ParseSequence.

Inherited by YGP::CBParseSelection, and YGP::OFParseSelection< T >.

List of all members.

Public Member Functions

 ParseSelection (ParseObject *apObjectList[], const char *description, unsigned int max=1, unsigned int min=1, bool skipWhitespace=true)
 ParseSelection (const ParseSelection &other)
virtual ~ParseSelection ()
ParseSelectionoperator= (const ParseSelection &other)

Protected Member Functions

virtual int doParse (Xistream &stream, bool optional) throw (YGP::ParseError)


Detailed Description

Class to parse a selection of one ParseObject out of a list.

If an object matching the parsed intput is found, the sequence is considered as parsed successfully.

The found()-method gets the name of the selection passed als first parameter and the number of found entries as second.

See ParseObject for a general description of the parser.


Constructor & Destructor Documentation

YGP::ParseSelection::ParseSelection ( ParseObject apObjectList[],
const char *  description,
unsigned int  max = 1,
unsigned int  min = 1,
bool  skipWhitespace = true 
)

Constructor; sets the neccessary data of this object.

Parameters:
apObjectList NULL-terminated array of pointers to objects to parse
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
skipWhitespace Flag if trailing whitespaces should be skipped after sucessfully parsing the object
Precondition:
apObjectList != NULL && !ParseObjectcheckIntegrity ()

YGP::ParseSelection::ParseSelection ( const ParseSelection other  ) 

Copy-constructor.

Parameters:
other Object to clone

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

Destructor.


Member Function Documentation

int YGP::ParseSelection::doParse ( Xistream stream,
bool  optional 
) throw (YGP::ParseError) [protected, virtual]

Tries to parse the objects of the selection from the stream, until one object reports PARSE_OK.

It is a soft error (PARSE_ERROR) if the minimal cardinality is not fullfilled. If parsing is not optional and/or the error is not recoverable (< 0), an exception (std::string) is thrown.

Parameters:
stream Source from which to read
optional Flag, if node must be found
Returns:
int PARSE_OK if selection found; PARSE_ERROR if not
Exceptions:
YGP::ParseError In case of a not recoverable error

Reimplemented from YGP::ParseSequence.

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

Assignment-operator.

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


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