| 1085 | } |
| 1086 | |
| 1087 | const char* SimXMLDocument::readComment( S32 index ) |
| 1088 | { |
| 1089 | // Clear the current attribute pointer |
| 1090 | m_CurrentAttribute = 0; |
| 1091 | |
| 1092 | // Push the first element found under the current element of the given name |
| 1093 | if(!m_paNode.empty()) |
| 1094 | { |
| 1095 | const S32 iLastElement = m_paNode.size() - 1; |
| 1096 | TiXmlElement* pNode = m_paNode[iLastElement]; |
| 1097 | if(!pNode) |
| 1098 | { |
| 1099 | return ""; |
| 1100 | } |
| 1101 | TiXmlNode* node = pNode->FirstChild(); |
| 1102 | for( S32 i = 0; i < index; i++ ) |
| 1103 | { |
| 1104 | if( !node ) |
| 1105 | return ""; |
| 1106 | |
| 1107 | node = node->NextSiblingElement(); |
| 1108 | } |
| 1109 | |
| 1110 | if( node ) |
| 1111 | { |
| 1112 | TiXmlComment* comment = node->ToComment(); |
| 1113 | if( comment ) |
| 1114 | return comment->Value(); |
| 1115 | } |
| 1116 | } |
| 1117 | else |
| 1118 | { |
| 1119 | if(!m_qDocument) |
| 1120 | { |
| 1121 | return ""; |
| 1122 | } |
| 1123 | TiXmlNode* node = m_qDocument->FirstChild(); |
| 1124 | for( S32 i = 0; i < index; i++ ) |
| 1125 | { |
| 1126 | if( !node ) |
| 1127 | return ""; |
| 1128 | |
| 1129 | node = node->NextSibling(); |
| 1130 | } |
| 1131 | |
| 1132 | if( node ) |
| 1133 | { |
| 1134 | TiXmlComment* comment = node->ToComment(); |
| 1135 | if( comment ) |
| 1136 | return comment->Value(); |
| 1137 | } |
| 1138 | } |
| 1139 | return ""; |
| 1140 | } |
| 1141 | |
| 1142 | DefineEngineMethod( SimXMLDocument, readComment, const char*, ( S32 index ),, |
| 1143 | "Gives the comment at the specified index, if any.\n\n" |
no test coverage detected