tibia-client/src/framework/otml/otmlparser.h

38 lines
860 B
C
Raw Normal View History

2011-07-13 23:12:36 +02:00
#ifndef OTMLPARSER_H
#define OTMLPARSER_H
2011-07-17 08:56:57 +02:00
#include <otml/otmlnode.h>
2011-07-13 23:12:36 +02:00
2011-07-17 08:56:57 +02:00
#include <istream>
2011-07-13 23:12:36 +02:00
class OTMLParser
{
public:
OTMLParser(std::istream& in, std::string what = "");
~OTMLParser();
OTMLNode* getDocument() const { return m_rootNode; }
2011-07-17 08:56:57 +02:00
std::string what() { return m_rootNode->what(); }
2011-07-13 23:12:36 +02:00
void throwError(const std::string& message, int line);
protected:
void parse();
void parseLine(std::string line);
void parseNode(OTMLNode* node, std::string data);
void parseNodeValue(OTMLNode* node, std::string value);
void parseTextValue(std::string& value);
void parseTokens(std::string data, std::vector<std::string>& out);
private:
int m_currentDepth;
int m_currentLine;
OTMLNode* m_rootNode;
OTMLNode* m_currentParent;
OTMLNode* m_previousNode;
std::istream& m_in;
};
#endif // OTMLPARSER_H