MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / ReadValue

Method ReadValue

lesson7-Detection/src/utils/tinyxmlparser.cpp:1179–1247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1177
1178
1179const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
1180{
1181 TiXmlDocument* document = GetDocument();
1182
1183 // Read in text and elements in any order.
1184 const char* pWithWhiteSpace = p;
1185 p = SkipWhiteSpace( p, encoding );
1186
1187 while ( p && *p )
1188 {
1189 if ( *p != '<' )
1190 {
1191 // Take what we have, make a text element.
1192 TiXmlText* textNode = new TiXmlText( "" );
1193
1194 if ( !textNode )
1195 {
1196 return 0;
1197 }
1198
1199 if ( TiXmlBase::IsWhiteSpaceCondensed() )
1200 {
1201 p = textNode->Parse( p, data, encoding );
1202 }
1203 else
1204 {
1205 // Special case: we want to keep the white space
1206 // so that leading spaces aren't removed.
1207 p = textNode->Parse( pWithWhiteSpace, data, encoding );
1208 }
1209
1210 if ( !textNode->Blank() )
1211 LinkEndChild( textNode );
1212 else
1213 delete textNode;
1214 }
1215 else
1216 {
1217 // We hit a '<'
1218 // Have we hit a new element or an end tag? This could also be
1219 // a TiXmlText in the "CDATA" style.
1220 if ( StringEqual( p, "</", false, encoding ) )
1221 {
1222 return p;
1223 }
1224 else
1225 {
1226 TiXmlNode* node = Identify( p, encoding );
1227 if ( node )
1228 {
1229 p = node->Parse( p, data, encoding );
1230 LinkEndChild( node );
1231 }
1232 else
1233 {
1234 return 0;
1235 }
1236 }

Callers

nothing calls this directly

Calls 3

ParseMethod · 0.80
BlankMethod · 0.80
SetErrorMethod · 0.80

Tested by

no test coverage detected