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

Method firstAttribute

Engine/source/console/SimXMLDocument.cpp:629–651  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

627// Obtain the name of the current element's first attribute
628// -----------------------------------------------------------------------------
629const char* SimXMLDocument::firstAttribute()
630{
631 // Get the current element
632 if(m_paNode.empty())
633 {
634 return StringTable->EmptyString();
635 }
636 const S32 iLastElement = m_paNode.size() - 1;
637 tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement();
638 if(!pNode)
639 {
640 return StringTable->EmptyString();
641 }
642
643 // Gets its first attribute, if any
644 m_CurrentAttribute = pNode->FirstAttribute();
645 if(!m_CurrentAttribute)
646 {
647 return StringTable->EmptyString();
648 }
649
650 return m_CurrentAttribute->Name();
651}
652
653DefineEngineMethod( SimXMLDocument, firstAttribute, const char*, (),,
654 "@brief Obtain the name of the current Element's first attribute.\n\n"

Callers 1

SimXMLDocument.cppFile · 0.80

Calls 4

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

Tested by

no test coverage detected