MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / GetStr

Method GetStr

3rdparty/tinyxml2/tinyxml2.cpp:281–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279
280
281const char* StrPair::GetStr()
282{
283 TIXMLASSERT( _start );
284 TIXMLASSERT( _end );
285 if ( _flags & NEEDS_FLUSH ) {
286 *_end = 0;
287 _flags ^= NEEDS_FLUSH;
288
289 if ( _flags ) {
290 const char* p = _start; // the read pointer
291 char* q = _start; // the write pointer
292
293 while( p < _end ) {
294 if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) {
295 // CR-LF pair becomes LF
296 // CR alone becomes LF
297 // LF-CR becomes LF
298 if ( *(p+1) == LF ) {
299 p += 2;
300 }
301 else {
302 ++p;
303 }
304 *q = LF;
305 ++q;
306 }
307 else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) {
308 if ( *(p+1) == CR ) {
309 p += 2;
310 }
311 else {
312 ++p;
313 }
314 *q = LF;
315 ++q;
316 }
317 else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) {
318 // Entities handled by tinyXML2:
319 // - special entities in the entity table [in/out]
320 // - numeric character reference [in]
321 // &#20013; or &#x4e2d;
322
323 if ( *(p+1) == '#' ) {
324 const int buflen = 10;
325 char buf[buflen] = { 0 };
326 int len = 0;
327 const char* adjusted = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
328 if ( adjusted == 0 ) {
329 *q = *p;
330 ++p;
331 ++q;
332 }
333 else {
334 TIXMLASSERT( 0 <= len && len <= buflen );
335 TIXMLASSERT( q + len <= adjusted );
336 p = adjusted;
337 memcpy( q, buf, len );
338 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