| 954 | |
| 955 | |
| 956 | XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) |
| 957 | { |
| 958 | TIXMLASSERT( addThis ); |
| 959 | if ( addThis->_document != _document ) { |
| 960 | TIXMLASSERT( false ); |
| 961 | return 0; |
| 962 | } |
| 963 | |
| 964 | TIXMLASSERT( afterThis ); |
| 965 | |
| 966 | if ( afterThis->_parent != this ) { |
| 967 | TIXMLASSERT( false ); |
| 968 | return 0; |
| 969 | } |
| 970 | if ( afterThis == addThis ) { |
| 971 | // Current state: BeforeThis -> AddThis -> OneAfterAddThis |
| 972 | // Now AddThis must disappear from it's location and then |
| 973 | // reappear between BeforeThis and OneAfterAddThis. |
| 974 | // So just leave it where it is. |
| 975 | return addThis; |
| 976 | } |
| 977 | |
| 978 | if ( afterThis->_next == 0 ) { |
| 979 | // The last node or the only node. |
| 980 | return InsertEndChild( addThis ); |
| 981 | } |
| 982 | InsertChildPreamble( addThis ); |
| 983 | addThis->_prev = afterThis; |
| 984 | addThis->_next = afterThis->_next; |
| 985 | afterThis->_next->_prev = addThis; |
| 986 | afterThis->_next = addThis; |
| 987 | addThis->_parent = this; |
| 988 | return addThis; |
| 989 | } |
| 990 | |
| 991 | |
| 992 |
no outgoing calls
no test coverage detected