Test that JsonArray grows after calling add()

This commit is contained in:
Benoit Blanchon
2014-10-05 14:48:19 +02:00
parent cb3c59ec07
commit 4c67d0579a
5 changed files with 22 additions and 15 deletions

View File

@ -32,12 +32,20 @@ bool JsonContainer::operator==(const JsonContainer & other) const
return _node == other._node;
}
void JsonContainer::insertChildAfter(JsonNode* newChild, JsonNode* previous)
void JsonContainer::addChild(JsonNode* newChild)
{
if (previous)
previous->next = newChild;
else
_node->content.asContainer.child = newChild;
JsonNode* lastChild = _node->content.asContainer.child;
if (!lastChild)
{
_node->content.asContainer.child = newChild = newChild;
return;
}
while (lastChild->next)
lastChild = lastChild->next;
lastChild->next = newChild;
}
void JsonContainer::removeChildAfter(JsonNode* child, JsonNode* previous)