| 156 | |
| 157 | |
| 158 | void StrPair::CollapseWhitespace() |
| 159 | { |
| 160 | // Adjusting _start would cause undefined behavior on delete[] |
| 161 | TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 ); |
| 162 | // Trim leading space. |
| 163 | _start = XMLUtil::SkipWhiteSpace( _start ); |
| 164 | |
| 165 | if ( *_start ) { |
| 166 | char* p = _start; // the read pointer |
| 167 | char* q = _start; // the write pointer |
| 168 | |
| 169 | while( *p ) { |
| 170 | if ( XMLUtil::IsWhiteSpace( *p )) { |
| 171 | p = XMLUtil::SkipWhiteSpace( p ); |
| 172 | if ( *p == 0 ) { |
| 173 | break; // don't write to q; this trims the trailing space. |
| 174 | } |
| 175 | *q = ' '; |
| 176 | ++q; |
| 177 | } |
| 178 | *q = *p; |
| 179 | ++q; |
| 180 | ++p; |
| 181 | } |
| 182 | *q = 0; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | |
| 187 | const char* StrPair::GetStr() |
nothing calls this directly
no outgoing calls
no test coverage detected