MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / GetStr

Method GetStr

examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp:272–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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