MCPcopy Create free account
hub / github.com/MediaArea/MediaInfoLib / CollapseWhitespace

Method CollapseWhitespace

Source/ThirdParty/tinyxml2/tinyxml2.cpp:238–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236
237
238void 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
267const char* StrPair::GetStr()

Callers

nothing calls this directly

Calls 2

SkipWhiteSpaceFunction · 0.85
IsWhiteSpaceFunction · 0.85

Tested by

no test coverage detected