summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-24 00:29:20 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-24 00:29:20 +0200
commitf673b6b8154c0d4d85a474a60f3896db681dd25c (patch)
treeaff55c807eb9e9268e8319c490ec8c049cd87797 /src/Common
parentdff7c00a0c2c3fcb64efd611d70398d711ad861b (diff)
downloadmad-f673b6b8154c0d4d85a474a60f3896db681dd25c.tar
mad-f673b6b8154c0d4d85a474a60f3896db681dd25c.zip
XmlPacket: insertEntry(): Eingef?gten Eintrag korrekt einordnen
Diffstat (limited to 'src/Common')
-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;