diff options
author | crupest <crupest@outlook.com> | 2022-01-01 01:28:21 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-01 01:28:21 +0800 |
commit | 96a93e17baaff2c2050eba2afada639e93001232 (patch) | |
tree | 4e1625c0004b711c0bcf5c774ad37b54e3975de1 /include/cru/xml/XmlParser.hpp | |
parent | 4e92e8709b30c385e1a88d7d4f76c50ee4a3d736 (diff) | |
download | cru-96a93e17baaff2c2050eba2afada639e93001232.tar.gz cru-96a93e17baaff2c2050eba2afada639e93001232.tar.bz2 cru-96a93e17baaff2c2050eba2afada639e93001232.zip |
...
Diffstat (limited to 'include/cru/xml/XmlParser.hpp')
-rw-r--r-- | include/cru/xml/XmlParser.hpp | 22 |
1 files changed, 19 insertions, 3 deletions
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 <optional> 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<XmlNode> root_node_; + XmlElementNode* cache_; + + XmlElementNode* pseudo_root_node_ = new XmlElementNode(u"$root"); + XmlElementNode* current_ = pseudo_root_node_; + int current_position_ = 0; }; } // namespace cru::xml |