MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / InsertAfterChild

Method InsertAfterChild

Libraries/tinyxml/tinyxml.cpp:280–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278
279
280TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
281{
282 if ( !afterThis || afterThis->parent != this ) {
283 return 0;
284 }
285 if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
286 {
287 if ( GetDocument() )
288 GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
289 return 0;
290 }
291
292 TiXmlNode* node = addThis.Clone();
293 if ( !node )
294 return 0;
295 node->parent = this;
296
297 node->prev = afterThis;
298 node->next = afterThis->next;
299 if ( afterThis->next )
300 {
301 afterThis->next->prev = node;
302 }
303 else
304 {
305 assert( lastChild == afterThis );
306 lastChild = node;
307 }
308 afterThis->next = node;
309 return node;
310}
311
312
313TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )

Callers 1

mainFunction · 0.45

Calls 4

GetDocumentFunction · 0.85
TypeMethod · 0.45
SetErrorMethod · 0.45
CloneMethod · 0.45

Tested by 1

mainFunction · 0.36