From af43f72adcb6738eebaad505389084c17411a694 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 27 Jan 2022 23:28:18 +0800 Subject: ... --- src/xml/XmlNode.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/xml') 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 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) { -- cgit v1.2.3