MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / InsertBeforeChild

Method InsertBeforeChild

engine/source/persistence/tinyXML/tinyxml.cpp:214–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213
214TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
215{
216 if ( !beforeThis || beforeThis->parent != this ) {
217 return 0;
218 }
219 if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
220 {
221 if ( GetDocument() )
222 GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
223 return 0;
224 }
225
226 TiXmlNode* node = addThis.Clone();
227 if ( !node )
228 return 0;
229 node->parent = this;
230
231 node->next = beforeThis;
232 node->prev = beforeThis->prev;
233 if ( beforeThis->prev )
234 {
235 beforeThis->prev->next = node;
236 }
237 else
238 {
239 assert( firstChild == beforeThis );
240 firstChild = node;
241 }
242 beforeThis->prev = node;
243 return node;
244}
245
246
247TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )

Callers

nothing calls this directly

Calls 3

TypeMethod · 0.80
SetErrorMethod · 0.80
CloneMethod · 0.45

Tested by

no test coverage detected