ContRap-Core
|
Class XMLParser is an event driven base class to parse XML formatted strings. More...
#include <xmlparser.h>
Public Member Functions | |
XMLParser (const std::string &text="") | |
Creates a new parser. | |
virtual | ~XMLParser () |
Cleans up the memory. | |
void | set_text (const std::string &text) |
Sets the formatted text string and parses the contents. | |
void | parse () |
Parses the current text. | |
Protected Member Functions | |
void | parse (StringTokenizer &tokenizer, const std::string &tag) |
Parser functions. | |
bool | parse_attributes (const std::string &tag, StringTokenizer &tokenizer, std::map< std::string, std::string > &attributes) |
virtual bool | start () |
Start function is called when the parser is entered with new data. | |
virtual bool | enter (const std::string &tag, std::map< std::string, std::string > &attributes, bool end) |
Event functions are called on entering, parsing and leaving tags. | |
virtual bool | content (const std::string &tag, std::map< std::string, std::string > &attributes, const std::string &value, int count) |
virtual bool | leave (const std::string &tag, std::map< std::string, std::string > &attributes) |
Protected Attributes | |
std::string | text |
Text. |
crp::XMLParser::XMLParser | ( | const std::string & | text = "" | ) |
Creates a new parser.
text | XML-formatted string |
virtual crp::XMLParser::~XMLParser | ( | ) | [virtual] |
Cleans up the memory.
virtual bool crp::XMLParser::content | ( | const std::string & | tag, |
std::map< std::string, std::string > & | attributes, | ||
const std::string & | value, | ||
int | count | ||
) | [protected, virtual] |
Reimplemented in crp::XMLDataPool, crp::XMLPool, and crp::XMLTextLayout.
virtual bool crp::XMLParser::enter | ( | const std::string & | tag, |
std::map< std::string, std::string > & | attributes, | ||
bool | end | ||
) | [protected, virtual] |
Event functions are called on entering, parsing and leaving tags.
A false returned by an event function results in an error break.
Reimplemented in crp::XMLDataPool, crp::XMLPool, and crp::XMLTextLayout.
virtual bool crp::XMLParser::leave | ( | const std::string & | tag, |
std::map< std::string, std::string > & | attributes | ||
) | [protected, virtual] |
Reimplemented in crp::XMLDataPool, crp::XMLPool, and crp::XMLTextLayout.
void crp::XMLParser::parse | ( | ) |
Parses the current text.
void crp::XMLParser::parse | ( | StringTokenizer & | tokenizer, |
const std::string & | tag | ||
) | [protected] |
Parser functions.
bool crp::XMLParser::parse_attributes | ( | const std::string & | tag, |
StringTokenizer & | tokenizer, | ||
std::map< std::string, std::string > & | attributes | ||
) | [protected] |
void crp::XMLParser::set_text | ( | const std::string & | text | ) |
Sets the formatted text string and parses the contents.
text | Text to layout |
Reimplemented in crp::XMLTextLayout.
virtual bool crp::XMLParser::start | ( | ) | [protected, virtual] |
Start function is called when the parser is entered with new data.
Reimplemented in crp::XMLDataPool, and crp::XMLPool.
std::string crp::XMLParser::text [protected] |
Text.