diff options
author | crupest <crupest@outlook.com> | 2022-01-02 18:59:43 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-02 18:59:43 +0800 |
commit | da3098abe8377a4b7e1d5b00e41af48cccc5696e (patch) | |
tree | 4caf637eb71ea4f4e98d96e6abb8127ffde6ac3d /include/cru/xml | |
parent | 18099ad8f5c24b1c2b1c92238dbc54912eab0406 (diff) | |
download | cru-da3098abe8377a4b7e1d5b00e41af48cccc5696e.tar.gz cru-da3098abe8377a4b7e1d5b00e41af48cccc5696e.tar.bz2 cru-da3098abe8377a4b7e1d5b00e41af48cccc5696e.zip |
...
Diffstat (limited to 'include/cru/xml')
-rw-r--r-- | include/cru/xml/XmlNode.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/cru/xml/XmlNode.hpp b/include/cru/xml/XmlNode.hpp index 186f395c..cf2543c9 100644 --- a/include/cru/xml/XmlNode.hpp +++ b/include/cru/xml/XmlNode.hpp @@ -8,6 +8,7 @@ namespace cru::xml { class XmlElementNode; +class XmlTextNode; class XmlNode { friend XmlElementNode; @@ -29,6 +30,11 @@ class XmlNode { virtual XmlNode* Clone() const = 0; + XmlElementNode* AsElement(); + XmlTextNode* AsText(); + const XmlElementNode* AsElement() const; + const XmlTextNode* AsText() const; + private: const Type type_; XmlElementNode* parent_ = nullptr; @@ -80,6 +86,10 @@ class XmlElementNode : public XmlNode { } const std::vector<XmlNode*> GetChildren() const { return children_; } + int GetChildCount() const { return children_.size(); } + String GetAttribute(const String& key) const { return attributes_.at(key); } + XmlNode* GetChildAt(int index) const { return children_[index]; } + void AddAttribute(String key, String value); void AddChild(XmlNode* child); |