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

Method lastAttribute

Engine/source/console/SimXMLDocument.cpp:666–692  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Obtain the name of the current element's last attribute -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

664// Obtain the name of the current element's last attribute
665// -----------------------------------------------------------------------------
666const char* SimXMLDocument::lastAttribute()
667{
668 // Get the current element
669 if(m_paNode.empty())
670 {
671 return StringTable->EmptyString();
672 }
673 const S32 iLastElement = m_paNode.size() - 1;
674 tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement();
675 if(!pNode)
676 {
677 return StringTable->EmptyString();
678 }
679
680 // Gets its last attribute, if any
681 m_CurrentAttribute = pNode->FirstAttribute();
682 while (m_CurrentAttribute->Next() != NULL)
683 {
684 m_CurrentAttribute = m_CurrentAttribute->Next();
685 }
686 if(!m_CurrentAttribute)
687 {
688 return StringTable->EmptyString();
689 }
690
691 return m_CurrentAttribute->Name();
692}
693
694DefineEngineMethod( SimXMLDocument, lastAttribute, const char*, (),,
695 "@brief Obtain the name of the current Element's last attribute.\n\n"

Callers 1

SimXMLDocument.cppFile · 0.80

Calls 5

EmptyStringMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
NextMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected