From f673b6b8154c0d4d85a474a60f3896db681dd25c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 24 Jun 2009 00:29:20 +0200 Subject: XmlPacket: insertEntry(): Eingef?gten Eintrag korrekt einordnen --- src/Common/XmlPacket.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Common') 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; -- cgit v1.2.3