summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Common/XmlPacket.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Common/XmlPacket.h b/src/Common/XmlPacket.h
index b37b783..0811d73 100644
--- a/src/Common/XmlPacket.h
+++ b/src/Common/XmlPacket.h
@@ -411,19 +411,22 @@ class XmlPacket {
return const_iterator(entries.end());
}
- // TODO Correct ordering
iterator insertEntry(iterator it) {
xmlNodePtr newNode = xmlNewNode(0, (xmlChar*)"entry");
- xmlAddChild(elementNode, newNode);
+
+ if(it == end())
+ xmlAddChild(elementNode, newNode);
+ else
+ xmlAddPrevSibling(it->entryNode, newNode);
return iterator(entries.insert(it.it, new Entry(newNode)));
}
- virtual iterator addEntry() {
+ iterator addEntry() {
return insertEntry(end());
}
- virtual void removeEntry(iterator it) {
+ void removeEntry(iterator it) {
xmlUnlinkNode(it->entryNode);
xmlFreeNode(it->entryNode);
delete *it.it;