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

Method pushChildElement

Engine/source/console/SimXMLDocument.cpp:408–454  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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

Tested by

no test coverage detected