mirror of https://github.com/AxioDL/tinyxml2.git
formatting tweaks
This commit is contained in:
parent
ed52328ced
commit
3b7927efb5
|
@ -638,6 +638,7 @@ void XMLNode::Unlink( XMLNode* child )
|
||||||
if ( child->_next ) {
|
if ( child->_next ) {
|
||||||
child->_next->_prev = child->_prev;
|
child->_next->_prev = child->_prev;
|
||||||
}
|
}
|
||||||
|
child->_parent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -652,10 +653,12 @@ XMLNode* XMLNode::InsertEndChild( XMLNode* addThis )
|
||||||
{
|
{
|
||||||
if (addThis->_document != _document)
|
if (addThis->_document != _document)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (addThis->_parent)
|
if (addThis->_parent)
|
||||||
addThis->_parent->Unlink( addThis );
|
addThis->_parent->Unlink( addThis );
|
||||||
else
|
else
|
||||||
addThis->_memPool->SetTracked();
|
addThis->_memPool->SetTracked();
|
||||||
|
|
||||||
if ( _lastChild ) {
|
if ( _lastChild ) {
|
||||||
TIXMLASSERT( _firstChild );
|
TIXMLASSERT( _firstChild );
|
||||||
TIXMLASSERT( _lastChild->_next == 0 );
|
TIXMLASSERT( _lastChild->_next == 0 );
|
||||||
|
@ -681,10 +684,12 @@ XMLNode* XMLNode::InsertFirstChild( XMLNode* addThis )
|
||||||
{
|
{
|
||||||
if (addThis->_document != _document)
|
if (addThis->_document != _document)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (addThis->_parent)
|
if (addThis->_parent)
|
||||||
addThis->_parent->Unlink( addThis );
|
addThis->_parent->Unlink( addThis );
|
||||||
else
|
else
|
||||||
addThis->_memPool->SetTracked();
|
addThis->_memPool->SetTracked();
|
||||||
|
|
||||||
if ( _firstChild ) {
|
if ( _firstChild ) {
|
||||||
TIXMLASSERT( _lastChild );
|
TIXMLASSERT( _lastChild );
|
||||||
TIXMLASSERT( _firstChild->_prev == 0 );
|
TIXMLASSERT( _firstChild->_prev == 0 );
|
||||||
|
@ -711,7 +716,9 @@ XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis )
|
||||||
{
|
{
|
||||||
if (addThis->_document != _document)
|
if (addThis->_document != _document)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
TIXMLASSERT( afterThis->_parent == this );
|
TIXMLASSERT( afterThis->_parent == this );
|
||||||
|
|
||||||
if ( afterThis->_parent != this ) {
|
if ( afterThis->_parent != this ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1254,7 +1254,7 @@ int main( int argc, const char ** argv )
|
||||||
doc.RootElement()->InsertAfterChild(two, subtree);
|
doc.RootElement()->InsertAfterChild(two, subtree);
|
||||||
XMLPrinter printer2( 0, true );
|
XMLPrinter printer2( 0, true );
|
||||||
doc.Accept( &printer2 );
|
doc.Accept( &printer2 );
|
||||||
XMLTest( "Move node from within <one> after <two>", xmlAfterTwo, printer2.CStr());
|
XMLTest( "Move node from within <one> after <two>", xmlAfterTwo, printer2.CStr(), false );
|
||||||
|
|
||||||
doc.Parse( xml );
|
doc.Parse( xml );
|
||||||
XMLNode* one = doc.RootElement()->FirstChildElement("one");
|
XMLNode* one = doc.RootElement()->FirstChildElement("one");
|
||||||
|
@ -1262,7 +1262,7 @@ int main( int argc, const char ** argv )
|
||||||
doc.RootElement()->InsertAfterChild(one, subtree);
|
doc.RootElement()->InsertAfterChild(one, subtree);
|
||||||
XMLPrinter printer3( 0, true );
|
XMLPrinter printer3( 0, true );
|
||||||
doc.Accept( &printer3 );
|
doc.Accept( &printer3 );
|
||||||
XMLTest( "Move node from within <one> after <one>", xmlAfterOne, printer3.CStr());
|
XMLTest( "Move node from within <one> after <one>", xmlAfterOne, printer3.CStr(), false );
|
||||||
|
|
||||||
doc.Parse( xml );
|
doc.Parse( xml );
|
||||||
subtree = doc.RootElement()->FirstChildElement("one")->FirstChildElement("subtree");
|
subtree = doc.RootElement()->FirstChildElement("one")->FirstChildElement("subtree");
|
||||||
|
@ -1270,7 +1270,7 @@ int main( int argc, const char ** argv )
|
||||||
doc.RootElement()->InsertEndChild(subtree);
|
doc.RootElement()->InsertEndChild(subtree);
|
||||||
XMLPrinter printer4( 0, true );
|
XMLPrinter printer4( 0, true );
|
||||||
doc.Accept( &printer4 );
|
doc.Accept( &printer4 );
|
||||||
XMLTest( "Move node from within <one> after <two>", xmlAfterTwo, printer4.CStr());
|
XMLTest( "Move node from within <one> after <two>", xmlAfterTwo, printer4.CStr(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------- Performance tracking --------------
|
// ----------- Performance tracking --------------
|
||||||
|
|
Loading…
Reference in New Issue