MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / GetEntity

Method GetEntity

cpp/tinyxml/tinyxmlparser.cpp:439–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437}
438
439const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding )
440{
441 // Presume an entity, and pull it out.
442 TIXML_STRING ent;
443 int i;
444 *length = 0;
445
446 if ( *(p+1) && *(p+1) == '#' && *(p+2) )
447 {
448 unsigned long ucs = 0;
449 ptrdiff_t delta = 0;
450 unsigned mult = 1;
451
452 if ( *(p+2) == 'x' )
453 {
454 // Hexadecimal.
455 if ( !*(p+3) ) return 0;
456
457 const char* q = p+3;
458 q = strchr( q, ';' );
459
460 if ( !q || !*q ) return 0;
461
462 delta = q-p;
463 --q;
464
465 while ( *q != 'x' )
466 {
467 if ( *q >= '0' && *q <= '9' )
468 ucs += mult * (*q - '0');
469 else if ( *q >= 'a' && *q <= 'f' )
470 ucs += mult * (*q - 'a' + 10);
471 else if ( *q >= 'A' && *q <= 'F' )
472 ucs += mult * (*q - 'A' + 10 );
473 else
474 return 0;
475 mult *= 16;
476 --q;
477 }
478 }
479 else
480 {
481 // Decimal.
482 if ( !*(p+2) ) return 0;
483
484 const char* q = p+2;
485 q = strchr( q, ';' );
486
487 if ( !q || !*q ) return 0;
488
489 delta = q-p;
490 --q;
491
492 while ( *q != '#' )
493 {
494 if ( *q >= '0' && *q <= '9' )
495 ucs += mult * (*q - '0');
496 else

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected