diff options
author | crupest <crupest@outlook.com> | 2022-01-24 22:14:37 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-24 22:14:37 +0800 |
commit | 24e1dc8723aea1e46a3aa15794747f3fa52f8eca (patch) | |
tree | 0c879b38647307d25325eb8f9993a7f690fb46b2 /src/xml | |
parent | 72402c09d45b696cd58a65b4a141a804e1cd9371 (diff) | |
download | cru-24e1dc8723aea1e46a3aa15794747f3fa52f8eca.tar.gz cru-24e1dc8723aea1e46a3aa15794747f3fa52f8eca.tar.bz2 cru-24e1dc8723aea1e46a3aa15794747f3fa52f8eca.zip |
...
Diffstat (limited to 'src/xml')
-rw-r--r-- | src/xml/XmlNode.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xml/XmlNode.cpp b/src/xml/XmlNode.cpp index 5c6294c8..79847544 100644 --- a/src/xml/XmlNode.cpp +++ b/src/xml/XmlNode.cpp @@ -32,6 +32,15 @@ void XmlElementNode::AddChild(XmlNode* child) { child->parent_ = this; } +XmlElementNode* XmlElementNode::GetFirstChildElement() const { + for (auto child : children_) { + if (child->GetType() == XmlNode::Type::Element) { + return child->AsElement(); + } + } + return nullptr; +} + XmlNode* XmlElementNode::Clone() const { XmlElementNode* node = new XmlElementNode(tag_, attributes_); |