FEDRA emulsion software from the OPERA Collaboration
TiXmlBase Class Referenceabstract

#include <tinyxml.h>

Inheritance diagram for TiXmlBase:
Collaboration diagram for TiXmlBase:

Classes

struct  Entity
 

Public Types

enum  {
  TIXML_NO_ERROR = 0 , TIXML_ERROR , TIXML_ERROR_OPENING_FILE , TIXML_ERROR_PARSING_ELEMENT ,
  TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME , TIXML_ERROR_READING_ELEMENT_VALUE , TIXML_ERROR_READING_ATTRIBUTES , TIXML_ERROR_PARSING_EMPTY ,
  TIXML_ERROR_READING_END_TAG , TIXML_ERROR_PARSING_UNKNOWN , TIXML_ERROR_PARSING_COMMENT , TIXML_ERROR_PARSING_DECLARATION ,
  TIXML_ERROR_DOCUMENT_EMPTY , TIXML_ERROR_EMBEDDED_NULL , TIXML_ERROR_PARSING_CDATA , TIXML_ERROR_DOCUMENT_TOP_ONLY ,
  TIXML_ERROR_STRING_COUNT
}
 

Public Member Functions

int Column () const
 See Row() More...
 
voidGetUserData ()
 Get a pointer to arbitrary user data. More...
 
const voidGetUserData () const
 Get a pointer to arbitrary user data. More...
 
virtual const char * Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)=0
 
virtual void Print (FILE *cfile, int depth) const =0
 
int Row () const
 
void SetUserData (void *user)
 Set a pointer to arbitrary user data. More...
 
 TiXmlBase ()
 
virtual ~TiXmlBase ()
 

Static Public Member Functions

static void EncodeString (const TIXML_STRING &str, TIXML_STRING *out)
 
static bool IsWhiteSpaceCondensed ()
 Return the current white space setting. More...
 
static void SetCondenseWhiteSpace (bool condense)
 

Static Public Attributes

static const int utf8ByteTable [256]
 

Static Protected Member Functions

static void ConvertUTF32ToUTF8 (unsigned long input, char *output, int *length)
 
static const char * GetChar (const char *p, char *_value, int *length, TiXmlEncoding encoding)
 
static const char * GetEntity (const char *in, char *value, int *length, TiXmlEncoding encoding)
 
static int IsAlpha (unsigned char anyByte, TiXmlEncoding encoding)
 
static int IsAlphaNum (unsigned char anyByte, TiXmlEncoding encoding)
 
static bool IsWhiteSpace (char c)
 
static bool IsWhiteSpace (int c)
 
static const char * ReadName (const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
 
static const char * ReadText (const char *in, TIXML_STRING *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
 
static const char * SkipWhiteSpace (const char *, TiXmlEncoding encoding)
 
static bool StringEqual (const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
 
static int ToLower (int v, TiXmlEncoding encoding)
 

Protected Attributes

TiXmlCursor location
 
voiduserData
 Field containing a generic user pointer. More...
 

Static Protected Attributes

static const char * errorString [TIXML_ERROR_STRING_COUNT]
 

Private Types

enum  { NUM_ENTITY = 5 , MAX_ENTITY_LENGTH = 6 }
 

Private Member Functions

void operator= (const TiXmlBase &base)
 
 TiXmlBase (const TiXmlBase &)
 

Static Private Attributes

static bool condenseWhiteSpace = true
 
static Entity entity [NUM_ENTITY]
 

Friends

class TiXmlDocument
 
class TiXmlElement
 
class TiXmlNode
 

Detailed Description

TiXmlBase is a base class for every class in TinyXml. It does little except to establish that TinyXml classes can be printed and provide some utility functions.

In XML, the document and elements can contain other elements and other types of nodes.

A Document can contain: Element (container or leaf)
                        Comment (leaf)
                        Unknown (leaf)
                        Declaration( leaf )

An Element can contain: Element (container or leaf)
                        Text    (leaf)
                        Attributes (not on tree)
                        Comment (leaf)
                        Unknown (leaf)

A Decleration contains: Attributes (not on tree)

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
TIXML_NO_ERROR 
TIXML_ERROR 
TIXML_ERROR_OPENING_FILE 
TIXML_ERROR_PARSING_ELEMENT 
TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME 
TIXML_ERROR_READING_ELEMENT_VALUE 
TIXML_ERROR_READING_ATTRIBUTES 
TIXML_ERROR_PARSING_EMPTY 
TIXML_ERROR_READING_END_TAG 
TIXML_ERROR_PARSING_UNKNOWN 
TIXML_ERROR_PARSING_COMMENT 
TIXML_ERROR_PARSING_DECLARATION 
TIXML_ERROR_DOCUMENT_EMPTY 
TIXML_ERROR_EMBEDDED_NULL 
TIXML_ERROR_PARSING_CDATA 
TIXML_ERROR_DOCUMENT_TOP_ONLY 
TIXML_ERROR_STRING_COUNT 
265  {
266  TIXML_NO_ERROR = 0,
267  TIXML_ERROR,
282 
284  };
@ TIXML_ERROR_STRING_COUNT
Definition: tinyxml.h:283
@ TIXML_ERROR_READING_END_TAG
Definition: tinyxml.h:274
@ TIXML_ERROR_PARSING_UNKNOWN
Definition: tinyxml.h:275
@ TIXML_ERROR_PARSING_DECLARATION
Definition: tinyxml.h:277
@ TIXML_ERROR_PARSING_ELEMENT
Definition: tinyxml.h:269
@ TIXML_ERROR_PARSING_EMPTY
Definition: tinyxml.h:273
@ TIXML_ERROR_READING_ATTRIBUTES
Definition: tinyxml.h:272
@ TIXML_ERROR_DOCUMENT_TOP_ONLY
Definition: tinyxml.h:281
@ TIXML_ERROR_PARSING_COMMENT
Definition: tinyxml.h:276
@ TIXML_NO_ERROR
Definition: tinyxml.h:266
@ TIXML_ERROR_PARSING_CDATA
Definition: tinyxml.h:280
@ TIXML_ERROR_DOCUMENT_EMPTY
Definition: tinyxml.h:278
@ TIXML_ERROR_OPENING_FILE
Definition: tinyxml.h:268
@ TIXML_ERROR
Definition: tinyxml.h:267
@ TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME
Definition: tinyxml.h:270
@ TIXML_ERROR_EMBEDDED_NULL
Definition: tinyxml.h:279
@ TIXML_ERROR_READING_ELEMENT_VALUE
Definition: tinyxml.h:271

◆ anonymous enum

anonymous enum
private
Enumerator
NUM_ENTITY 
MAX_ENTITY_LENGTH 
407  {
408  NUM_ENTITY = 5,
410 
411  };
@ NUM_ENTITY
Definition: tinyxml.h:408
@ MAX_ENTITY_LENGTH
Definition: tinyxml.h:409

Constructor & Destructor Documentation

◆ TiXmlBase() [1/2]

TiXmlBase::TiXmlBase ( )
inline
201 : userData(0) {}
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:376

◆ ~TiXmlBase()

virtual TiXmlBase::~TiXmlBase ( )
inlinevirtual
202 {}

◆ TiXmlBase() [2/2]

TiXmlBase::TiXmlBase ( const TiXmlBase )
private

Member Function Documentation

◆ Column()

int TiXmlBase::Column ( ) const
inline

See Row()

◆ ConvertUTF32ToUTF8()

void TiXmlBase::ConvertUTF32ToUTF8 ( unsigned long  input,
char *  output,
int *  length 
)
staticprotected
89 {
90  const unsigned long BYTE_MASK = 0xBF;
91  const unsigned long BYTE_MARK = 0x80;
92  const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
93 
94  if (input < 0x80)
95  *length = 1;
96  else if ( input < 0x800 )
97  *length = 2;
98  else if ( input < 0x10000 )
99  *length = 3;
100  else if ( input < 0x200000 )
101  *length = 4;
102  else
103  { *length = 0; return; } // This code won't covert this correctly anyway.
104 
105  output += *length;
106 
107  // Scary scary fall throughs.
108  switch (*length)
109  {
110  case 4:
111  --output;
112  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
113  input >>= 6;
114  case 3:
115  --output;
116  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
117  input >>= 6;
118  case 2:
119  --output;
120  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
121  input >>= 6;
122  case 1:
123  --output;
124  *output = (char)(input | FIRST_BYTE_MARK[*length]);
125  }
126 }

◆ EncodeString()

void TiXmlBase::EncodeString ( const TIXML_STRING str,
TIXML_STRING out 
)
static

Expands entities in a string. Note this should not contian the tag's '<', '>', etc, or they will be transformed into entities!

53 {
54  int i=0;
55 
56  while( i<(int)str.length() )
57  {
58  unsigned char c = (unsigned char) str[i];
59 
60  if ( c == '&'
61  && i < ( (int)str.length() - 2 )
62  && str[i+1] == '#'
63  && str[i+2] == 'x' )
64  {
65  // Hexadecimal character reference.
66  // Pass through unchanged.
67  // &#xA9; -- copyright symbol, for example.
68  //
69  // The -1 is a bug fix from Rob Laveaux. It keeps
70  // an overflow from happening if there is no ';'.
71  // There are actually 2 ways to exit this loop -
72  // while fails (error case) and break (semicolon found).
73  // However, there is no mechanism (currently) for
74  // this function to return an error.
75  while ( i<(int)str.length()-1 )
76  {
77  outString->append( str.c_str() + i, 1 );
78  ++i;
79  if ( str[i] == ';' )
80  break;
81  }
82  }
83  else if ( c == '&' )
84  {
85  outString->append( entity[0].str, entity[0].strLength );
86  ++i;
87  }
88  else if ( c == '<' )
89  {
90  outString->append( entity[1].str, entity[1].strLength );
91  ++i;
92  }
93  else if ( c == '>' )
94  {
95  outString->append( entity[2].str, entity[2].strLength );
96  ++i;
97  }
98  else if ( c == '\"' )
99  {
100  outString->append( entity[3].str, entity[3].strLength );
101  ++i;
102  }
103  else if ( c == '\'' )
104  {
105  outString->append( entity[4].str, entity[4].strLength );
106  ++i;
107  }
108  else if ( c < 32 )
109  {
110  // Easy pass at non-alpha/numeric/symbol
111  // Below 32 is symbolic.
112  char buf[ 32 ];
113 
114  #if defined(TIXML_SNPRINTF)
115  TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
116  #else
117  sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
118  #endif
119 
120  //*ME: warning C4267: convert 'size_t' to 'int'
121  //*ME: Int-Cast to make compiler happy ...
122  outString->append( buf, (int)strlen( buf ) );
123  ++i;
124  }
125  else
126  {
127  //char realc = (char) c;
128  //outString->append( &realc, 1 );
129  *outString += (char) c; // somewhat more efficient function call.
130  ++i;
131  }
132  }
133 }
static Entity entity[NUM_ENTITY]
Definition: tinyxml.h:412
#define TIXML_SNPRINTF
Definition: tinyxml.h:78

◆ GetChar()

static const char* TiXmlBase::GetChar ( const char *  p,
char *  _value,
int *  length,
TiXmlEncoding  encoding 
)
inlinestaticprotected
328  {
329  assert( p );
330  if ( encoding == TIXML_ENCODING_UTF8 )
331  {
332  *length = utf8ByteTable[ *((const unsigned char*)p) ];
333  assert( *length >= 0 && *length < 5 );
334  }
335  else
336  {
337  *length = 1;
338  }
339 
340  if ( *length == 1 )
341  {
342  if ( *p == '&' )
343  return GetEntity( p, _value, length, encoding );
344  *_value = *p;
345  return p+1;
346  }
347  else if ( *length )
348  {
349  //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
350  // and the null terminator isn't needed
351  for( int i=0; p[i] && i<*length; ++i ) {
352  _value[i] = p[i];
353  }
354  return p + (*length);
355  }
356  else
357  {
358  // Not valid text.
359  return 0;
360  }
361  }
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:438
static const int utf8ByteTable[256]
Definition: tinyxml.h:253
p
Definition: testBGReduction_AllMethods.C:8
@ TIXML_ENCODING_UTF8
Definition: tinyxml.h:166

◆ GetEntity()

const char * TiXmlBase::GetEntity ( const char *  in,
char *  value,
int *  length,
TiXmlEncoding  encoding 
)
staticprotected
439 {
440  // Presume an entity, and pull it out.
441  TIXML_STRING ent;
442  int i;
443  *length = 0;
444 
445  if ( *(p+1) && *(p+1) == '#' && *(p+2) )
446  {
447  unsigned long ucs = 0;
448  ptrdiff_t delta = 0;
449  unsigned mult = 1;
450 
451  if ( *(p+2) == 'x' )
452  {
453  // Hexadecimal.
454  if ( !*(p+3) ) return 0;
455 
456  const char* q = p+3;
457  q = strchr( q, ';' );
458 
459  if ( !q || !*q ) return 0;
460 
461  delta = q-p;
462  --q;
463 
464  while ( *q != 'x' )
465  {
466  if ( *q >= '0' && *q <= '9' )
467  ucs += mult * (*q - '0');
468  else if ( *q >= 'a' && *q <= 'f' )
469  ucs += mult * (*q - 'a' + 10);
470  else if ( *q >= 'A' && *q <= 'F' )
471  ucs += mult * (*q - 'A' + 10 );
472  else
473  return 0;
474  mult *= 16;
475  --q;
476  }
477  }
478  else
479  {
480  // Decimal.
481  if ( !*(p+2) ) return 0;
482 
483  const char* q = p+2;
484  q = strchr( q, ';' );
485 
486  if ( !q || !*q ) return 0;
487 
488  delta = q-p;
489  --q;
490 
491  while ( *q != '#' )
492  {
493  if ( *q >= '0' && *q <= '9' )
494  ucs += mult * (*q - '0');
495  else
496  return 0;
497  mult *= 10;
498  --q;
499  }
500  }
501  if ( encoding == TIXML_ENCODING_UTF8 )
502  {
503  // convert the UCS to UTF-8
504  ConvertUTF32ToUTF8( ucs, value, length );
505  }
506  else
507  {
508  *value = (char)ucs;
509  *length = 1;
510  }
511  return p + delta + 1;
512  }
513 
514  // Now try to match it.
515  for( i=0; i<NUM_ENTITY; ++i )
516  {
517  if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
518  {
519  assert( strlen( entity[i].str ) == entity[i].strLength );
520  *value = entity[i].chr;
521  *length = 1;
522  return ( p + entity[i].strLength );
523  }
524  }
525 
526  // So it wasn't an entity, its unrecognized, or something like that.
527  *value = *p; // Don't put back the last one, since we return it!
528  //*length = 1; // Leave unrecognized entities - this doesn't really work.
529  // Just writes strange XML.
530  return p+1;
531 }
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
Definition: tinyxmlparser.cpp:88
char chr
Definition: tinyxml.h:404
q
Definition: testBGReduction_AllMethods.C:55
#define TIXML_STRING
Definition: tinyxml.h:53

◆ GetUserData() [1/2]

void* TiXmlBase::GetUserData ( )
inline

Get a pointer to arbitrary user data.

◆ GetUserData() [2/2]

const void* TiXmlBase::GetUserData ( ) const
inline

Get a pointer to arbitrary user data.

◆ IsAlpha()

int TiXmlBase::IsAlpha ( unsigned char  anyByte,
TiXmlEncoding  encoding 
)
staticprotected
130 {
131  // This will only work for low-ascii, everything else is assumed to be a valid
132  // letter. I'm not sure this is the best approach, but it is quite tricky trying
133  // to figure out alhabetical vs. not across encoding. So take a very
134  // conservative approach.
135 
136 // if ( encoding == TIXML_ENCODING_UTF8 )
137 // {
138  if ( anyByte < 127 )
139  return isalpha( anyByte );
140  else
141  return 1; // What else to do? The unicode set is huge...get the english ones right.
142 // }
143 // else
144 // {
145 // return isalpha( anyByte );
146 // }
147 }

◆ IsAlphaNum()

int TiXmlBase::IsAlphaNum ( unsigned char  anyByte,
TiXmlEncoding  encoding 
)
staticprotected
151 {
152  // This will only work for low-ascii, everything else is assumed to be a valid
153  // letter. I'm not sure this is the best approach, but it is quite tricky trying
154  // to figure out alhabetical vs. not across encoding. So take a very
155  // conservative approach.
156 
157 // if ( encoding == TIXML_ENCODING_UTF8 )
158 // {
159  if ( anyByte < 127 )
160  return isalnum( anyByte );
161  else
162  return 1; // What else to do? The unicode set is huge...get the english ones right.
163 // }
164 // else
165 // {
166 // return isalnum( anyByte );
167 // }
168 }

◆ IsWhiteSpace() [1/2]

static bool TiXmlBase::IsWhiteSpace ( char  c)
inlinestaticprotected
291  {
292  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
293  }

◆ IsWhiteSpace() [2/2]

static bool TiXmlBase::IsWhiteSpace ( int  c)
inlinestaticprotected
295  {
296  if ( c < 256 )
297  return IsWhiteSpace( (char) c );
298  return false; // Again, only truly correct for English/Latin...but usually works.
299  }
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:290

◆ IsWhiteSpaceCondensed()

static bool TiXmlBase::IsWhiteSpaceCondensed ( )
inlinestatic

Return the current white space setting.

224 { return condenseWhiteSpace; }
static bool condenseWhiteSpace
Definition: tinyxml.h:413

◆ operator=()

void TiXmlBase::operator= ( const TiXmlBase base)
private

◆ Parse()

virtual const char* TiXmlBase::Parse ( const char *  p,
TiXmlParsingData data,
TiXmlEncoding  encoding 
)
pure virtual

◆ Print()

virtual void TiXmlBase::Print ( FILE *  cfile,
int  depth 
) const
pure virtual

All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null.

This is a formatted print, and will insert tabs and newlines.

(For an unformatted stream, use the << operator.)

Implemented in TiXmlDocument, TiXmlUnknown, TiXmlDeclaration, TiXmlText, TiXmlComment, TiXmlElement, and TiXmlAttribute.

◆ ReadName()

const char * TiXmlBase::ReadName ( const char *  p,
TIXML_STRING name,
TiXmlEncoding  encoding 
)
staticprotected
402 {
403  // Oddly, not supported on some comilers,
404  //name->clear();
405  // So use this:
406  *name = "";
407  assert( p );
408 
409  // Names start with letters or underscores.
410  // Of course, in unicode, tinyxml has no idea what a letter *is*. The
411  // algorithm is generous.
412  //
413  // After that, they can be letters, underscores, numbers,
414  // hyphens, or colons. (Colons are valid ony for namespaces,
415  // but tinyxml can't tell namespaces from names.)
416  if ( p && *p
417  && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
418  {
419  const char* start = p;
420  while( p && *p
421  && ( IsAlphaNum( (unsigned char ) *p, encoding )
422  || *p == '_'
423  || *p == '-'
424  || *p == '.'
425  || *p == ':' ) )
426  {
427  //(*name) += *p; // expensive
428  ++p;
429  }
430  if ( p-start > 0 ) {
431  name->assign( start, p-start );
432  }
433  return p;
434  }
435  return 0;
436 }
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:150
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:129
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24

◆ ReadText()

const char * TiXmlBase::ReadText ( const char *  in,
TIXML_STRING text,
bool  ignoreWhiteSpace,
const char *  endTag,
bool  ignoreCase,
TiXmlEncoding  encoding 
)
staticprotected
580 {
581  *text = "";
582  if ( !trimWhiteSpace // certain tags always keep whitespace
583  || !condenseWhiteSpace ) // if true, whitespace is always kept
584  {
585  // Keep all the white space.
586  while ( p && *p
587  && !StringEqual( p, endTag, caseInsensitive, encoding )
588  )
589  {
590  int len;
591  char cArr[4] = { 0, 0, 0, 0 };
592  p = GetChar( p, cArr, &len, encoding );
593  text->append( cArr, len );
594  }
595  }
596  else
597  {
598  bool whitespace = false;
599 
600  // Remove leading white space:
601  p = SkipWhiteSpace( p, encoding );
602  while ( p && *p
603  && !StringEqual( p, endTag, caseInsensitive, encoding ) )
604  {
605  if ( *p == '\r' || *p == '\n' )
606  {
607  whitespace = true;
608  ++p;
609  }
610  else if ( IsWhiteSpace( *p ) )
611  {
612  whitespace = true;
613  ++p;
614  }
615  else
616  {
617  // If we've found whitespace, add it before the
618  // new character. Any whitespace just becomes a space.
619  if ( whitespace )
620  {
621  (*text) += ' ';
622  whitespace = false;
623  }
624  int len;
625  char cArr[4] = { 0, 0, 0, 0 };
626  p = GetChar( p, cArr, &len, encoding );
627  if ( len == 1 )
628  (*text) += cArr[0]; // more efficient
629  else
630  text->append( cArr, len );
631  }
632  }
633  }
634  if ( p && *p )
635  p += strlen( endTag );
636  return ( p && *p ) ? p : 0;
637 }
TText * text
Definition: Canv_SYSTEMATICS_ALLCOMBINED__RMSEnergy__vs__Energy__ELECTRON.C:164
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:534
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:327
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:314

◆ Row()

int TiXmlBase::Row ( ) const
inline

Return the position, in the original source file, of this node or attribute. The row and column are 1-based. (That is the first row and first column is 1,1). If the returns values are 0 or less, then the parser does not have a row and column value.

Generally, the row and column value will be set when the TiXmlDocument::Load(), TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set when the DOM was created from operator>>.

The values reflect the initial load. Once the DOM is modified programmatically (by adding or changing nodes and attributes) the new values will NOT update to reflect changes in the document.

There is a minor performance cost to computing the row and column. Computation can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value.

See also
TiXmlDocument::SetTabSize()
244 { return location.row + 1; }
TiXmlCursor location
Definition: tinyxml.h:373
int row
Definition: tinyxml.h:104

◆ SetCondenseWhiteSpace()

static void TiXmlBase::SetCondenseWhiteSpace ( bool  condense)
inlinestatic

The world does not agree on whether white space should be kept or not. In order to make everyone happy, these global, static functions are provided to set whether or not TinyXml will condense all white space into a single space or not. The default is to condense. Note changing this value is not thread safe.

221 { condenseWhiteSpace = condense; }

◆ SetUserData()

void TiXmlBase::SetUserData ( void user)
inline

Set a pointer to arbitrary user data.

◆ SkipWhiteSpace()

const char * TiXmlBase::SkipWhiteSpace ( const char *  p,
TiXmlEncoding  encoding 
)
staticprotected
315 {
316  if ( !p || !*p )
317  {
318  return 0;
319  }
320  if ( encoding == TIXML_ENCODING_UTF8 )
321  {
322  while ( *p )
323  {
324  const unsigned char* pU = (const unsigned char*)p;
325 
326  // Skip the stupid Microsoft UTF-8 Byte order marks
327  if ( *(pU+0)==TIXML_UTF_LEAD_0
328  && *(pU+1)==TIXML_UTF_LEAD_1
329  && *(pU+2)==TIXML_UTF_LEAD_2 )
330  {
331  p += 3;
332  continue;
333  }
334  else if(*(pU+0)==TIXML_UTF_LEAD_0
335  && *(pU+1)==0xbfU
336  && *(pU+2)==0xbeU )
337  {
338  p += 3;
339  continue;
340  }
341  else if(*(pU+0)==TIXML_UTF_LEAD_0
342  && *(pU+1)==0xbfU
343  && *(pU+2)==0xbfU )
344  {
345  p += 3;
346  continue;
347  }
348 
349  if ( IsWhiteSpace( *p ) ) // Still using old rules for white space.
350  ++p;
351  else
352  break;
353  }
354  }
355  else
356  {
357  while ( *p && IsWhiteSpace( *p ) )
358  ++p;
359  }
360 
361  return p;
362 }
const unsigned char TIXML_UTF_LEAD_0
Definition: tinyxmlparser.cpp:62
const unsigned char TIXML_UTF_LEAD_1
Definition: tinyxmlparser.cpp:63
const unsigned char TIXML_UTF_LEAD_2
Definition: tinyxmlparser.cpp:64

◆ StringEqual()

bool TiXmlBase::StringEqual ( const char *  p,
const char *  endTag,
bool  ignoreCase,
TiXmlEncoding  encoding 
)
staticprotected
538 {
539  assert( p );
540  assert( tag );
541  if ( !p || !*p )
542  {
543  assert( 0 );
544  return false;
545  }
546 
547  const char* q = p;
548 
549  if ( ignoreCase )
550  {
551  while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) )
552  {
553  ++q;
554  ++tag;
555  }
556 
557  if ( *tag == 0 )
558  return true;
559  }
560  else
561  {
562  while ( *q && *tag && *q == *tag )
563  {
564  ++q;
565  ++tag;
566  }
567 
568  if ( *tag == 0 ) // Have we found the end of the tag, and everything equal?
569  return true;
570  }
571  return false;
572 }
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:382

◆ ToLower()

static int TiXmlBase::ToLower ( int  v,
TiXmlEncoding  encoding 
)
inlinestaticprotected
383  {
384  if ( encoding == TIXML_ENCODING_UTF8 )
385  {
386  if ( v < 128 ) return tolower( v );
387  return v;
388  }
389  else
390  {
391  return tolower( v );
392  }
393  }

Friends And Related Function Documentation

◆ TiXmlDocument

friend class TiXmlDocument
friend

◆ TiXmlElement

friend class TiXmlElement
friend

◆ TiXmlNode

friend class TiXmlNode
friend

Member Data Documentation

◆ condenseWhiteSpace

bool TiXmlBase::condenseWhiteSpace = true
staticprivate

◆ entity

TiXmlBase::Entity TiXmlBase::entity
staticprivate
Initial value:
=
{
{ "&amp;", 5, '&' },
{ "&lt;", 4, '<' },
{ "&gt;", 4, '>' },
{ "&quot;", 6, '\"' },
{ "&apos;", 6, '\'' }
}

◆ errorString

const char * TiXmlBase::errorString
staticprotected
Initial value:
=
{
"No error",
"Error",
"Failed to open file",
"Error parsing Element.",
"Failed to read Element name",
"Error reading Element value.",
"Error reading Attributes.",
"Error: empty tag.",
"Error reading end tag.",
"Error parsing Unknown.",
"Error parsing Comment.",
"Error parsing Declaration.",
"Error document empty.",
"Error null (0) or unexpected EOF found in input stream.",
"Error parsing CDATA.",
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
}

◆ location

TiXmlCursor TiXmlBase::location
protected

◆ userData

void* TiXmlBase::userData
protected

Field containing a generic user pointer.

◆ utf8ByteTable

const int TiXmlBase::utf8ByteTable
static
Initial value:
=
{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}

The documentation for this class was generated from the following files: