CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Static Private Attributes | Friends
TiXmlBase Class Referenceabstract

#include <tinyxml.h>

Inheritance diagram for TiXmlBase:
TiXmlAttribute TiXmlNode TiXmlComment TiXmlDeclaration TiXmlDocument TiXmlElement TiXmlText TiXmlUnknown

Classes

struct  Entity
 

Public Types

enum  {
  TIXML_NO_ERROR = 0, TIXML_ERROR, TIXML_ERROR_OPENING_FILE, TIXML_ERROR_OUT_OF_MEMORY,
  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...
 
void * GetUserData ()
 Get a pointer to arbitrary user data. More...
 
const void * GetUserData () 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 StreamTo (std::istream *in, int character, TIXML_STRING *tag)
 
static bool StreamWhiteSpace (std::istream *in, TIXML_STRING *tag)
 
static bool StringEqual (const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
 
static int ToLower (int v, TiXmlEncoding encoding)
 

Protected Attributes

TiXmlCursor location
 
void * userData
 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)

Definition at line 196 of file tinyxml.h.

Member Enumeration Documentation

anonymous enum
Enumerator
TIXML_NO_ERROR 
TIXML_ERROR 
TIXML_ERROR_OPENING_FILE 
TIXML_ERROR_OUT_OF_MEMORY 
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 

Definition at line 266 of file tinyxml.h.

267  {
268  TIXML_NO_ERROR = 0,
269  TIXML_ERROR,
285 
287  };
anonymous enum
private
Enumerator
NUM_ENTITY 
MAX_ENTITY_LENGTH 

Definition at line 408 of file tinyxml.h.

409  {
410  NUM_ENTITY = 5,
412 
413  };

Constructor & Destructor Documentation

TiXmlBase::TiXmlBase ( )
inline

Definition at line 203 of file tinyxml.h.

203 : userData(0) {}
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:378
virtual TiXmlBase::~TiXmlBase ( )
inlinevirtual

Definition at line 204 of file tinyxml.h.

204 {}
TiXmlBase::TiXmlBase ( const TiXmlBase )
private

Member Function Documentation

int TiXmlBase::Column ( ) const
inline

See Row()

Definition at line 247 of file tinyxml.h.

References TiXmlCursor::col, and location.

void TiXmlBase::ConvertUTF32ToUTF8 ( unsigned long  input,
char *  output,
int *  length 
)
staticprotected

Definition at line 92 of file tinyxmlparser.cc.

References convertSQLitetoXML_cfg::output.

Referenced by GetEntity().

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

Definition at line 53 of file tinyxml.cc.

References trackerHits::c, entity, and i.

Referenced by TiXmlAttribute::Print(), TiXmlText::Print(), and TiXmlPrinter::Visit().

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

Definition at line 329 of file tinyxml.h.

References GetEntity(), i, L1TEmulatorMonitor_cff::p, TIXML_ENCODING_UTF8, and utf8ByteTable.

Referenced by ReadText().

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

Definition at line 443 of file tinyxmlparser.cc.

References TiXmlBase::Entity::chr, ConvertUTF32ToUTF8(), delta, entity, i, VarParsing::mult, NUM_ENTITY, L1TEmulatorMonitor_cff::p, lumiQueryAPI::q, TIXML_ENCODING_UTF8, and TIXML_STRING.

Referenced by GetChar().

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

Get a pointer to arbitrary user data.

Definition at line 250 of file tinyxml.h.

References userData.

const void* TiXmlBase::GetUserData ( ) const
inline

Get a pointer to arbitrary user data.

Definition at line 251 of file tinyxml.h.

References userData.

int TiXmlBase::IsAlpha ( unsigned char  anyByte,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 133 of file tinyxmlparser.cc.

Referenced by TiXmlNode::Identify(), and ReadName().

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

Definition at line 154 of file tinyxmlparser.cc.

Referenced by ReadName().

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

Definition at line 292 of file tinyxml.h.

Referenced by TiXmlText::Blank(), IsWhiteSpace(), TiXmlAttribute::Parse(), TiXmlDeclaration::Parse(), ReadText(), SkipWhiteSpace(), TiXmlElement::StreamIn(), and StreamWhiteSpace().

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

Definition at line 296 of file tinyxml.h.

References IsWhiteSpace().

297  {
298  if ( c < 256 )
299  return IsWhiteSpace( (char) c );
300  return false; // Again, only truly correct for English/Latin...but usually works.
301  }
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:292
static bool TiXmlBase::IsWhiteSpaceCondensed ( )
inlinestatic

Return the current white space setting.

Definition at line 226 of file tinyxml.h.

References condenseWhiteSpace.

Referenced by TiXmlElement::ReadValue().

226 { return condenseWhiteSpace; }
static bool condenseWhiteSpace
Definition: tinyxml.h:415
void TiXmlBase::operator= ( const TiXmlBase base)
private
virtual const char* TiXmlBase::Parse ( const char *  p,
TiXmlParsingData data,
TiXmlEncoding  encoding 
)
pure virtual
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.

Referenced by TiXmlElement::Print().

const char * TiXmlBase::ReadName ( const char *  p,
TIXML_STRING name,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 406 of file tinyxmlparser.cc.

References IsAlpha(), IsAlphaNum(), and L1TEmulatorMonitor_cff::p.

Referenced by TiXmlAttribute::Parse(), and TiXmlElement::Parse().

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

Definition at line 579 of file tinyxmlparser.cc.

References condenseWhiteSpace, GetChar(), IsWhiteSpace(), L1TEmulatorMonitor_cff::p, SkipWhiteSpace(), and StringEqual().

Referenced by TiXmlAttribute::Parse(), and TiXmlText::Parse().

585 {
586  *text = "";
587  if ( !trimWhiteSpace // certain tags always keep whitespace
588  || !condenseWhiteSpace ) // if true, whitespace is always kept
589  {
590  // Keep all the white space.
591  while ( p && *p
592  && !StringEqual( p, endTag, caseInsensitive, encoding )
593  )
594  {
595  int len;
596  char cArr[4] = { 0, 0, 0, 0 };
597  p = GetChar( p, cArr, &len, encoding );
598  text->append( cArr, len );
599  }
600  }
601  else
602  {
603  bool whitespace = false;
604 
605  // Remove leading white space:
606  p = SkipWhiteSpace( p, encoding );
607  while ( p && *p
608  && !StringEqual( p, endTag, caseInsensitive, encoding ) )
609  {
610  if ( *p == '\r' || *p == '\n' )
611  {
612  whitespace = true;
613  ++p;
614  }
615  else if ( IsWhiteSpace( *p ) )
616  {
617  whitespace = true;
618  ++p;
619  }
620  else
621  {
622  // If we've found whitespace, add it before the
623  // new character. Any whitespace just becomes a space.
624  if ( whitespace )
625  {
626  (*text) += ' ';
627  whitespace = false;
628  }
629  int len;
630  char cArr[4] = { 0, 0, 0, 0 };
631  p = GetChar( p, cArr, &len, encoding );
632  if ( len == 1 )
633  (*text) += cArr[0]; // more efficient
634  else
635  text->append( cArr, len );
636  }
637  }
638  }
639  if ( p )
640  p += strlen( endTag );
641  return p;
642 }
static bool condenseWhiteSpace
Definition: tinyxml.h:415
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:292
tuple text
Definition: runonSM.py:42
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:329
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()

Definition at line 246 of file tinyxml.h.

References location, and TiXmlCursor::row.

246 { return location.row + 1; }
TiXmlCursor location
Definition: tinyxml.h:375
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.

Definition at line 223 of file tinyxml.h.

References condenseWhiteSpace.

223 { condenseWhiteSpace = condense; }
static bool condenseWhiteSpace
Definition: tinyxml.h:415
void TiXmlBase::SetUserData ( void *  user)
inline

Set a pointer to arbitrary user data.

Definition at line 249 of file tinyxml.h.

References hcal_dqm_sourceclient-file_cfg::user, and userData.

const char * TiXmlBase::SkipWhiteSpace ( const char *  p,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 318 of file tinyxmlparser.cc.

References IsWhiteSpace(), L1TEmulatorMonitor_cff::p, TIXML_ENCODING_UTF8, TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, and TIXML_UTF_LEAD_2.

Referenced by TiXmlNode::Identify(), TiXmlAttribute::Parse(), TiXmlElement::Parse(), TiXmlComment::Parse(), TiXmlDeclaration::Parse(), TiXmlUnknown::Parse(), TiXmlDocument::Parse(), ReadText(), and TiXmlElement::ReadValue().

319 {
320  if ( !p || !*p )
321  {
322  return 0;
323  }
324  if ( encoding == TIXML_ENCODING_UTF8 )
325  {
326  while ( *p )
327  {
328  const unsigned char* pU = (const unsigned char*)p;
329 
330  // Skip the stupid Microsoft UTF-8 Byte order marks
331  if ( *(pU+0)==TIXML_UTF_LEAD_0
332  && *(pU+1)==TIXML_UTF_LEAD_1
333  && *(pU+2)==TIXML_UTF_LEAD_2 )
334  {
335  p += 3;
336  continue;
337  }
338  else if(*(pU+0)==TIXML_UTF_LEAD_0
339  && *(pU+1)==0xbfU
340  && *(pU+2)==0xbeU )
341  {
342  p += 3;
343  continue;
344  }
345  else if(*(pU+0)==TIXML_UTF_LEAD_0
346  && *(pU+1)==0xbfU
347  && *(pU+2)==0xbfU )
348  {
349  p += 3;
350  continue;
351  }
352 
353  if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
354  ++p;
355  else
356  break;
357  }
358  }
359  else
360  {
361  // Code altered by user. An extra pair of () was added to eliminate a compiler warning.
362  while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' )
363  ++p;
364  }
365 
366  return p;
367 }
const unsigned char TIXML_UTF_LEAD_2
const unsigned char TIXML_UTF_LEAD_0
const unsigned char TIXML_UTF_LEAD_1
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:292
bool TiXmlBase::StreamTo ( std::istream *  in,
int  character,
TIXML_STRING tag 
)
staticprotected

Definition at line 385 of file tinyxmlparser.cc.

References trackerHits::c.

Referenced by TiXmlDocument::StreamIn().

386 {
387  //assert( character > 0 && character < 128 ); // else it won't work in utf-8
388  while ( in->good() )
389  {
390  int c = in->peek();
391  if ( c == character )
392  return true;
393  if ( c <= 0 ) // Silent failure: can't get document at this scope
394  return false;
395 
396  in->get();
397  *tag += (char) c;
398  }
399  return false;
400 }
bool TiXmlBase::StreamWhiteSpace ( std::istream *  in,
TIXML_STRING tag 
)
staticprotected

Definition at line 370 of file tinyxmlparser.cc.

References trackerHits::c, and IsWhiteSpace().

Referenced by TiXmlElement::StreamIn().

371 {
372  for( ;; )
373  {
374  if ( !in->good() ) return false;
375 
376  int c = in->peek();
377  // At this scope, we can't get to a document. So fail silently.
378  if ( !IsWhiteSpace( c ) || c <= 0 )
379  return true;
380 
381  *tag += (char) in->get();
382  }
383 }
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:292
bool TiXmlBase::StringEqual ( const char *  p,
const char *  endTag,
bool  ignoreCase,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 539 of file tinyxmlparser.cc.

References L1TEmulatorMonitor_cff::p, lumiQueryAPI::q, GlobalPosition_Frontier_DevDB_cff::tag, and ToLower().

Referenced by TiXmlNode::Identify(), TiXmlElement::Parse(), TiXmlComment::Parse(), TiXmlText::Parse(), TiXmlDeclaration::Parse(), TiXmlDocument::Parse(), ReadText(), and TiXmlElement::ReadValue().

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

Definition at line 384 of file tinyxml.h.

References TIXML_ENCODING_UTF8, and v.

Referenced by StringEqual().

385  {
386  if ( encoding == TIXML_ENCODING_UTF8 )
387  {
388  if ( v < 128 ) return tolower( v );
389  return v;
390  }
391  else
392  {
393  return tolower( v );
394  }
395  }
mathSSE::Vec4< T > v

Friends And Related Function Documentation

friend class TiXmlDocument
friend

Definition at line 200 of file tinyxml.h.

friend class TiXmlElement
friend

Definition at line 199 of file tinyxml.h.

friend class TiXmlNode
friend

Definition at line 198 of file tinyxml.h.

Member Data Documentation

bool TiXmlBase::condenseWhiteSpace = true
staticprivate

Definition at line 415 of file tinyxml.h.

Referenced by IsWhiteSpaceCondensed(), ReadText(), and SetCondenseWhiteSpace().

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

Definition at line 414 of file tinyxml.h.

Referenced by EncodeString(), and GetEntity().

const char * TiXmlBase::errorString
staticprotected
Initial value:
=
{
"No error",
"Error",
"Failed to open file",
"Memory allocation failed.",
"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.",
}

Definition at line 373 of file tinyxml.h.

Referenced by TiXmlDocument::SetError().

TiXmlCursor TiXmlBase::location
protected
void* TiXmlBase::userData
protected

Field containing a generic user pointer.

Definition at line 378 of file tinyxml.h.

Referenced by TiXmlNode::CopyTo(), GetUserData(), and SetUserData().

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
}

Definition at line 255 of file tinyxml.h.

Referenced by GetChar(), and TiXmlParsingData::Stamp().