summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/xmlfile.cpp16
-rw-r--r--src/lib/util/xmlfile.h5
2 files changed, 16 insertions, 5 deletions
diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp
index 2ef0acfcf0c..ad4d4e1e8f8 100644
--- a/src/lib/util/xmlfile.cpp
+++ b/src/lib/util/xmlfile.cpp
@@ -268,11 +268,10 @@ void data_node::trim_whitespace()
number of child nodes
-------------------------------------------------*/
-int data_node::count_children() const
+std::size_t data_node::count_children() const
{
- int count = 0;
-
/* loop over children and count */
+ std::size_t count = 0;
for (data_node const *node = get_first_child(); node; node = node->get_next_sibling())
count++;
return count;
@@ -280,6 +279,17 @@ int data_node::count_children() const
/*-------------------------------------------------
+ data_node::count_children - count the
+ number of child nodes
+-------------------------------------------------*/
+
+std::size_t data_node::count_attributes() const
+{
+ return m_attributes.size();
+}
+
+
+/*-------------------------------------------------
data_node::get_child - find the first
child of the specified node with the specified
tag
diff --git a/src/lib/util/xmlfile.h b/src/lib/util/xmlfile.h
index 0780172b0c2..814c27aaede 100644
--- a/src/lib/util/xmlfile.h
+++ b/src/lib/util/xmlfile.h
@@ -89,8 +89,9 @@ public:
data_node *get_parent() { return m_parent; }
data_node const *get_parent() const { return m_parent; }
- // count the number of child nodes
- int count_children() const;
+ // count the number of children
+ std::size_t count_children() const;
+ std::size_t count_attributes() const;
// get the first child
data_node *get_first_child() { return m_first_child; }