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

Method InsertBeforeChild

Libraries/tinyxml/tinyxml.cpp:247–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246
247TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
248{
249 if ( !beforeThis || beforeThis->parent != this ) {
250 return 0;
251 }
252 if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
253 {
254 if ( GetDocument() )
255 GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
256 return 0;
257 }
258
259 TiXmlNode* node = addThis.Clone();
260 if ( !node )
261 return 0;
262 node->parent = this;
263
264 node->next = beforeThis;
265 node->prev = beforeThis->prev;
266 if ( beforeThis->prev )
267 {
268 beforeThis->prev->next = node;
269 }
270 else
271 {
272 assert( firstChild == beforeThis );
273 firstChild = node;
274 }
275 beforeThis->prev = node;
276 return node;
277}
278
279
280TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )

Callers 1

mainFunction · 0.80

Calls 4

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

Tested by 1

mainFunction · 0.64