aboutsummaryrefslogtreecommitdiff
path: root/src/xml/XmlNode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml/XmlNode.cpp')
-rw-r--r--src/xml/XmlNode.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/xml/XmlNode.cpp b/src/xml/XmlNode.cpp
index 79847544..00437f9b 100644
--- a/src/xml/XmlNode.cpp
+++ b/src/xml/XmlNode.cpp
@@ -1,4 +1,5 @@
#include "cru/xml/XmlNode.hpp"
+#include <algorithm>
namespace cru::xml {
@@ -32,6 +33,12 @@ void XmlElementNode::AddChild(XmlNode* child) {
child->parent_ = this;
}
+Index XmlElementNode::GetChildElementCount() const {
+ return std::count_if(
+ children_.cbegin(), children_.cend(),
+ [](xml::XmlNode* node) { return node->IsElementNode(); });
+}
+
XmlElementNode* XmlElementNode::GetFirstChildElement() const {
for (auto child : children_) {
if (child->GetType() == XmlNode::Type::Element) {