#include <ulxr_xmlparse_base.h>
Inheritance diagram for ulxr::XmlParserBase:
Public Types | |
enum | State { eNone, eUnknown, eXmlParserLast } |
Public Member Functions | |
XmlParserBase () | |
Constructs a parser. | |
virtual | ~XmlParserBase () |
Destroys the parser. | |
bool | isComplete () const |
Tests if parsing has completed. | |
void | setComplete (bool comp) |
Sets the complete state. | |
virtual int | parse (const char *buffer, int len, int isFinal)=0 |
Parse a pice of xml data. | |
virtual unsigned | getErrorCode () const=0 |
Gets the code for the current error. | |
virtual CppString | getErrorString (unsigned code) const =0 |
Gets the description for an error code. | |
virtual int | getCurrentLineNumber () const=0 |
Gets the line number in the xml data. | |
virtual int | mapToFaultCode (int xpatcode) const =0 |
Maps expat error codes to xml-rpc error codes. | |
Protected Member Functions | |
void | clearStates () |
Removes all states from the state stack. | |
Protected Attributes | |
std::stack< ParserState * > | states |
Private Attributes | |
bool | complete |
Classes | |
class | ParserState |
Helper class to represent the data of the current parsing step. More... |
Definition at line 52 of file ulxr_xmlparse_base.h.
eNone | state after start |
eUnknown | unknwon state when an error occured |
eXmlParserLast | used to chain next parser class |
Definition at line 108 of file ulxr_xmlparse_base.h.
ulxr::XmlParserBase::XmlParserBase | ( | ) |
Constructs a parser.
Definition at line 39 of file ulxr_xmlparse_base.cpp.
References complete, ULXR_PCHAR, and ULXR_TRACE.
ulxr::XmlParserBase::~XmlParserBase | ( | ) | [virtual] |
Destroys the parser.
The derived class is responsible for cleaning up stack<ParserState*>.
Definition at line 46 of file ulxr_xmlparse_base.cpp.
bool ulxr::XmlParserBase::isComplete | ( | ) | const |
Tests if parsing has completed.
Completed means that all opening tags have been correctly closed.
Definition at line 60 of file ulxr_xmlparse_base.cpp.
void ulxr::XmlParserBase::setComplete | ( | bool | comp | ) |
Sets the complete state.
comp | true if file read |
Definition at line 66 of file ulxr_xmlparse_base.cpp.
virtual int ulxr::XmlParserBase::parse | ( | const char * | buffer, | |
int | len, | |||
int | isFinal | |||
) | [pure virtual] |
Parse a pice of xml data.
buffer | pointer start of next data chunk | |
len | len of this chunk | |
isFinal | true: last call to parser |
Implemented in ulxr::ExpatWrapper, and ulxr::WbXmlParser.
virtual unsigned ulxr::XmlParserBase::getErrorCode | ( | ) | const [pure virtual] |
Gets the code for the current error.
Implemented in ulxr::ExpatWrapper, and ulxr::WbXmlParser.
virtual CppString ulxr::XmlParserBase::getErrorString | ( | unsigned | code | ) | const [pure virtual] |
Gets the description for an error code.
code | error code |
Implemented in ulxr::ExpatWrapper, and ulxr::WbXmlParser.
virtual int ulxr::XmlParserBase::getCurrentLineNumber | ( | ) | const [pure virtual] |
Gets the line number in the xml data.
Because the binary data has nothing like a line number, the occurence number of the previous tag is returned.
Implemented in ulxr::ExpatWrapper, and ulxr::WbXmlParser.
virtual int ulxr::XmlParserBase::mapToFaultCode | ( | int | xpatcode | ) | const [pure virtual] |
Maps expat error codes to xml-rpc error codes.
xpatcode | error code from expat |
Implemented in ulxr::ExpatWrapper, and ulxr::WbXmlParser.
void ulxr::XmlParserBase::clearStates | ( | ) | [protected] |
std::stack<ParserState*> ulxr::XmlParserBase::states [protected] |
Definition at line 187 of file ulxr_xmlparse_base.h.
Referenced by ulxr::ValueParser::ValueParser(), ulxr::ValueParserWb::ValueParserWb(), ulxr::ValueParser::~ValueParser(), and ulxr::ValueParserWb::~ValueParserWb().
bool ulxr::XmlParserBase::complete [private] |