From 96a93e17baaff2c2050eba2afada639e93001232 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 1 Jan 2022 01:28:21 +0800 Subject: ... --- include/cru/xml/XmlParser.hpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'include/cru/xml/XmlParser.hpp') diff --git a/include/cru/xml/XmlParser.hpp b/include/cru/xml/XmlParser.hpp index 19f569d1..1d44c46f 100644 --- a/include/cru/xml/XmlParser.hpp +++ b/include/cru/xml/XmlParser.hpp @@ -2,11 +2,17 @@ #include "XmlNode.hpp" +#include "cru/common/Exception.hpp" #include "cru/common/String.hpp" #include namespace cru::xml { +class XmlParsingException : public Exception { + public: + using Exception::Exception; +}; + class XmlParser { public: explicit XmlParser(String xml); @@ -16,14 +22,24 @@ class XmlParser { ~XmlParser(); - XmlNode Parse(); + XmlElementNode* Parse(); private: - XmlNode DoParse(); + XmlElementNode* DoParse(); + + char16_t Read1(); + void ReadSpacesAndDiscard(); + String ReadSpaces(); + String ReadIdenitifier(); + String ReadAttributeString(); private: String xml_; - std::optional root_node_; + XmlElementNode* cache_; + + XmlElementNode* pseudo_root_node_ = new XmlElementNode(u"$root"); + XmlElementNode* current_ = pseudo_root_node_; + int current_position_ = 0; }; } // namespace cru::xml -- cgit v1.2.3