| 250 | |
| 251 | |
| 252 | void StrPair::CollapseWhitespace() |
| 253 | { |
| 254 | // Adjusting _start would cause undefined behavior on delete[] |
| 255 | TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 ); |
| 256 | // Trim leading space. |
| 257 | _start = XMLUtil::SkipWhiteSpace( _start, 0 ); |
| 258 | |
| 259 | if ( *_start ) { |
| 260 | const char* p = _start; // the read pointer |
| 261 | char* q = _start; // the write pointer |
| 262 | |
| 263 | while( *p ) { |
| 264 | if ( XMLUtil::IsWhiteSpace( *p )) { |
| 265 | p = XMLUtil::SkipWhiteSpace( p, 0 ); |
| 266 | if ( *p == 0 ) { |
| 267 | break; // don't write to q; this trims the trailing space. |
| 268 | } |
| 269 | *q = ' '; |
| 270 | ++q; |
| 271 | } |
| 272 | *q = *p; |
| 273 | ++q; |
| 274 | ++p; |
| 275 | } |
| 276 | *q = 0; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | |
| 281 | const char* StrPair::GetStr() |
nothing calls this directly
no test coverage detected