Inherits YGP::ParseSequence.
Inherited by YGP::CBParseSelection, and YGP::OFParseSelection< T >.
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 () |
ParseSelection & | operator= (const ParseSelection &other) |
Protected Member Functions | |
virtual int | doParse (Xistream &stream, bool optional) throw (YGP::ParseError) |
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.
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.
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 |
YGP::ParseSelection::ParseSelection | ( | const ParseSelection & | other | ) |
Copy-constructor.
other | Object to clone |
YGP::ParseSelection::~ParseSelection | ( | ) | [virtual] |
Destructor.
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.
stream | Source from which to read | |
optional | Flag, if node must be found |
YGP::ParseError | In case of a not recoverable error |
Reimplemented from YGP::ParseSequence.
ParseSelection & YGP::ParseSelection::operator= | ( | const ParseSelection & | other | ) |