diff options
Diffstat (limited to 'include/cru/xml/XmlNode.hpp')
-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); |