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 std::string &str, std::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, std::string *name, TiXmlEncoding encoding)
 
static const char * ReadText (const char *in, std::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, std::string *tag)
 
static bool StreamWhiteSpace (std::istream *in, std::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

TiXmlBaseoperator= (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 198 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 268 of file tinyxml.h.

269  {
270  TIXML_NO_ERROR = 0,
271  TIXML_ERROR,
287 
289  };
anonymous enum
private
Enumerator
NUM_ENTITY 
MAX_ENTITY_LENGTH 

Definition at line 410 of file tinyxml.h.

411  {
412  NUM_ENTITY = 5,
414 
415  };

Constructor & Destructor Documentation

TiXmlBase::TiXmlBase ( )
inline

Definition at line 205 of file tinyxml.h.

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

Definition at line 206 of file tinyxml.h.

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

Member Function Documentation

int TiXmlBase::Column ( ) const
inline

See Row()

Definition at line 249 of file tinyxml.h.

References TiXmlCursor::col, and location.

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

Definition at line 95 of file tinyxmlparser.cc.

References convertSQLitetoXML_cfg::output.

Referenced by GetEntity().

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

References trackerHits::c, entity, and i.

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

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

Definition at line 331 of file tinyxml.h.

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

Referenced by ReadText().

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

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

Referenced by GetChar().

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

Get a pointer to arbitrary user data.

Definition at line 252 of file tinyxml.h.

References userData.

const void* TiXmlBase::GetUserData ( ) const
inline

Get a pointer to arbitrary user data.

Definition at line 253 of file tinyxml.h.

References userData.

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

Definition at line 136 of file tinyxmlparser.cc.

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

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

Definition at line 157 of file tinyxmlparser.cc.

Referenced by ReadName().

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

Definition at line 294 of file tinyxml.h.

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

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

Definition at line 298 of file tinyxml.h.

References IsWhiteSpace().

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

Return the current white space setting.

Definition at line 228 of file tinyxml.h.

References condenseWhiteSpace.

Referenced by TiXmlElement::ReadValue().

228 { return condenseWhiteSpace; }
static bool condenseWhiteSpace
Definition: tinyxml.h:417
TiXmlBase& 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,
std::string *  name,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 409 of file tinyxmlparser.cc.

References IsAlpha(), IsAlphaNum(), AlCaHLTBitMon_ParallelJobs::p, and errorMatrix2Lands_multiChannel::start.

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

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

Definition at line 582 of file tinyxmlparser.cc.

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

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

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

References location, and TiXmlCursor::row.

248 { return location.row + 1; }
TiXmlCursor location
Definition: tinyxml.h:377
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 225 of file tinyxml.h.

References condenseWhiteSpace.

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

Set a pointer to arbitrary user data.

Definition at line 251 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 321 of file tinyxmlparser.cc.

References IsWhiteSpace(), AlCaHLTBitMon_ParallelJobs::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().

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

Definition at line 388 of file tinyxmlparser.cc.

References trackerHits::c.

Referenced by TiXmlDocument::StreamIn().

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

Definition at line 373 of file tinyxmlparser.cc.

References trackerHits::c, and IsWhiteSpace().

Referenced by TiXmlElement::StreamIn().

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

Definition at line 542 of file tinyxmlparser.cc.

References AlCaHLTBitMon_ParallelJobs::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().

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

Definition at line 386 of file tinyxml.h.

References TIXML_ENCODING_UTF8, and v.

Referenced by StringEqual().

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

Friends And Related Function Documentation

friend class TiXmlDocument
friend

Definition at line 202 of file tinyxml.h.

friend class TiXmlElement
friend

Definition at line 201 of file tinyxml.h.

friend class TiXmlNode
friend

Definition at line 200 of file tinyxml.h.

Member Data Documentation

bool TiXmlBase::condenseWhiteSpace = true
staticprivate

Definition at line 417 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 416 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 375 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 380 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 257 of file tinyxml.h.

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