MCPcopy Create free account
hub / github.com/DFHack/dfhack / InsertAfterChild

Method InsertAfterChild

depends/tinyxml/tinyxml.cpp:263–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261
262
263TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
264{
265 if ( !afterThis || afterThis->parent != this ) {
266 return 0;
267 }
268 if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
269 {
270 if ( GetDocument() )
271 GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
272 return 0;
273 }
274
275 TiXmlNode* node = addThis.Clone();
276 if ( !node )
277 return 0;
278 node->parent = this;
279
280 node->prev = afterThis;
281 node->next = afterThis->next;
282 if ( afterThis->next )
283 {
284 afterThis->next->prev = node;
285 }
286 else
287 {
288 assert( lastChild == afterThis );
289 lastChild = node;
290 }
291 afterThis->next = node;
292 return node;
293}
294
295
296TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )

Callers

nothing calls this directly

Calls 3

TypeMethod · 0.80
SetErrorMethod · 0.80
CloneMethod · 0.80

Tested by

no test coverage detected