MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / GetStr

Method GetStr

Dependencies/tinyxml2/src/tinyxml2.cpp:267–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

ValueMethod · 0.80
ParseDeepMethod · 0.80
NameMethod · 0.80
ErrorStrMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected