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

Method readComment

Engine/source/console/SimXMLDocument.cpp:1103–1156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1101}
1102
1103const char* SimXMLDocument::readComment( S32 index )
1104{
1105 // Clear the current attribute pointer
1106 m_CurrentAttribute = 0;
1107
1108 // Push the first element found under the current element of the given name
1109 if(!m_paNode.empty())
1110 {
1111 const S32 iLastElement = m_paNode.size() - 1;
1112 tinyxml2::XMLNode* pNode = m_paNode[iLastElement];
1113 if(!pNode)
1114 {
1115 return "";
1116 }
1117 tinyxml2::XMLNode* node = pNode->FirstChild();
1118 for( S32 i = 0; i < index; i++ )
1119 {
1120 if( !node )
1121 return "";
1122
1123 node = node->NextSiblingElement();
1124 }
1125
1126 if( node )
1127 {
1128 tinyxml2::XMLComment* comment = node->ToComment();
1129 if( comment )
1130 return comment->Value();
1131 }
1132 }
1133 else
1134 {
1135 if(!m_qDocument)
1136 {
1137 return "";
1138 }
1139 tinyxml2::XMLNode* node = m_qDocument->FirstChild();
1140 for( S32 i = 0; i < index; i++ )
1141 {
1142 if( !node )
1143 return "";
1144
1145 node = node->NextSibling();
1146 }
1147
1148 if( node )
1149 {
1150 tinyxml2::XMLComment* comment = node->ToComment();
1151 if( comment )
1152 return comment->Value();
1153 }
1154 }
1155 return "";
1156}
1157
1158DefineEngineMethod( SimXMLDocument, readComment, const char*, ( S32 index ),,
1159 "Gives the comment at the specified index, if any.\n\n"

Callers 1

SimXMLDocument.cppFile · 0.80

Calls 4

NextSiblingElementMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected