MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / GetStr

Method GetStr

Source/ThirdParty/tinyxml2/tinyxml2.cpp:261–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259
260
261const char* StrPair::GetStr()
262{
263 TIXMLASSERT( _start );
264 TIXMLASSERT( _end );
265 if ( _flags & NEEDS_FLUSH ) {
266 *_end = 0;
267 _flags ^= NEEDS_FLUSH;
268
269 if ( _flags ) {
270 char* p = _start; // the read pointer
271 char* q = _start; // the write pointer
272
273 while( p < _end ) {
274 if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) {
275 // CR-LF pair becomes LF
276 // CR alone becomes LF
277 // LF-CR becomes LF
278 if ( *(p+1) == LF ) {
279 p += 2;
280 }
281 else {
282 ++p;
283 }
284 *q++ = LF;
285 }
286 else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) {
287 if ( *(p+1) == CR ) {
288 p += 2;
289 }
290 else {
291 ++p;
292 }
293 *q++ = LF;
294 }
295 else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) {
296 // Entities handled by tinyXML2:
297 // - special entities in the entity table [in/out]
298 // - numeric character reference [in]
299 // &#20013; or &#x4e2d;
300
301 if ( *(p+1) == '#' ) {
302 const int buflen = 10;
303 char buf[buflen] = { 0 };
304 int len = 0;
305 char* adjusted = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
306 if ( adjusted == 0 ) {
307 *q = *p;
308 ++p;
309 ++q;
310 }
311 else {
312 TIXMLASSERT( 0 <= len && len <= buflen );
313 TIXMLASSERT( q + len <= adjusted );
314 p = adjusted;
315 memcpy( q, buf, len );
316 q += len;
317 }
318 }

Callers 3

ValueMethod · 0.80
ParseDeepMethod · 0.80
NameMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected