mirror of
https://github.com/edubart/otclient.git
synced 2026-01-02 04:27:11 +01:00
merge total remake
This commit is contained in:
@@ -1,37 +1,33 @@
|
||||
#ifndef OTMLPARSER_H
|
||||
#define OTMLPARSER_H
|
||||
|
||||
#include <otml/otmlnode.h>
|
||||
|
||||
#include <istream>
|
||||
#include "otmldeclarations.h"
|
||||
|
||||
class OTMLParser
|
||||
{
|
||||
public:
|
||||
OTMLParser(std::istream& in, std::string what = "");
|
||||
~OTMLParser();
|
||||
OTMLParser(OTMLDocumentPtr doc, std::istream& in);
|
||||
|
||||
OTMLNode* getDocument() const { return m_rootNode; }
|
||||
std::string what() { return m_rootNode->what(); }
|
||||
|
||||
void throwError(const std::string& message, int line);
|
||||
|
||||
protected:
|
||||
/// Parse the entire document
|
||||
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;
|
||||
/// Retrieve next line from the input stream
|
||||
std::string getNextLine();
|
||||
/// Counts depth of a line (every 2 spaces increments one depth)
|
||||
int getLineDepth(const std::string& line, bool multilining = false);
|
||||
|
||||
/// Parse each line of the input stream
|
||||
void parseLine(std::string line);
|
||||
/// Parse nodes tag and value
|
||||
void parseNode(const std::string& data);
|
||||
|
||||
int currentDepth;
|
||||
int currentLine;
|
||||
OTMLDocumentPtr doc;
|
||||
OTMLNodePtr currentParent;
|
||||
OTMLNodePtr previousNode;
|
||||
std::istream& in;
|
||||
};
|
||||
|
||||
#endif // OTMLPARSER_H
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user