MCPcopy Create free account
hub / github.com/ajkhoury/ReClassEx / GetStr

Method GetStr

ReClass/tinyxml2.cpp:268–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 6

ValueMethod · 0.80
ParseDeepMethod · 0.80
NameMethod · 0.80
GetErrorStr1Method · 0.80
GetErrorStr2Method · 0.80
PrintErrorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected