summaryrefslogtreecommitdiffstats
path: root/src/xml/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml/node.h')
-rw-r--r--src/xml/node.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/xml/node.h b/src/xml/node.h
index c32508eec..17e09b5fa 100644
--- a/src/xml/node.h
+++ b/src/xml/node.h
@@ -351,7 +351,21 @@ public:
* @param after The node after which the inserted node should be placed, or NULL
*/
virtual void addChild(Node *child, Node *after)=0;
-
+
+ /**
+ * @brief Insert another node as a child of this node
+ *
+ * This is more efficient than appendChild() + setPosition().
+ *
+ * @param child The node to insert
+ * @param pos The position in parent's child order
+ */
+ void addChildAtPos(Node *child, unsigned pos)
+ {
+ Node *after = (pos == 0) ? nullptr : nthChild(pos - 1);
+ addChild(child, after);
+ }
+
/**
* @brief Append a node as the last child of this node
* @param child The node to append