MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / pushChildElement

Method pushChildElement

Engine/source/console/SimXMLDocument.cpp:406–452  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Get true if first child element was successfully pushed onto stack. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

404// Get true if first child element was successfully pushed onto stack.
405// -----------------------------------------------------------------------------
406bool SimXMLDocument::pushChildElement(S32 index)
407{
408 // Clear the current attribute pointer
409 m_CurrentAttribute = 0;
410
411 // Push the first element found under the current element of the given name
412 TiXmlElement* pElement;
413 if(!m_paNode.empty())
414 {
415 const S32 iLastElement = m_paNode.size() - 1;
416 TiXmlElement* pNode = m_paNode[iLastElement];
417 if(!pNode)
418 {
419 return false;
420 }
421 pElement = pNode->FirstChildElement();
422 for( S32 i = 0; i < index; i++ )
423 {
424 if( !pElement )
425 return false;
426
427 pElement = pElement->NextSiblingElement();
428 }
429 }
430 else
431 {
432 if(!m_qDocument)
433 {
434 return false;
435 }
436 pElement = m_qDocument->FirstChildElement();
437 for( S32 i = 0; i < index; i++ )
438 {
439 if( !pElement )
440 return false;
441
442 pElement = pElement->NextSiblingElement();
443 }
444 }
445
446 if(!pElement)
447 {
448 return false;
449 }
450 m_paNode.push_back(pElement);
451 return true;
452}
453
454DefineEngineMethod( SimXMLDocument, pushChildElement, bool, ( S32 index ),,
455 "@brief Push the child Element at the given index onto the stack, making it the current one.\n\n"

Callers 2

SimXMLDocument.cppFile · 0.80
readLayerMethod · 0.80

Calls 5

emptyMethod · 0.45
sizeMethod · 0.45
FirstChildElementMethod · 0.45
NextSiblingElementMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected