| 236 | |
| 237 | |
| 238 | void StrPair::CollapseWhitespace() |
| 239 | { |
| 240 | // Adjusting _start would cause undefined behavior on delete[] |
| 241 | TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 ); |
| 242 | // Trim leading space. |
| 243 | _start = XMLUtil::SkipWhiteSpace( _start, 0 ); |
| 244 | |
| 245 | if ( *_start ) { |
| 246 | const char* p = _start; // the read pointer |
| 247 | char* q = _start; // the write pointer |
| 248 | |
| 249 | while( *p ) { |
| 250 | if ( XMLUtil::IsWhiteSpace( *p )) { |
| 251 | p = XMLUtil::SkipWhiteSpace( p, 0 ); |
| 252 | if ( *p == 0 ) { |
| 253 | break; // don't write to q; this trims the trailing space. |
| 254 | } |
| 255 | *q = ' '; |
| 256 | ++q; |
| 257 | } |
| 258 | *q = *p; |
| 259 | ++q; |
| 260 | ++p; |
| 261 | } |
| 262 | *q = 0; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | |
| 267 | const char* StrPair::GetStr() |
nothing calls this directly
no test coverage detected