MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / InsertBeforeChild

Method InsertBeforeChild

ogsr_engine/xrCore/XML_Parser/tinyxml.cpp:204–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& addThis)
205{
206 if (!beforeThis || beforeThis->parent != this)
207 {
208 return 0;
209 }
210 if (addThis.Type() == TiXmlNode::DOCUMENT)
211 {
212 if (GetDocument())
213 GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN);
214 return 0;
215 }
216
217 TiXmlNode* node = addThis.Clone();
218 if (!node)
219 return 0;
220 node->parent = this;
221
222 node->next = beforeThis;
223 node->prev = beforeThis->prev;
224 if (beforeThis->prev)
225 {
226 beforeThis->prev->next = node;
227 }
228 else
229 {
230 assert(firstChild == beforeThis);
231 firstChild = node;
232 }
233 beforeThis->prev = node;
234 return node;
235}
236
237TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& addThis)
238{

Callers

nothing calls this directly

Calls 3

SetErrorMethod · 0.80
CloneMethod · 0.80
TypeMethod · 0.45

Tested by

no test coverage detected