Inherited by YGP::ParseAttomic, YGP::ParseEOF, YGP::ParseSequence, and YGP::ParseSkip.
Public Types | |
| enum | errors { PARSE_OK = 0, PARSE_ERROR = 1, PARSE_CB_ERROR = 2, PARSE_CB_ABORT = -1 } |
Public Member Functions | |
| ParseObject (const char *description, bool skipWhitespace=true) | |
| ParseObject (const ParseObject &other) | |
| virtual | ~ParseObject () |
| ParseObject & | operator= (const ParseObject &other) |
| const char * | getDescription () const |
| void | setDescription (const char *desc) |
| void | setSkipWS (bool skipWhitespace) |
| int | parse (Xistream &stream) throw (YGP::ParseError) |
| virtual int | doParse (Xistream &stream, bool optional)=0 |
| virtual int | found (const char *pFoundValue, unsigned int) |
Static Public Member Functions | |
| static void | skipWS (Xistream &stream) |
| static void | freeBuffer () |
Protected Types | |
| enum | objStatus { OK = 0, NO_DESCRIPTION, LAST } |
Protected Member Functions | |
| virtual int | checkIntegrity () const |
Protected Attributes | |
| bool | skip |
If an object is found it is possible to perform an action for this event.
There are 3 kind of parsing objects: Attomic ones, which enables the parsing of some kind of data; special ones, to perform special tasks and sequences to "glue" together a set of objects.
The following attomic objects exists:
The following special objects exists:
The following sequences exists:
All of these classes exists in 3 variants:
Parse.
virtual int found (const char* pFoundValue, unsigned int);
CBParse. This function must have the following prototype:
typedef int (*PARSECALLBACK)(const char*, unsigned int);
OFParse. This methods must have the following prototype:
typedef int (T::*PTCALLBACK)(const char*, unsigned int);
Any of this functions must return the following values (which specifies how the parsing should be continued):
If possible use the error-values in the ParseObject::errors enum.
Possible error values for the callbacks.
enum YGP::ParseObject::objStatus [protected] |
Possible errors of checkIntegrity.
| YGP::ParseObject::ParseObject | ( | const char * | description, | |
| bool | skipWhitespace = true | |||
| ) |
Constructor The description must be valid during the LIFETIME (OR AT LEAST the usage) of the object!
| description | Description of the object (what it parses) | |
| skipWhitespace | Flag if trailing whitespaces should be skipped after sucessfully parsing the object |
| YGP::ParseObject::ParseObject | ( | const ParseObject & | other | ) |
Copy-constructor.
| other | Object to clone |
| YGP::ParseObject::~ParseObject | ( | ) | [virtual] |
Destructor.
| int YGP::ParseObject::checkIntegrity | ( | ) | const [protected, virtual] |
Checks the constraints of the object.
Reimplemented in YGP::ParseAttomic, YGP::ParseExact, YGP::ParseUpperExact, and YGP::ParseSequence.
| virtual int YGP::ParseObject::doParse | ( | Xistream & | stream, | |
| bool | optional | |||
| ) | [pure virtual] |
Method to actual parse the object.
Implemented in YGP::ParseEOF, YGP::ParseSkip, YGP::ParseAttomic, YGP::ParseToText, YGP::ParseSequence, and YGP::ParseSelection.
| int YGP::ParseObject::found | ( | const char * | pFoundValue, | |
| unsigned int | ||||
| ) | [virtual] |
Callback if an object was found.
| Pointer | to found value | |
| Length | of found value |
Reimplemented in YGP::CBParseEOF, YGP::CBParseSkip, YGP::CBParseAttomic, YGP::CBParseText, YGP::CBParseTextEsc, YGP::CBParseQuoted, YGP::CBParseQuotedEsc, YGP::CBParseExact, YGP::CBParseUpperExact, YGP::CBParseToText, YGP::CBParseSequence, YGP::CBParseSelection, YGP::OFParseEOF< T >, YGP::OFParseSkip< T >, YGP::OFParseAttomic< T >, YGP::OFParseText< T >, YGP::OFParseTextEsc< T >, YGP::OFParseQuoted< T >, YGP::OFParseQuotedEsc< T >, YGP::OFParseExact< T >, YGP::OFParseUpperExact< T >, YGP::OFParseToText< T >, YGP::OFParseSequence< T >, YGP::OFParseSelection< T >, YGP::OFParseAttomic< ISectionParser >, YGP::OFParseAttomic< INISection >, and YGP::OFParseText< INISection >.
| void YGP::ParseObject::freeBuffer | ( | ) | [static] |
Frees the buffer internally used while parsing.
| const char* YGP::ParseObject::getDescription | ( | ) | const [inline] |
Returns the description of the object.
| ParseObject & YGP::ParseObject::operator= | ( | const ParseObject & | other | ) |
Assignment-operator.
| other | Object to clone |
Reference to this | int YGP::ParseObject::parse | ( | Xistream & | stream | ) | throw (YGP::ParseError) [inline] |
Tries to parse the object; See parseObject() for a detailed description.
| void YGP::ParseObject::setDescription | ( | const char * | desc | ) | [inline] |
Sets the description for the object.
| void YGP::ParseObject::setSkipWS | ( | bool | skipWhitespace | ) | [inline] |
If skipWhitespace is true, trailing whitespaces are skipped.
| void YGP::ParseObject::skipWS | ( | Xistream & | stream | ) | [static] |
Skips all whitespace characters (blank, tabulator, carriage return and line feed) from the current position in the passed stream (if the object.
| stream | Source from which to read |
bool YGP::ParseObject::skip [protected] |
Flag, if whitespaces should be skipped.