restore terminal, rework console

This commit is contained in:
Eduardo Bart
2012-01-07 15:36:58 -02:00
parent a3721b3a11
commit c4b2dd18d6
25 changed files with 265 additions and 143 deletions

View File

@@ -95,6 +95,13 @@ void OTMLNode::addChild(const OTMLNodePtr& newChild)
for(const OTMLNodePtr& node : m_children) {
if(node->tag() == newChild->tag() && (node->isUnique() || newChild->isUnique())) {
newChild->setUnique(true);
if(node->hasChildren() && newChild->hasChildren()) {
OTMLNodePtr tmpNode = node->clone();
tmpNode->merge(newChild);
newChild->copy(tmpNode);
}
replaceChild(node, newChild);
// remove any other child with the same tag
@@ -140,6 +147,18 @@ bool OTMLNode::replaceChild(const OTMLNodePtr& oldChild, const OTMLNodePtr& newC
return false;
}
void OTMLNode::copy(const OTMLNodePtr& node)
{
setTag(node->tag());
setValue(node->value());
setUnique(node->isUnique());
setNull(node->isNull());
setSource(node->source());
clear();
for(const OTMLNodePtr& child : node->m_children)
addChild(child->clone());
}
void OTMLNode::merge(const OTMLNodePtr& node)
{
for(const OTMLNodePtr& child : node->m_children)