MCPcopy Create free account
hub / github.com/JayXon/Leanify / CollapseWhitespace

Method CollapseWhitespace

lib/tinyxml2/tinyxml2.cpp:158–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157
158void 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
187const char* StrPair::GetStr()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected