| 984 | |
| 985 | |
| 986 | XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) |
| 987 | { |
| 988 | TIXMLASSERT( addThis ); |
| 989 | if ( addThis->_document != _document ) { |
| 990 | TIXMLASSERT( false ); |
| 991 | return 0; |
| 992 | } |
| 993 | |
| 994 | TIXMLASSERT( afterThis ); |
| 995 | |
| 996 | if ( afterThis->_parent != this ) { |
| 997 | TIXMLASSERT( false ); |
| 998 | return 0; |
| 999 | } |
| 1000 | if ( afterThis == addThis ) { |
| 1001 | // Current state: BeforeThis -> AddThis -> OneAfterAddThis |
| 1002 | // Now AddThis must disappear from it's location and then |
| 1003 | // reappear between BeforeThis and OneAfterAddThis. |
| 1004 | // So just leave it where it is. |
| 1005 | return addThis; |
| 1006 | } |
| 1007 | |
| 1008 | if ( afterThis->_next == 0 ) { |
| 1009 | // The last node or the only node. |
| 1010 | return InsertEndChild( addThis ); |
| 1011 | } |
| 1012 | InsertChildPreamble( addThis ); |
| 1013 | addThis->_prev = afterThis; |
| 1014 | addThis->_next = afterThis->_next; |
| 1015 | afterThis->_next->_prev = addThis; |
| 1016 | afterThis->_next = addThis; |
| 1017 | addThis->_parent = this; |
| 1018 | return addThis; |
| 1019 | } |
| 1020 | |
| 1021 | |
| 1022 |
nothing calls this directly
no outgoing calls
no test coverage detected