| 572 | } |
| 573 | |
| 574 | const char* TiXmlBase::ReadText( const char* p, |
| 575 | TIXML_STRING * text, |
| 576 | bool trimWhiteSpace, |
| 577 | const char* endTag, |
| 578 | bool caseInsensitive, |
| 579 | TiXmlEncoding encoding ) |
| 580 | { |
| 581 | *text = ""; |
| 582 | if ( !trimWhiteSpace // certain tags always keep whitespace |
| 583 | || !condenseWhiteSpace ) // if true, whitespace is always kept |
| 584 | { |
| 585 | // Keep all the white space. |
| 586 | while ( p && *p |
| 587 | && !StringEqual( p, endTag, caseInsensitive, encoding ) |
| 588 | ) |
| 589 | { |
| 590 | int len; |
| 591 | char cArr[4] = { 0, 0, 0, 0 }; |
| 592 | p = GetChar( p, cArr, &len, encoding ); |
| 593 | text->append( cArr, len ); |
| 594 | } |
| 595 | } |
| 596 | else |
| 597 | { |
| 598 | bool whitespace = false; |
| 599 | |
| 600 | // Remove leading white space: |
| 601 | p = SkipWhiteSpace( p, encoding ); |
| 602 | while ( p && *p |
| 603 | && !StringEqual( p, endTag, caseInsensitive, encoding ) ) |
| 604 | { |
| 605 | if ( *p == '\r' || *p == '\n' ) |
| 606 | { |
| 607 | whitespace = true; |
| 608 | ++p; |
| 609 | } |
| 610 | else if ( IsWhiteSpace( *p ) ) |
| 611 | { |
| 612 | whitespace = true; |
| 613 | ++p; |
| 614 | } |
| 615 | else |
| 616 | { |
| 617 | // If we've found whitespace, add it before the |
| 618 | // new character. Any whitespace just becomes a space. |
| 619 | if ( whitespace ) |
| 620 | { |
| 621 | (*text) += ' '; |
| 622 | whitespace = false; |
| 623 | } |
| 624 | int len; |
| 625 | char cArr[4] = { 0, 0, 0, 0 }; |
| 626 | p = GetChar( p, cArr, &len, encoding ); |
| 627 | if ( len == 1 ) |
| 628 | (*text) += cArr[0]; // more efficient |
| 629 | else |
| 630 | text->append( cArr, len ); |
| 631 | } |
nothing calls this directly
no outgoing calls
no test coverage detected