| 133 | |
| 134 | |
| 135 | void StrPair::CollapseWhitespace() |
| 136 | { |
| 137 | // Adjusting _start would cause undefined behavior on delete[] |
| 138 | TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 ); |
| 139 | // Trim leading space. |
| 140 | _start = XMLUtil::SkipWhiteSpace( _start ); |
| 141 | |
| 142 | if ( _start && *_start ) { |
| 143 | char* p = _start; // the read pointer |
| 144 | char* q = _start; // the write pointer |
| 145 | |
| 146 | while( *p ) { |
| 147 | if ( XMLUtil::IsWhiteSpace( *p )) { |
| 148 | p = XMLUtil::SkipWhiteSpace( p ); |
| 149 | if ( *p == 0 ) { |
| 150 | break; // don't write to q; this trims the trailing space. |
| 151 | } |
| 152 | *q = ' '; |
| 153 | ++q; |
| 154 | } |
| 155 | *q = *p; |
| 156 | ++q; |
| 157 | ++p; |
| 158 | } |
| 159 | *q = 0; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | |
| 164 | const char* StrPair::GetStr() |
nothing calls this directly
no outgoing calls
no test coverage detected