MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / readComment

Method readComment

engine/source/persistence/SimXMLDocument.cpp:735–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735const char* SimXMLDocument::readComment( S32 index )
736{
737 // Clear the current attribute pointer
738 m_CurrentAttribute = 0;
739
740 // Push the first element found under the current element of the given name
741 if(!m_paNode.empty())
742 {
743 const int iLastElement = m_paNode.size() - 1;
744 TiXmlElement* pNode = m_paNode[iLastElement];
745 if(!pNode)
746 {
747 return "";
748 }
749 TiXmlNode* node = pNode->FirstChild();
750 for( S32 i = 0; i < index; i++ )
751 {
752 if( !node )
753 return "";
754
755 node = node->NextSiblingElement();
756 }
757
758 if( node )
759 {
760 TiXmlComment* comment = node->ToComment();
761 if( comment )
762 return comment->Value();
763 }
764 }
765 else
766 {
767 if(!m_qDocument)
768 {
769 return "";
770 }
771 TiXmlNode* node = m_qDocument->FirstChild();
772 for( S32 i = 0; i < index; i++ )
773 {
774 if( !node )
775 return "";
776
777 node = node->NextSibling();
778 }
779
780 if( node )
781 {
782 TiXmlComment* comment = node->ToComment();
783 if( comment )
784 return comment->Value();
785 }
786 }
787 return "";
788}
789
790void SimXMLDocument::addText(const char* text)
791{

Callers 1

Calls 7

emptyMethod · 0.45
sizeMethod · 0.45
FirstChildMethod · 0.45
NextSiblingElementMethod · 0.45
ToCommentMethod · 0.45
ValueMethod · 0.45
NextSiblingMethod · 0.45

Tested by

no test coverage detected