| 306 | } |
| 307 | |
| 308 | const TCHAR* TiXmlBase::ReadText( const TCHAR* p, |
| 309 | TIXML_STRING * text, |
| 310 | bool trimWhiteSpace, |
| 311 | const TCHAR* endTag, |
| 312 | bool caseInsensitive ) |
| 313 | { |
| 314 | *text = TEXT(""); |
| 315 | if ( !trimWhiteSpace // certain tags always keep whitespace |
| 316 | || !condenseWhiteSpace ) // if true, whitespace is always kept |
| 317 | { |
| 318 | // Keep all the white space. |
| 319 | while ( p && *p |
| 320 | && !StringEqual( p, endTag, caseInsensitive ) |
| 321 | ) |
| 322 | { |
| 323 | TCHAR c; |
| 324 | p = GetChar( p, &c ); |
| 325 | (* text) += c; |
| 326 | } |
| 327 | } |
| 328 | else |
| 329 | { |
| 330 | bool whitespace = false; |
| 331 | |
| 332 | // Remove leading white space: |
| 333 | p = SkipWhiteSpace( p ); |
| 334 | while ( p && *p |
| 335 | && !StringEqual( p, endTag, caseInsensitive ) ) |
| 336 | { |
| 337 | if ( *p == TEXT('\r') || *p == TEXT('\n') ) |
| 338 | { |
| 339 | whitespace = true; |
| 340 | ++p; |
| 341 | } |
| 342 | else if (_istspace( *p ) ) |
| 343 | { |
| 344 | whitespace = true; |
| 345 | ++p; |
| 346 | } |
| 347 | else |
| 348 | { |
| 349 | // If we've found whitespace, add it before the |
| 350 | // new character. Any whitespace just becomes a space. |
| 351 | if ( whitespace ) |
| 352 | { |
| 353 | (* text) += ' '; |
| 354 | whitespace = false; |
| 355 | } |
| 356 | TCHAR c; |
| 357 | p = GetChar( p, &c ); |
| 358 | (* text) += c; |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | return p + lstrlen( endTag ); |
| 363 | } |
| 364 | |
| 365 | #ifdef TIXML_USE_STL |
nothing calls this directly
no outgoing calls
no test coverage detected