aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
TiXmlElement Class Reference

The element is a container class. More...

#include <tinyxml.h>

+ Inheritance diagram for TiXmlElement:
+ Collaboration diagram for TiXmlElement:

Public Attributes

std::vector< ticpp::Base *> m_spawnedWrappers
 Remember all wrappers that we've created with 'new' - ( e.g. More...
 

Public Member Functions

 TiXmlElement (const char *in_value)
 Construct an element. More...
 
 TiXmlElement (const std::string &_value)
 std::string constructor. More...
 
 TiXmlElement (const TiXmlElement &)
 
void operator= (const TiXmlElement &base)
 
virtual ~TiXmlElement ()
 
const char * Attribute (const char *name) const
 Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. More...
 
const char * Attribute (const char *name, int *i) const
 Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. More...
 
const char * Attribute (const char *name, double *d) const
 Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. More...
 
int QueryIntAttribute (const char *name, int *_value) const
 QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer error checking. More...
 
int QueryDoubleAttribute (const char *name, double *_value) const
 QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). More...
 
int QueryFloatAttribute (const char *name, float *_value) const
 QueryFloatAttribute examines the attribute - see QueryIntAttribute(). More...
 
template<typename T >
int QueryValueAttribute (const std::string &name, T *outValue) const
 Template form of the attribute query which will try to read the attribute into the specified type. More...
 
void SetAttribute (const char *name, const char *_value)
 Sets an attribute of name to a given value. More...
 
const std::string * Attribute (const std::string &name) const
 
const std::string * Attribute (const std::string &name, int *i) const
 
const std::string * Attribute (const std::string &name, double *d) const
 
int QueryIntAttribute (const std::string &name, int *_value) const
 
int QueryDoubleAttribute (const std::string &name, double *_value) const
 
void SetAttribute (const std::string &name, const std::string &_value)
 STL std::string form. More...
 
void SetAttribute (const std::string &name, int _value)
 
void SetAttribute (const char *name, int value)
 Sets an attribute of name to a given value. More...
 
void SetDoubleAttribute (const char *name, double value)
 Sets an attribute of name to a given value. More...
 
void RemoveAttribute (const char *name)
 Deletes an attribute with the given name. More...
 
void RemoveAttribute (const std::string &name)
 STL std::string form. More...
 
const TiXmlAttributeFirstAttribute () const
 Access the first attribute in this element. More...
 
TiXmlAttributeFirstAttribute ()
 
const TiXmlAttributeLastAttribute () const
 Access the last attribute in this element. More...
 
TiXmlAttributeLastAttribute ()
 
const char * GetText () const
 Convenience function for easy access to the text inside an element. More...
 
virtual TiXmlNodeClone () const
 Creates a new Element and returns it - the returned element is a copy. More...
 
virtual void Print (FILE *cfile, int depth) const
 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. More...
 
virtual const char * Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
 
virtual const TiXmlElementToElement () const
 Cast to a more defined type. Will return null not of the requested type. More...
 
virtual TiXmlElementToElement ()
 Cast to a more defined type. Will return null not of the requested type. More...
 
virtual bool Accept (TiXmlVisitor *visitor) const
 Walk the XML tree visiting this node and all of its children. More...
 
const char * Value () const
 The meaning of 'value' changes for the specific type of TiXmlNode. More...
 
const std::string & ValueStr () const
 Return Value() as a std::string. More...
 
const TIXML_STRINGValueTStr () const
 
void SetValue (const char *_value)
 Changes the value of the node. More...
 
void SetValue (const std::string &_value)
 STL std::string form. More...
 
void Clear ()
 Delete all the children of this node. Does not affect 'this'. More...
 
TiXmlNodeParent ()
 One step up the DOM. More...
 
const TiXmlNodeParent () const
 
const TiXmlNodeFirstChild () const
 The first child of this node. Will be null if there are no children. More...
 
TiXmlNodeFirstChild ()
 
const TiXmlNodeFirstChild (const char *value) const
 The first child of this node with the matching 'value'. Will be null if none found. The first child of this node with the matching 'value'. Will be null if none found. More...
 
TiXmlNodeFirstChild (const char *_value)
 
const TiXmlNodeFirstChild (const std::string &_value) const
 STL std::string form. More...
 
TiXmlNodeFirstChild (const std::string &_value)
 STL std::string form. More...
 
const TiXmlNodeLastChild () const
 
TiXmlNodeLastChild ()
 The last child of this node. Will be null if there are no children. More...
 
const TiXmlNodeLastChild (const char *value) const
 
TiXmlNodeLastChild (const char *_value)
 The last child of this node matching 'value'. Will be null if there are no children. More...
 
const TiXmlNodeLastChild (const std::string &_value) const
 STL std::string form. More...
 
TiXmlNodeLastChild (const std::string &_value)
 STL std::string form. More...
 
const TiXmlNodeIterateChildren (const TiXmlNode *previous) const
 An alternate way to walk the children of a node. More...
 
TiXmlNodeIterateChildren (const TiXmlNode *previous)
 
const TiXmlNodeIterateChildren (const char *value, const TiXmlNode *previous) const
 This flavor of IterateChildren searches for children with a particular 'value'. More...
 
TiXmlNodeIterateChildren (const char *_value, const TiXmlNode *previous)
 
const TiXmlNodeIterateChildren (const std::string &_value, const TiXmlNode *previous) const
 STL std::string form. More...
 
TiXmlNodeIterateChildren (const std::string &_value, const TiXmlNode *previous)
 STL std::string form. More...
 
TiXmlNodeInsertEndChild (const TiXmlNode &addThis)
 Add a new node related to this. More...
 
TiXmlNodeLinkEndChild (TiXmlNode *addThis)
 Add a new node related to this. More...
 
TiXmlNodeInsertBeforeChild (TiXmlNode *beforeThis, const TiXmlNode &addThis)
 Add a new node related to this. More...
 
TiXmlNodeInsertAfterChild (TiXmlNode *afterThis, const TiXmlNode &addThis)
 Add a new node related to this. More...
 
TiXmlNodeReplaceChild (TiXmlNode *replaceThis, const TiXmlNode &withThis)
 Replace a child of this node. More...
 
bool RemoveChild (TiXmlNode *removeThis)
 Delete a child of this node. More...
 
const TiXmlNodePreviousSibling () const
 Navigate to a sibling node. More...
 
TiXmlNodePreviousSibling ()
 
const TiXmlNodePreviousSibling (const char *) const
 Navigate to a sibling node. More...
 
TiXmlNodePreviousSibling (const char *_prev)
 
const TiXmlNodePreviousSibling (const std::string &_value) const
 STL std::string form. More...
 
TiXmlNodePreviousSibling (const std::string &_value)
 STL std::string form. More...
 
const TiXmlNodeNextSibling (const std::string &_value) const
 STL std::string form. More...
 
TiXmlNodeNextSibling (const std::string &_value)
 STL std::string form. More...
 
const TiXmlNodeNextSibling () const
 Navigate to a sibling node. More...
 
TiXmlNodeNextSibling ()
 
const TiXmlNodeNextSibling (const char *) const
 Navigate to a sibling node with the given 'value'. More...
 
TiXmlNodeNextSibling (const char *_next)
 
const TiXmlElementNextSiblingElement () const
 Convenience function to get through elements. More...
 
TiXmlElementNextSiblingElement ()
 
const TiXmlElementNextSiblingElement (const char *) const
 Convenience function to get through elements. More...
 
TiXmlElementNextSiblingElement (const char *_next)
 
const TiXmlElementNextSiblingElement (const std::string &_value) const
 STL std::string form. More...
 
TiXmlElementNextSiblingElement (const std::string &_value)
 STL std::string form. More...
 
const TiXmlElementFirstChildElement () const
 Convenience function to get through elements. More...
 
TiXmlElementFirstChildElement ()
 
const TiXmlElementFirstChildElement (const char *_value) const
 Convenience function to get through elements. More...
 
TiXmlElementFirstChildElement (const char *_value)
 
const TiXmlElementFirstChildElement (const std::string &_value) const
 STL std::string form. More...
 
TiXmlElementFirstChildElement (const std::string &_value)
 STL std::string form. More...
 
int Type () const
 Query the type (as an enumerated value, above) of this node. More...
 
const TiXmlDocumentGetDocument () const
 Return a pointer to the Document this node lives in. More...
 
TiXmlDocumentGetDocument ()
 
bool NoChildren () const
 Returns true if this node has no children. More...
 
virtual const TiXmlDocumentToDocument () const
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual TiXmlDocumentToDocument ()
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual const TiXmlCommentToComment () const
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual TiXmlCommentToComment ()
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual const TiXmlUnknownToUnknown () const
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual TiXmlUnknownToUnknown ()
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual const TiXmlTextToText () const
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual TiXmlTextToText ()
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual const TiXmlDeclarationToDeclaration () const
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual TiXmlDeclarationToDeclaration ()
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual const TiXmlStylesheetReferenceToStylesheetReference () const
 Cast to a more defined type. Will return null if not of the requested type. More...
 
virtual TiXmlStylesheetReferenceToStylesheetReference ()
 Cast to a more defined type. Will return null if not of the requested type. More...
 
int Row () const
 Return the position, in the original source file, of this node or attribute. More...
 
int Column () const
 See Row() More...
 
void SetUserData (void *user)
 Set a pointer to arbitrary user data. More...
 
void * GetUserData ()
 Get a pointer to arbitrary user data. More...
 
const void * GetUserData () const
 Get a pointer to arbitrary user data. More...
 
void DeleteSpawnedWrappers ()
 Delete all container objects we've spawned with 'new'. More...
 

Static Public Attributes

static const int utf8ByteTable [256]
 

Static Public Member Functions

static void SetCondenseWhiteSpace (bool condense)
 The world does not agree on whether white space should be kept or not. More...
 
static bool IsWhiteSpaceCondensed ()
 Return the current white space setting. More...
 
static void EncodeString (const TIXML_STRING &str, TIXML_STRING *out)
 Expands entities in a string. More...
 

Public Types

enum  NodeType {
  DOCUMENT, ELEMENT, COMMENT, UNKNOWN,
  TEXT, DECLARATION, STYLESHEETREFERENCE, TYPECOUNT
}
 The types of XML nodes supported by TinyXml. More...
 
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_nullptr, TIXML_ERROR_PARSING_CDATA,
  TIXML_ERROR_DOCUMENT_TOP_ONLY, TIXML_ERROR_STRING_COUNT
}
 

Protected Attributes

TiXmlNodeparent
 
NodeType type
 
TiXmlNodefirstChild
 
TiXmlNodelastChild
 
TIXML_STRING value
 
TiXmlNodeprev
 
TiXmlNodenext
 
TiXmlCursor location
 
void * userData
 Field containing a generic user pointer. More...
 

Protected Member Functions

void CopyTo (TiXmlElement *target) const
 
void ClearThis ()
 
virtual void StreamIn (std::istream *in, TIXML_STRING *tag)
 
const char * ReadValue (const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding)
 
void CopyTo (TiXmlNode *target) const
 
TiXmlNodeIdentify (const char *start, TiXmlEncoding encoding)
 

Static Protected Attributes

static const char * errorString [TIXML_ERROR_STRING_COUNT]
 

Static Protected Member Functions

static const char * SkipWhiteSpace (const char *, TiXmlEncoding encoding)
 
static bool IsWhiteSpace (char c)
 
static bool IsWhiteSpace (int c)
 
static bool StreamWhiteSpace (std::istream *in, TIXML_STRING *tag)
 
static bool StreamTo (std::istream *in, int character, TIXML_STRING *tag)
 
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 * GetEntity (const char *in, char *value, int *length, TiXmlEncoding encoding)
 
static const char * GetChar (const char *p, char *_value, int *length, TiXmlEncoding encoding)
 
static bool StringEqual (const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
 
static int IsAlpha (unsigned char anyByte, TiXmlEncoding encoding)
 
static int IsAlphaNum (unsigned char anyByte, TiXmlEncoding encoding)
 
static int ToLower (int v, TiXmlEncoding encoding)
 
static void ConvertUTF32ToUTF8 (unsigned long input, char *output, int *length)
 

Detailed Description

The element is a container class.

It has a value, the element name, and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes.

Definition at line 1095 of file tinyxml.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
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_nullptr 
TIXML_ERROR_PARSING_CDATA 
TIXML_ERROR_DOCUMENT_TOP_ONLY 
TIXML_ERROR_STRING_COUNT 

Definition at line 304 of file tinyxml.h.

304  {
305  TIXML_NO_ERROR = 0,
306  TIXML_ERROR,
322 
324  };

◆ NodeType

enum TiXmlNode::NodeType
inherited

The types of XML nodes supported by TinyXml.

(All the unsupported types are picked up by UNKNOWN.)

Enumerator
DOCUMENT 
ELEMENT 
COMMENT 
UNKNOWN 
TEXT 
DECLARATION 
STYLESHEETREFERENCE 
TYPECOUNT 

Definition at line 492 of file tinyxml.h.

Constructor & Destructor Documentation

◆ TiXmlElement() [1/3]

TiXmlElement::TiXmlElement ( const char *  in_value)

Construct an element.

Definition at line 434 of file tinyxml.cpp.

References TiXmlNode::ELEMENT, TiXmlNode::firstChild, TiXmlNode::lastChild, and TiXmlNode::TiXmlNode().

436  firstChild = lastChild = 0;
437  value = _value;
438 }
TiXmlNode * firstChild
Definition: tinyxml.h:895
TiXmlNode(NodeType _type)
Definition: tinyxml.cpp:113
TIXML_STRING value
Definition: tinyxml.h:898
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the call graph for this function:

◆ TiXmlElement() [2/3]

TiXmlElement::TiXmlElement ( const std::string &  _value)

std::string constructor.

Definition at line 441 of file tinyxml.cpp.

References TiXmlNode::ELEMENT, TiXmlNode::firstChild, TiXmlNode::lastChild, and TiXmlNode::TiXmlNode().

443  firstChild = lastChild = 0;
444  value = _value;
445 }
TiXmlNode * firstChild
Definition: tinyxml.h:895
TiXmlNode(NodeType _type)
Definition: tinyxml.cpp:113
TIXML_STRING value
Definition: tinyxml.h:898
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the call graph for this function:

◆ TiXmlElement() [3/3]

TiXmlElement::TiXmlElement ( const TiXmlElement copy)

Definition at line 448 of file tinyxml.cpp.

References CopyTo(), TiXmlNode::ELEMENT, TiXmlNode::firstChild, TiXmlNode::lastChild, and TiXmlNode::TiXmlNode().

450  firstChild = lastChild = 0;
451  copy.CopyTo(this);
452 }
TiXmlNode * firstChild
Definition: tinyxml.h:895
void CopyTo(TiXmlElement *target) const
Definition: tinyxml.cpp:716
TiXmlNode(NodeType _type)
Definition: tinyxml.cpp:113
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the call graph for this function:

◆ ~TiXmlElement()

TiXmlElement::~TiXmlElement ( )
virtual

Definition at line 459 of file tinyxml.cpp.

References ClearThis().

459 { ClearThis(); }
void ClearThis()
Definition: tinyxml.cpp:461
+ Here is the call graph for this function:

Member Function Documentation

◆ Accept()

bool TiXmlElement::Accept ( TiXmlVisitor visitor) const
virtual

Walk the XML tree visiting this node and all of its children.

Implements TiXmlNode.

Definition at line 736 of file tinyxml.cpp.

References TiXmlNode::Accept(), TiXmlNode::NextSibling(), and TiXmlVisitor::VisitExit().

736  {
737  if (visitor->VisitEnter(*this, attributeSet.First())) {
738  for (const TiXmlNode* node = FirstChild(); node; node = node->NextSibling()) {
739  if (!node->Accept(visitor)) break;
740  }
741  }
742 
743  return visitor->VisitExit(*this);
744 }
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:149
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:552
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
const TiXmlAttribute * First() const
Definition: tinyxml.h:1054
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:151
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:

◆ Attribute() [1/6]

const char * TiXmlElement::Attribute ( const char *  name) const

Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.

Definition at line 471 of file tinyxml.cpp.

References TiXmlAttribute::Value().

Referenced by Attribute().

471  {
472  const TiXmlAttribute* node = attributeSet.Find(name);
473 
474  if (node) return node->Value();
475 
476  return 0;
477 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:947
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Attribute() [2/6]

const char * TiXmlElement::Attribute ( const char *  name,
int *  i 
) const

Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.

If the attribute exists and can be converted to an integer, the integer value will be put in the return 'i', if 'i' is non-null.

Definition at line 489 of file tinyxml.cpp.

References Attribute().

489  {
490  const char* s = Attribute(name);
491 
492  if (i) {
493  if (s) {
494  *i = atoi(s);
495  } else {
496  *i = 0;
497  }
498  }
499 
500  return s;
501 }
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition: tinyxml.cpp:471
+ Here is the call graph for this function:

◆ Attribute() [3/6]

const char * TiXmlElement::Attribute ( const char *  name,
double d 
) const

Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.

If the attribute exists and can be converted to an double, the double value will be put in the return 'd', if 'd' is non-null.

Definition at line 519 of file tinyxml.cpp.

References Attribute().

519  {
520  const char* s = Attribute(name);
521 
522  if (d) {
523  if (s) {
524  *d = atof(s);
525  } else {
526  *d = 0;
527  }
528  }
529 
530  return s;
531 }
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition: tinyxml.cpp:471
+ Here is the call graph for this function:

◆ Attribute() [4/6]

const std::string * TiXmlElement::Attribute ( const std::string &  name) const

Definition at line 480 of file tinyxml.cpp.

480  {
481  const TiXmlAttribute* node = attributeSet.Find(name);
482 
483  if (node) return &node->ValueStr();
484 
485  return 0;
486 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
const std::string & ValueStr() const
Return the value of this attribute.
Definition: tinyxml.h:951
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482

◆ Attribute() [5/6]

const std::string * TiXmlElement::Attribute ( const std::string &  name,
int *  i 
) const

Definition at line 504 of file tinyxml.cpp.

504  {
505  const std::string* s = Attribute(name);
506 
507  if (i) {
508  if (s) {
509  *i = atoi(s->c_str());
510  } else {
511  *i = 0;
512  }
513  }
514 
515  return s;
516 }
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition: tinyxml.cpp:471

◆ Attribute() [6/6]

const std::string * TiXmlElement::Attribute ( const std::string &  name,
double d 
) const

Definition at line 534 of file tinyxml.cpp.

535  {
536  const std::string* s = Attribute(name);
537 
538  if (d) {
539  if (s) {
540  *d = atof(s->c_str());
541  } else {
542  *d = 0;
543  }
544  }
545 
546  return s;
547 }
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition: tinyxml.cpp:471

◆ Clear()

void TiXmlNode::Clear ( )
inherited

Delete all the children of this node. Does not affect 'this'.

Definition at line 139 of file tinyxml.cpp.

References TiXmlNode::firstChild, TiXmlNode::lastChild, and TiXmlNode::next.

Referenced by ticpp::Node::Clear().

139  {
140  TiXmlNode* node = firstChild;
141  TiXmlNode* temp = 0;
142 
143  while (node) {
144  temp = node;
145  node = node->next;
146  delete temp;
147  }
148 
149  firstChild = 0;
150  lastChild = 0;
151 }
TiXmlNode * firstChild
Definition: tinyxml.h:895
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
TiXmlNode * next
Definition: tinyxml.h:901
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the caller graph for this function:

◆ ClearThis()

void TiXmlElement::ClearThis ( )
protected

Definition at line 461 of file tinyxml.cpp.

Referenced by operator=(), and ~TiXmlElement().

461  {
462  Clear();
463 
464  while (attributeSet.First()) {
466  attributeSet.Remove(node);
467  delete node;
468  }
469 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * First() const
Definition: tinyxml.h:1054
void Remove(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1442
void Clear()
Delete all the children of this node. Does not affect &#39;this&#39;.
Definition: tinyxml.cpp:139
+ Here is the caller graph for this function:

◆ Clone()

TiXmlNode * TiXmlElement::Clone ( ) const
virtual

Creates a new Element and returns it - the returned element is a copy.

Implements TiXmlNode.

Definition at line 746 of file tinyxml.cpp.

References CopyTo().

746  {
747  TiXmlElement* clone = new TiXmlElement(Value());
748 
749  if (!clone) return 0;
750 
751  CopyTo(clone);
752  return clone;
753 }
void CopyTo(TiXmlElement *target) const
Definition: tinyxml.cpp:716
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:517
TiXmlElement(const char *in_value)
Construct an element.
Definition: tinyxml.cpp:434
The element is a container class.
Definition: tinyxml.h:1095
+ Here is the call graph for this function:

◆ Column()

int TiXmlBase::Column ( ) const
inlineinherited

See Row()

Definition at line 276 of file tinyxml.h.

References TiXmlCursor::col, and TiXmlBase::location.

Referenced by ticpp::Base::Column().

+ Here is the caller graph for this function:

◆ ConvertUTF32ToUTF8()

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

Definition at line 100 of file tinyxmlparser.cpp.

Referenced by TiXmlBase::GetEntity().

102  {
103  const unsigned long BYTE_MASK = 0xBF;
104  const unsigned long BYTE_MARK = 0x80;
105  const unsigned long FIRST_BYTE_MARK[7] = {
106  0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC};
107 
108  if (input < 0x80)
109  *length = 1;
110  else if (input < 0x800)
111  *length = 2;
112  else if (input < 0x10000)
113  *length = 3;
114  else if (input < 0x200000)
115  *length = 4;
116  else {
117  *length = 0;
118  return;
119  } // This code won't covert this correctly anyway.
120 
121  output += *length;
122 
123  // Scary scary fall throughs.
124  switch (*length) {
125  case 4:
126  --output;
127  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
128  input >>= 6;
129 
130  case 3:
131  --output;
132  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
133  input >>= 6;
134 
135  case 2:
136  --output;
137  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
138  input >>= 6;
139 
140  case 1:
141  --output;
142  *output = (char)(input | FIRST_BYTE_MARK[*length]);
143  }
144 }
+ Here is the caller graph for this function:

◆ CopyTo() [1/2]

void TiXmlNode::CopyTo ( TiXmlNode target) const
protectedinherited

Definition at line 134 of file tinyxml.cpp.

References TiXmlBase::userData.

134  {
135  target->SetValue(value.c_str());
136  target->userData = userData;
137 }
void SetValue(const char *_value)
Changes the value of the node.
Definition: tinyxml.h:538
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:413
TIXML_STRING value
Definition: tinyxml.h:898

◆ CopyTo() [2/2]

void TiXmlElement::CopyTo ( TiXmlElement target) const
protected

Definition at line 716 of file tinyxml.cpp.

References TiXmlNode::firstChild, TiXmlAttribute::Name(), TiXmlAttribute::Next(), TiXmlNode::NextSibling(), SetAttribute(), and TiXmlAttribute::Value().

Referenced by Clone(), operator=(), and TiXmlElement().

716  {
717  // superclass:
718  TiXmlNode::CopyTo(target);
719 
720  // Element class:
721  // Clone the attributes, then clone the children.
722  const TiXmlAttribute* attribute = 0;
723 
724  for (attribute = attributeSet.First(); attribute;
725  attribute = attribute->Next()) {
726  target->SetAttribute(attribute->Name(), attribute->Value());
727  }
728 
729  TiXmlNode* node = 0;
730 
731  for (node = firstChild; node; node = node->NextSibling()) {
732  target->LinkEndChild(node->Clone());
733  }
734 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:944
TiXmlNode * firstChild
Definition: tinyxml.h:895
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
Definition: tinyxml.cpp:153
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:947
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
Definition: tinyxml.cpp:615
void CopyTo(TiXmlNode *target) const
Definition: tinyxml.cpp:134
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cpp:1043
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
const TiXmlAttribute * First() const
Definition: tinyxml.h:1054
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteSpawnedWrappers()

void TiCppRC::DeleteSpawnedWrappers ( )
inherited

Delete all container objects we've spawned with 'new'.

Definition at line 929 of file ticpp.cpp.

929  {
930  std::vector< Base* >::reverse_iterator wrapper;
931 
932  for (wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend();
933  ++wrapper) {
934  delete *wrapper;
935  }
936 
937  m_spawnedWrappers.clear();
938 }
std::vector< ticpp::Base *> m_spawnedWrappers
Remember all wrappers that we&#39;ve created with &#39;new&#39; - ( e.g.
Definition: ticpprc.h:63

◆ EncodeString()

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

Expands entities in a string.

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

Definition at line 50 of file tinyxml.cpp.

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

◆ FirstAttribute() [1/2]

const TiXmlAttribute* TiXmlElement::FirstAttribute ( ) const
inline

Access the first attribute in this element.

Definition at line 1237 of file tinyxml.h.

◆ FirstAttribute() [2/2]

TiXmlAttribute* TiXmlElement::FirstAttribute ( )
inline

Definition at line 1240 of file tinyxml.h.

1240 { return attributeSet.First(); }
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * First() const
Definition: tinyxml.h:1054

◆ FirstChild() [1/6]

const TiXmlNode* TiXmlNode::FirstChild ( ) const
inlineinherited

The first child of this node. Will be null if there are no children.

Definition at line 552 of file tinyxml.h.

References TiXmlNode::firstChild.

Referenced by TiXmlNode::FirstChildElement(), and TiXmlNode::IterateChildren().

+ Here is the caller graph for this function:

◆ FirstChild() [2/6]

TiXmlNode* TiXmlNode::FirstChild ( )
inlineinherited

Definition at line 555 of file tinyxml.h.

References TiXmlNode::firstChild.

Referenced by TiXmlHandle::Child(), ticpp::Node::FirstChild(), and TiXmlHandle::FirstChild().

555 { return firstChild; }
TiXmlNode * firstChild
Definition: tinyxml.h:895
+ Here is the caller graph for this function:

◆ FirstChild() [3/6]

const TiXmlNode * TiXmlNode::FirstChild ( const char *  value) const
inherited

The first child of this node with the matching 'value'. Will be null if none found. The first child of this node with the matching 'value'. Will be null if none found.

Definition at line 311 of file tinyxml.cpp.

References TiXmlNode::firstChild, TiXmlNode::next, and TiXmlNode::Value().

Referenced by TiXmlNode::FirstChild(), TiXmlNode::FirstChildElement(), and TiXmlNode::IterateChildren().

311  {
312  const TiXmlNode* node;
313 
314  for (node = firstChild; node; node = node->next) {
315  if (strcmp(node->Value(), _value) == 0) return node;
316  }
317 
318  return 0;
319 }
TiXmlNode * firstChild
Definition: tinyxml.h:895
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:517
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
TiXmlNode * next
Definition: tinyxml.h:901
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FirstChild() [4/6]

TiXmlNode* TiXmlNode::FirstChild ( const char *  _value)
inlineinherited

Definition at line 564 of file tinyxml.h.

References TiXmlNode::FirstChild().

Referenced by TiXmlHandle::Child(), ticpp::Node::FirstChild(), and TiXmlHandle::FirstChild().

564  {
565  // Call through to the const version - safe since nothing is changed.
566  // Exiting
567  // syntax: cast this to a const (always safe)
568  // call the method, cast the return back to non-const.
569  return const_cast< TiXmlNode* >(
570  (const_cast< const TiXmlNode* >(this))->FirstChild(_value));
571  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FirstChild() [5/6]

const TiXmlNode* TiXmlNode::FirstChild ( const std::string &  _value) const
inlineinherited

STL std::string form.

Definition at line 587 of file tinyxml.h.

◆ FirstChild() [6/6]

TiXmlNode* TiXmlNode::FirstChild ( const std::string &  _value)
inlineinherited

STL std::string form.

Definition at line 590 of file tinyxml.h.

◆ FirstChildElement() [1/6]

const TiXmlElement * TiXmlNode::FirstChildElement ( ) const
inherited

Convenience function to get through elements.

Definition at line 384 of file tinyxml.cpp.

References TiXmlNode::FirstChild(), TiXmlNode::NextSibling(), and TiXmlNode::ToElement().

Referenced by TiXmlNode::FirstChildElement().

384  {
385  const TiXmlNode* node;
386 
387  for (node = FirstChild(); node; node = node->NextSibling()) {
388  if (node->ToElement()) return node->ToElement();
389  }
390 
391  return 0;
392 }
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:788
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:552
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FirstChildElement() [2/6]

TiXmlElement* TiXmlNode::FirstChildElement ( )
inlineinherited

Definition at line 745 of file tinyxml.h.

References TiXmlNode::FirstChildElement().

Referenced by TiXmlHandle::ChildElement(), ticpp::Node::FirstChildElement(), and TiXmlHandle::FirstChildElement().

745  {
746  return const_cast< TiXmlElement* >(
747  (const_cast< const TiXmlNode* >(this))->FirstChildElement());
748  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
The element is a container class.
Definition: tinyxml.h:1095
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FirstChildElement() [3/6]

const TiXmlElement * TiXmlNode::FirstChildElement ( const char *  _value) const
inherited

Convenience function to get through elements.

Definition at line 394 of file tinyxml.cpp.

References TiXmlNode::FirstChild(), TiXmlNode::NextSibling(), and TiXmlNode::ToElement().

Referenced by TiXmlNode::FirstChildElement().

394  {
395  const TiXmlNode* node;
396 
397  for (node = FirstChild(_value); node; node = node->NextSibling(_value)) {
398  if (node->ToElement()) return node->ToElement();
399  }
400 
401  return 0;
402 }
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:788
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:552
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FirstChildElement() [4/6]

TiXmlElement* TiXmlNode::FirstChildElement ( const char *  _value)
inlineinherited

Definition at line 752 of file tinyxml.h.

References TiXmlNode::FirstChildElement().

Referenced by TiXmlHandle::ChildElement(), ticpp::Node::FirstChildElement(), and TiXmlHandle::FirstChildElement().

752  {
753  return const_cast< TiXmlElement* >(
754  (const_cast< const TiXmlNode* >(this))->FirstChildElement(_value));
755  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
The element is a container class.
Definition: tinyxml.h:1095
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FirstChildElement() [5/6]

const TiXmlElement* TiXmlNode::FirstChildElement ( const std::string &  _value) const
inlineinherited

STL std::string form.

Definition at line 758 of file tinyxml.h.

◆ FirstChildElement() [6/6]

TiXmlElement* TiXmlNode::FirstChildElement ( const std::string &  _value)
inlineinherited

STL std::string form.

Definition at line 761 of file tinyxml.h.

◆ GetChar()

static const char* TiXmlBase::GetChar ( const char *  p,
char *  _value,
int *  length,
TiXmlEncoding  encoding 
)
inlinestaticprotectedinherited

Definition at line 368 of file tinyxml.h.

References TiXmlBase::GetEntity(), TIXML_ENCODING_UTF8, and TiXmlBase::utf8ByteTable.

Referenced by TiXmlBase::ReadText().

368  {
369  assert(p);
370 
371  if (encoding == TIXML_ENCODING_UTF8) {
372  *length = utf8ByteTable[*((const unsigned char*)p)];
373  assert(*length >= 0 && *length < 5);
374  } else {
375  *length = 1;
376  }
377 
378  if (*length == 1) {
379  if (*p == '&') return GetEntity(p, _value, length, encoding);
380 
381  *_value = *p;
382  return p + 1;
383  } else if (*length) {
384  // strncpy( _value, p, *length ); // lots of compilers don't like this
385  // function (unsafe),
386  // and the null terminator isn't needed
387  for (int i = 0; p[i] && i < *length; ++i) {
388  _value[i] = p[i];
389  }
390 
391  return p + (*length);
392  } else {
393  // Not valid text.
394  return 0;
395  }
396  }
static const int utf8ByteTable[256]
Definition: tinyxml.h:290
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDocument() [1/2]

const TiXmlDocument * TiXmlNode::GetDocument ( ) const
inherited

Return a pointer to the Document this node lives in.

Returns null if not in a document.

Definition at line 424 of file tinyxml.cpp.

References TiXmlNode::parent.

424  {
425  const TiXmlNode* node;
426 
427  for (node = this; node; node = node->parent) {
428  if (node->ToDocument()) return node->ToDocument();
429  }
430 
431  return 0;
432 }
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:784
TiXmlNode * parent
Definition: tinyxml.h:892
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454

◆ GetDocument() [2/2]

TiXmlDocument* TiXmlNode::GetDocument ( )
inlineinherited

Definition at line 776 of file tinyxml.h.

776  {
777  return const_cast< TiXmlDocument* >(
778  (const_cast< const TiXmlNode* >(this))->GetDocument());
779  }
Always the top level node.
Definition: tinyxml.h:1655
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454

◆ GetEntity()

const char * TiXmlBase::GetEntity ( const char *  in,
char *  value,
int *  length,
TiXmlEncoding  encoding 
)
staticprotectedinherited

Definition at line 442 of file tinyxmlparser.cpp.

References TiXmlBase::Entity::chr, TiXmlBase::ConvertUTF32ToUTF8(), TiXmlBase::entity, TiXmlBase::NUM_ENTITY, TiXmlBase::Entity::strLength, and TIXML_ENCODING_UTF8.

Referenced by TiXmlBase::GetChar().

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

◆ GetText()

const char * TiXmlElement::GetText ( ) const

Convenience function for easy access to the text inside an element.

Although easy and concise, GetText() is limited compared to getting the TiXmlText child and accessing it directly.

If the first child of 'this' is a TiXmlText, the GetText() returns the character string of the Text node, else null is returned.

This is a convenient method for getting the text of simple contained text:

<foo>This is text</foo>
const char* str = fooElement->GetText();

'str' will be a pointer to "This is text".

Note that this function can be misleading. If the element foo was created from this XML:

<foo><b>This is text</b></foo>

then the value of str would be null. The first child node isn't a text node, it is another element. From this XML:

<foo>This is <b>text</b></foo>

GetText() will return "This is ".

WARNING: GetText() accesses a child node - don't become confused with the similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are safe type casts on the referenced node.

Definition at line 755 of file tinyxml.cpp.

References TiXmlText::TiXmlElement, and TiXmlNode::ToText().

755  {
756  const TiXmlNode* child = this->FirstChild();
757 
758  if (child) {
759  const TiXmlText* childText = child->ToText();
760 
761  if (childText) {
762  return childText->Value();
763  }
764  }
765 
766  return 0;
767 }
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:800
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:517
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:552
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
XML text.
Definition: tinyxml.h:1386
+ Here is the call graph for this function:

◆ GetUserData() [1/2]

void* TiXmlBase::GetUserData ( )
inlineinherited

Get a pointer to arbitrary user data.

Definition at line 281 of file tinyxml.h.

References TiXmlBase::userData.

◆ GetUserData() [2/2]

const void* TiXmlBase::GetUserData ( ) const
inlineinherited

Get a pointer to arbitrary user data.

Definition at line 284 of file tinyxml.h.

References TiXmlBase::userData.

◆ Identify()

TiXmlNode * TiXmlNode::Identify ( const char *  start,
TiXmlEncoding  encoding 
)
protectedinherited

Definition at line 788 of file tinyxmlparser.cpp.

References TiXmlBase::IsAlpha(), TiXmlNode::parent, TiXmlText::SetCDATA(), TiXmlDocument::SetError(), TiXmlBase::SkipWhiteSpace(), TiXmlBase::StringEqual(), TIXML_ENCODING_UNKNOWN, TiXmlBase::TIXML_ERROR_OUT_OF_MEMORY, TiXmlText::TiXmlElement, and TiXmlText::TiXmlText().

788  {
789  TiXmlNode* returnNode = 0;
790 
791  p = SkipWhiteSpace(p, encoding);
792 
793  if (!p || !*p || *p != '<') {
794  return 0;
795  }
796 
797  TiXmlDocument* doc = GetDocument();
798  p = SkipWhiteSpace(p, encoding);
799 
800  if (!p || !*p) {
801  return 0;
802  }
803 
804  // What is this thing?
805  // - Elements start with a letter or underscore, but xml is reserved.
806  // - Comments: <!--
807  // - Decleration: <?xml
808  // - StylesheetReference <?xml-stylesheet
809  // - Everthing else is unknown to tinyxml.
810  //
811 
812  const char* xmlHeader = {"<?xml"};
813  const char* xmlSSHeader = {"<?xml-stylesheet"};
814  const char* commentHeader = {"<!--"};
815  const char* dtdHeader = {"<!"};
816  const char* cdataHeader = {"<![CDATA["};
817 
818  if (StringEqual(p, xmlSSHeader, true, encoding)) {
819 #ifdef DEBUG_PARSER
820  TIXML_LOG("XML parsing Stylesheet Reference\n");
821 #endif
822  returnNode = new TiXmlStylesheetReference();
823  } else if (StringEqual(p, xmlHeader, true, encoding)) {
824 #ifdef DEBUG_PARSER
825  TIXML_LOG("XML parsing Declaration\n");
826 #endif
827  returnNode = new TiXmlDeclaration();
828  } else if (StringEqual(p, commentHeader, false, encoding)) {
829 #ifdef DEBUG_PARSER
830  TIXML_LOG("XML parsing Comment\n");
831 #endif
832  returnNode = new TiXmlComment();
833  } else if (StringEqual(p, cdataHeader, false, encoding)) {
834 #ifdef DEBUG_PARSER
835  TIXML_LOG("XML parsing CDATA\n");
836 #endif
837  TiXmlText* text = new TiXmlText("");
838  text->SetCDATA(true);
839  returnNode = text;
840  } else if (StringEqual(p, dtdHeader, false, encoding)) {
841 #ifdef DEBUG_PARSER
842  TIXML_LOG("XML parsing Unknown(1)\n");
843 #endif
844  returnNode = new TiXmlUnknown();
845  } else if (IsAlpha(*(p + 1), encoding) || *(p + 1) == '_') {
846 #ifdef DEBUG_PARSER
847  TIXML_LOG("XML parsing Element\n");
848 #endif
849  returnNode = new TiXmlElement("");
850  } else {
851 #ifdef DEBUG_PARSER
852  TIXML_LOG("XML parsing Unknown(2)\n");
853 #endif
854  returnNode = new TiXmlUnknown();
855  }
856 
857  if (returnNode) {
858  // Set the parent, so it can report errors
859  returnNode->parent = this;
860  } else {
861  if (doc)
863  }
864 
865  return returnNode;
866 }
A stylesheet reference looks like this:
Definition: tinyxml.h:1543
In correct XML the declaration is the first entry in the file.
Definition: tinyxml.h:1469
Any tag that tinyXml doesn&#39;t recognize is saved as an unknown.
Definition: tinyxml.h:1608
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1422
Always the top level node.
Definition: tinyxml.h:1655
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
friend class TiXmlElement
Definition: tinyxml.h:456
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
TiXmlNode * parent
Definition: tinyxml.h:892
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
XML text.
Definition: tinyxml.h:1386
An XML comment.
Definition: tinyxml.h:1330
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
+ Here is the call graph for this function:

◆ InsertAfterChild()

TiXmlNode * TiXmlNode::InsertAfterChild ( TiXmlNode afterThis,
const TiXmlNode addThis 
)
inherited

Add a new node related to this.

Adds a child after the specified child. Returns a pointer to the new object or nullptr if an error occured.

Definition at line 231 of file tinyxml.cpp.

References TiXmlNode::Clone(), TiXmlNode::DOCUMENT, TiXmlNode::lastChild, TiXmlNode::next, TiXmlNode::parent, TiXmlNode::prev, and TiXmlNode::Type().

Referenced by ticpp::Node::InsertAfterChild().

232  {
233  if (!afterThis || afterThis->parent != this) {
234  return 0;
235  }
236 
237  if (addThis.Type() == TiXmlNode::DOCUMENT) {
238  if (GetDocument())
241 
242  return 0;
243  }
244 
245  TiXmlNode* node = addThis.Clone();
246 
247  if (!node) return 0;
248 
249  node->parent = this;
250 
251  node->prev = afterThis;
252  node->next = afterThis->next;
253 
254  if (afterThis->next) {
255  afterThis->next->prev = node;
256  } else {
257  assert(lastChild == afterThis);
258  lastChild = node;
259  }
260 
261  afterThis->next = node;
262  return node;
263 }
TiXmlNode * prev
Definition: tinyxml.h:900
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
int Type() const
Query the type (as an enumerated value, above) of this node.
Definition: tinyxml.h:770
TiXmlNode * parent
Definition: tinyxml.h:892
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
TiXmlNode * next
Definition: tinyxml.h:901
TiXmlNode * lastChild
Definition: tinyxml.h:896
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InsertBeforeChild()

TiXmlNode * TiXmlNode::InsertBeforeChild ( TiXmlNode beforeThis,
const TiXmlNode addThis 
)
inherited

Add a new node related to this.

Adds a child before the specified child. Returns a pointer to the new object or nullptr if an error occured.

Definition at line 197 of file tinyxml.cpp.

References TiXmlNode::Clone(), TiXmlNode::DOCUMENT, TiXmlNode::firstChild, TiXmlNode::next, TiXmlNode::parent, TiXmlNode::prev, and TiXmlNode::Type().

Referenced by ticpp::Node::InsertBeforeChild().

198  {
199  if (!beforeThis || beforeThis->parent != this) {
200  return 0;
201  }
202 
203  if (addThis.Type() == TiXmlNode::DOCUMENT) {
204  if (GetDocument())
207 
208  return 0;
209  }
210 
211  TiXmlNode* node = addThis.Clone();
212 
213  if (!node) return 0;
214 
215  node->parent = this;
216 
217  node->next = beforeThis;
218  node->prev = beforeThis->prev;
219 
220  if (beforeThis->prev) {
221  beforeThis->prev->next = node;
222  } else {
223  assert(firstChild == beforeThis);
224  firstChild = node;
225  }
226 
227  beforeThis->prev = node;
228  return node;
229 }
TiXmlNode * prev
Definition: tinyxml.h:900
TiXmlNode * firstChild
Definition: tinyxml.h:895
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
int Type() const
Query the type (as an enumerated value, above) of this node.
Definition: tinyxml.h:770
TiXmlNode * parent
Definition: tinyxml.h:892
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
TiXmlNode * next
Definition: tinyxml.h:901
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InsertEndChild()

TiXmlNode * TiXmlNode::InsertEndChild ( const TiXmlNode addThis)
inherited

Add a new node related to this.

Adds a child past the LastChild. Returns a pointer to the new object or nullptr if an error occured.

Definition at line 181 of file tinyxml.cpp.

References TiXmlNode::Clone(), TiXmlNode::DOCUMENT, TiXmlNode::LinkEndChild(), and TiXmlNode::Type().

Referenced by ticpp::Node::InsertEndChild().

181  {
182  if (addThis.Type() == TiXmlNode::DOCUMENT) {
183  if (GetDocument())
186 
187  return 0;
188  }
189 
190  TiXmlNode* node = addThis.Clone();
191 
192  if (!node) return 0;
193 
194  return LinkEndChild(node);
195 }
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
Definition: tinyxml.cpp:153
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
int Type() const
Query the type (as an enumerated value, above) of this node.
Definition: tinyxml.h:770
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAlpha()

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

Definition at line 146 of file tinyxmlparser.cpp.

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

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

◆ IsAlphaNum()

int TiXmlBase::IsAlphaNum ( unsigned char  anyByte,
TiXmlEncoding  encoding 
)
staticprotectedinherited

Definition at line 170 of file tinyxmlparser.cpp.

Referenced by TiXmlBase::ReadName().

171  {
172  // This will only work for low-ascii, everything else is assumed to be a valid
173  // letter. I'm not sure this is the best approach, but it is quite tricky
174  // trying
175  // to figure out alhabetical vs. not across encoding. So take a very
176  // conservative approach.
177 
178  // if ( encoding == TIXML_ENCODING_UTF8 )
179  // {
180  if (anyByte < 127)
181  return isalnum(anyByte);
182  else
183  return 1; // What else to do? The unicode set is huge...get the english
184  // ones
185  // right.
186 
187  // }
188  // else
189  // {
190  // return isalnum( anyByte );
191  // }
192 }
+ Here is the caller graph for this function:

◆ IsWhiteSpace() [1/2]

static bool TiXmlBase::IsWhiteSpace ( char  c)
inlinestaticprotectedinherited

Definition at line 328 of file tinyxml.h.

Referenced by TiXmlBase::IsWhiteSpace(), TiXmlAttribute::Parse(), TiXmlDeclaration::Parse(), TiXmlStylesheetReference::Parse(), TiXmlBase::ReadText(), and TiXmlBase::SkipWhiteSpace().

328  {
329  return (std::isspace((unsigned char)c) || c == '\n' || c == '\r');
330  }
+ Here is the caller graph for this function:

◆ IsWhiteSpace() [2/2]

static bool TiXmlBase::IsWhiteSpace ( int  c)
inlinestaticprotectedinherited

Definition at line 331 of file tinyxml.h.

References TiXmlBase::IsWhiteSpace().

Referenced by StreamIn(), and TiXmlBase::StreamWhiteSpace().

331  {
332  if (c < 256) return IsWhiteSpace((char)c);
333 
334  return false; // Again, only truly correct for English/Latin...but usually
335  // works.
336  }
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:328
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWhiteSpaceCondensed()

static bool TiXmlBase::IsWhiteSpaceCondensed ( )
inlinestaticinherited

Return the current white space setting.

Definition at line 247 of file tinyxml.h.

References TiXmlBase::condenseWhiteSpace.

Referenced by ReadValue().

247 { return condenseWhiteSpace; }
static bool condenseWhiteSpace
Definition: tinyxml.h:445
+ Here is the caller graph for this function:

◆ IterateChildren() [1/6]

const TiXmlNode * TiXmlNode::IterateChildren ( const TiXmlNode previous) const
inherited

An alternate way to walk the children of a node.

One way to iterate over nodes is:

  for( child = parent->FirstChild(); child; child = child->NextSibling() )

IterateChildren does the same thing with the syntax:

  child = 0;
  while( child = parent->IterateChildren( child ) )

IterateChildren takes the previous child as input and finds the next one. If the previous child is null, it returns the first. IterateChildren will return null when done.

Definition at line 331 of file tinyxml.cpp.

References TiXmlNode::FirstChild(), TiXmlNode::NextSibling(), and TiXmlNode::parent.

Referenced by TiXmlNode::IterateChildren().

331  {
332  if (!previous) {
333  return FirstChild();
334  } else {
335  assert(previous->parent == this);
336  return previous->NextSibling();
337  }
338 }
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:552
TiXmlNode * parent
Definition: tinyxml.h:892
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IterateChildren() [2/6]

TiXmlNode* TiXmlNode::IterateChildren ( const TiXmlNode previous)
inlineinherited

Definition at line 618 of file tinyxml.h.

References TiXmlNode::IterateChildren().

Referenced by ticpp::Node::IterateChildren().

618  {
619  return const_cast< TiXmlNode* >(
620  (const_cast< const TiXmlNode* >(this))->IterateChildren(previous));
621  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IterateChildren() [3/6]

const TiXmlNode * TiXmlNode::IterateChildren ( const char *  value,
const TiXmlNode previous 
) const
inherited

This flavor of IterateChildren searches for children with a particular 'value'.

Definition at line 340 of file tinyxml.cpp.

References TiXmlNode::FirstChild(), TiXmlNode::NextSibling(), and TiXmlNode::parent.

Referenced by TiXmlNode::IterateChildren().

341  {
342  if (!previous) {
343  return FirstChild(val);
344  } else {
345  assert(previous->parent == this);
346  return previous->NextSibling(val);
347  }
348 }
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:552
TiXmlNode * parent
Definition: tinyxml.h:892
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IterateChildren() [4/6]

TiXmlNode* TiXmlNode::IterateChildren ( const char *  _value,
const TiXmlNode previous 
)
inlineinherited

Definition at line 627 of file tinyxml.h.

References TiXmlNode::IterateChildren().

627  {
628  return const_cast< TiXmlNode* >(
629  (const_cast< const TiXmlNode* >(this))->IterateChildren(_value, previous));
630  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
+ Here is the call graph for this function:

◆ IterateChildren() [5/6]

const TiXmlNode* TiXmlNode::IterateChildren ( const std::string &  _value,
const TiXmlNode previous 
) const
inlineinherited

STL std::string form.

Definition at line 633 of file tinyxml.h.

◆ IterateChildren() [6/6]

TiXmlNode* TiXmlNode::IterateChildren ( const std::string &  _value,
const TiXmlNode previous 
)
inlineinherited

STL std::string form.

Definition at line 637 of file tinyxml.h.

◆ LastAttribute() [1/2]

const TiXmlAttribute* TiXmlElement::LastAttribute ( ) const
inline

Access the last attribute in this element.

Definition at line 1241 of file tinyxml.h.

◆ LastAttribute() [2/2]

TiXmlAttribute* TiXmlElement::LastAttribute ( )
inline

Definition at line 1244 of file tinyxml.h.

1244 { return attributeSet.Last(); }
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Last() const
Definition: tinyxml.h:1060

◆ LastChild() [1/6]

const TiXmlNode* TiXmlNode::LastChild ( ) const
inlineinherited

Definition at line 572 of file tinyxml.h.

References TiXmlNode::lastChild.

572  {
573  return lastChild;
574  }
TiXmlNode * lastChild
Definition: tinyxml.h:896

◆ LastChild() [2/6]

TiXmlNode* TiXmlNode::LastChild ( )
inlineinherited

The last child of this node. Will be null if there are no children.

Definition at line 575 of file tinyxml.h.

References TiXmlNode::lastChild.

Referenced by ticpp::Node::LastChild().

575 { return lastChild; }
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the caller graph for this function:

◆ LastChild() [3/6]

const TiXmlNode * TiXmlNode::LastChild ( const char *  value) const
inherited

Definition at line 321 of file tinyxml.cpp.

References TiXmlNode::lastChild, TiXmlNode::prev, and TiXmlNode::Value().

Referenced by TiXmlNode::LastChild().

321  {
322  const TiXmlNode* node;
323 
324  for (node = lastChild; node; node = node->prev) {
325  if (strcmp(node->Value(), _value) == 0) return node;
326  }
327 
328  return 0;
329 }
TiXmlNode * prev
Definition: tinyxml.h:900
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:517
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LastChild() [4/6]

TiXmlNode* TiXmlNode::LastChild ( const char *  _value)
inlineinherited

The last child of this node matching 'value'. Will be null if there are no children.

Definition at line 581 of file tinyxml.h.

References TiXmlNode::LastChild().

Referenced by ticpp::Node::LastChild().

581  {
582  return const_cast< TiXmlNode* >(
583  (const_cast< const TiXmlNode* >(this))->LastChild(_value));
584  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LastChild() [5/6]

const TiXmlNode* TiXmlNode::LastChild ( const std::string &  _value) const
inlineinherited

STL std::string form.

Definition at line 593 of file tinyxml.h.

◆ LastChild() [6/6]

TiXmlNode* TiXmlNode::LastChild ( const std::string &  _value)
inlineinherited

STL std::string form.

Definition at line 596 of file tinyxml.h.

◆ LinkEndChild()

TiXmlNode * TiXmlNode::LinkEndChild ( TiXmlNode addThis)
inherited

Add a new node related to this.

Adds a child past the LastChild.

NOTE: the node to be added is passed by pointer, and will be henceforth owned (and deleted) by tinyXml. This method is efficient and avoids an extra copy, but should be used with care as it uses a different memory model than the other insert functions.

See also
InsertEndChild

Definition at line 153 of file tinyxml.cpp.

References TiXmlNode::DOCUMENT, TiXmlNode::firstChild, TiXmlNode::lastChild, TiXmlNode::next, TiXmlNode::parent, TiXmlNode::prev, and TiXmlNode::Type().

Referenced by TiXmlNode::InsertEndChild(), and ticpp::Node::LinkEndChild().

153  {
154  assert(node->parent == 0 || node->parent == this);
155  assert(node->GetDocument() == 0 || node->GetDocument() == this->GetDocument());
156 
157  if (node->Type() == TiXmlNode::DOCUMENT) {
158  delete node;
159 
160  if (GetDocument())
163 
164  return 0;
165  }
166 
167  node->parent = this;
168 
169  node->prev = lastChild;
170  node->next = 0;
171 
172  if (lastChild)
173  lastChild->next = node;
174  else
175  firstChild = node; // it was an empty list.
176 
177  lastChild = node;
178  return node;
179 }
TiXmlNode * firstChild
Definition: tinyxml.h:895
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
TiXmlNode * next
Definition: tinyxml.h:901
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextSibling() [1/6]

const TiXmlNode* TiXmlNode::NextSibling ( const std::string &  _value) const
inlineinherited

STL std::string form.

Definition at line 695 of file tinyxml.h.

◆ NextSibling() [2/6]

TiXmlNode* TiXmlNode::NextSibling ( const std::string &  _value)
inlineinherited

STL std::string form.

Definition at line 698 of file tinyxml.h.

◆ NextSibling() [3/6]

const TiXmlNode* TiXmlNode::NextSibling ( ) const
inlineinherited

Navigate to a sibling node.

Definition at line 704 of file tinyxml.h.

References TiXmlNode::next.

Referenced by Accept(), TiXmlDocument::Accept(), TiXmlNode::FirstChildElement(), TiXmlNode::IterateChildren(), TiXmlNode::NextSiblingElement(), and TiXmlDocument::Print().

704 { return next; }
TiXmlNode * next
Definition: tinyxml.h:901
+ Here is the caller graph for this function:

◆ NextSibling() [4/6]

TiXmlNode* TiXmlNode::NextSibling ( )
inlineinherited

Definition at line 705 of file tinyxml.h.

References TiXmlNode::next.

Referenced by TiXmlHandle::Child(), CopyTo(), TiXmlDocument::CopyTo(), ticpp::Node::NextSibling(), and Print().

705 { return next; }
TiXmlNode * next
Definition: tinyxml.h:901
+ Here is the caller graph for this function:

◆ NextSibling() [5/6]

const TiXmlNode * TiXmlNode::NextSibling ( const char *  _value) const
inherited

Navigate to a sibling node with the given 'value'.

Definition at line 350 of file tinyxml.cpp.

References TiXmlNode::next, and TiXmlNode::Value().

Referenced by TiXmlNode::FirstChildElement(), TiXmlNode::IterateChildren(), TiXmlNode::NextSibling(), and TiXmlNode::NextSiblingElement().

350  {
351  const TiXmlNode* node;
352 
353  for (node = next; node; node = node->next) {
354  if (strcmp(node->Value(), _value) == 0) return node;
355  }
356 
357  return 0;
358 }
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:517
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
TiXmlNode * next
Definition: tinyxml.h:901
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextSibling() [6/6]

TiXmlNode* TiXmlNode::NextSibling ( const char *  _next)
inlineinherited

Definition at line 709 of file tinyxml.h.

References TiXmlNode::NextSibling().

Referenced by TiXmlHandle::Child(), and ticpp::Node::NextSibling().

709  {
710  return const_cast< TiXmlNode* >(
711  (const_cast< const TiXmlNode* >(this))->NextSibling(_next));
712  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextSiblingElement() [1/6]

const TiXmlElement * TiXmlNode::NextSiblingElement ( ) const
inherited

Convenience function to get through elements.

Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.

Definition at line 404 of file tinyxml.cpp.

References TiXmlNode::NextSibling(), and TiXmlNode::ToElement().

Referenced by TiXmlNode::NextSiblingElement().

404  {
405  const TiXmlNode* node;
406 
407  for (node = NextSibling(); node; node = node->NextSibling()) {
408  if (node->ToElement()) return node->ToElement();
409  }
410 
411  return 0;
412 }
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:788
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:704
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextSiblingElement() [2/6]

TiXmlElement* TiXmlNode::NextSiblingElement ( )
inlineinherited

Definition at line 719 of file tinyxml.h.

References TiXmlNode::NextSiblingElement().

Referenced by ticpp::Node::NextSiblingElement().

719  {
720  return const_cast< TiXmlElement* >(
721  (const_cast< const TiXmlNode* >(this))->NextSiblingElement());
722  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
The element is a container class.
Definition: tinyxml.h:1095
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextSiblingElement() [3/6]

const TiXmlElement * TiXmlNode::NextSiblingElement ( const char *  _value) const
inherited

Convenience function to get through elements.

Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.

Definition at line 414 of file tinyxml.cpp.

References TiXmlNode::NextSibling(), and TiXmlNode::ToElement().

Referenced by TiXmlNode::NextSiblingElement().

414  {
415  const TiXmlNode* node;
416 
417  for (node = NextSibling(_value); node; node = node->NextSibling(_value)) {
418  if (node->ToElement()) return node->ToElement();
419  }
420 
421  return 0;
422 }
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:788
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:704
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextSiblingElement() [4/6]

TiXmlElement* TiXmlNode::NextSiblingElement ( const char *  _next)
inlineinherited

Definition at line 729 of file tinyxml.h.

References TiXmlNode::NextSiblingElement().

Referenced by ticpp::Node::NextSiblingElement().

729  {
730  return const_cast< TiXmlElement* >(
731  (const_cast< const TiXmlNode* >(this))->NextSiblingElement(_next));
732  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
The element is a container class.
Definition: tinyxml.h:1095
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextSiblingElement() [5/6]

const TiXmlElement* TiXmlNode::NextSiblingElement ( const std::string &  _value) const
inlineinherited

STL std::string form.

Definition at line 735 of file tinyxml.h.

◆ NextSiblingElement() [6/6]

TiXmlElement* TiXmlNode::NextSiblingElement ( const std::string &  _value)
inlineinherited

STL std::string form.

Definition at line 738 of file tinyxml.h.

◆ NoChildren()

bool TiXmlNode::NoChildren ( ) const
inlineinherited

Returns true if this node has no children.

Definition at line 782 of file tinyxml.h.

References TiXmlNode::firstChild.

Referenced by ticpp::Node::NoChildren().

782 { return !firstChild; }
TiXmlNode * firstChild
Definition: tinyxml.h:895
+ Here is the caller graph for this function:

◆ operator=()

void TiXmlElement::operator= ( const TiXmlElement base)

Definition at line 454 of file tinyxml.cpp.

References ClearThis(), and CopyTo().

454  {
455  ClearThis();
456  base.CopyTo(this);
457 }
void ClearThis()
Definition: tinyxml.cpp:461
void CopyTo(TiXmlElement *target) const
Definition: tinyxml.cpp:716
+ Here is the call graph for this function:

◆ Parent() [1/2]

TiXmlNode* TiXmlNode::Parent ( )
inlineinherited

One step up the DOM.

Definition at line 549 of file tinyxml.h.

References TiXmlNode::parent.

Referenced by ticpp::Node::Parent().

549 { return parent; }
TiXmlNode * parent
Definition: tinyxml.h:892
+ Here is the caller graph for this function:

◆ Parent() [2/2]

const TiXmlNode* TiXmlNode::Parent ( ) const
inlineinherited

Definition at line 550 of file tinyxml.h.

References TiXmlNode::parent.

550 { return parent; }
TiXmlNode * parent
Definition: tinyxml.h:892

◆ Parse()

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

Implements TiXmlBase.

Definition at line 1009 of file tinyxmlparser.cpp.

References TiXmlParsingData::Cursor(), TiXmlBase::location, TiXmlAttribute::Parse(), ReadValue(), TiXmlDocument::SetError(), TiXmlAttribute::SetValue(), TiXmlBase::SkipWhiteSpace(), TiXmlParsingData::Stamp(), TiXmlBase::TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, TiXmlBase::TIXML_ERROR_OUT_OF_MEMORY, TiXmlBase::TIXML_ERROR_PARSING_ELEMENT, TiXmlBase::TIXML_ERROR_PARSING_EMPTY, TiXmlBase::TIXML_ERROR_READING_ATTRIBUTES, TiXmlBase::TIXML_ERROR_READING_END_TAG, TiXmlAttribute::TiXmlAttribute(), and TiXmlAttribute::Value().

1011  {
1012  p = SkipWhiteSpace(p, encoding);
1013  TiXmlDocument* document = GetDocument();
1014 
1015  if (!p || !*p) {
1016  if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding);
1017 
1018  return 0;
1019  }
1020 
1021  if (data) {
1022  data->Stamp(p, encoding);
1023  location = data->Cursor();
1024  }
1025 
1026  if (*p != '<') {
1027  if (document)
1028  document->SetError(TIXML_ERROR_PARSING_ELEMENT, p, data, encoding);
1029 
1030  return 0;
1031  }
1032 
1033  p = SkipWhiteSpace(p + 1, encoding);
1034 
1035  // Read the name.
1036  const char* pErr = p;
1037 
1038  p = ReadName(p, &value, encoding);
1039 
1040  if (!p || !*p) {
1041  if (document)
1042  document->SetError(
1043  TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding);
1044 
1045  return 0;
1046  }
1047 
1048  TIXML_STRING endTag("</");
1049  endTag += value;
1050  endTag += ">";
1051 
1052  // Check for and read attributes. Also look for an empty
1053  // tag or an end tag.
1054  while (p && *p) {
1055  pErr = p;
1056  p = SkipWhiteSpace(p, encoding);
1057 
1058  if (!p || !*p) {
1059  if (document)
1060  document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding);
1061 
1062  return 0;
1063  }
1064 
1065  if (*p == '/') {
1066  ++p;
1067 
1068  // Empty tag.
1069  if (*p != '>') {
1070  if (document)
1071  document->SetError(TIXML_ERROR_PARSING_EMPTY, p, data, encoding);
1072 
1073  return 0;
1074  }
1075 
1076  return (p + 1);
1077  } else if (*p == '>') {
1078  // Done with attributes (if there were any.)
1079  // Read the value -- which can include other
1080  // elements -- read the end tag, and return.
1081  ++p;
1082  p = ReadValue(p,
1083  data,
1084  encoding); // Note this is an Element method, and will
1085  // set the error if one happens.
1086 
1087  if (!p || !*p) {
1088  // We were looking for the end tag, but found nothing.
1089  // Fix for [ 1663758 ] Failure to report error on bad XML
1090  if (document)
1091  document->SetError(TIXML_ERROR_READING_END_TAG, p, data, encoding);
1092 
1093  return 0;
1094  }
1095 
1096  // We should find the end tag now
1097  if (StringEqual(p, endTag.c_str(), false, encoding)) {
1098  p += endTag.length();
1099  return p;
1100  } else {
1101  if (document)
1102  document->SetError(TIXML_ERROR_READING_END_TAG, p, data, encoding);
1103 
1104  return 0;
1105  }
1106  } else {
1107  // Try to read an attribute:
1108  TiXmlAttribute* attrib = new TiXmlAttribute();
1109 
1110  if (!attrib) {
1111  if (document)
1112  document->SetError(TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding);
1113 
1114  return 0;
1115  }
1116 
1117  attrib->SetDocument(document);
1118  pErr = p;
1119  p = attrib->Parse(p, data, encoding);
1120 
1121  if (!p || !*p) {
1122  if (document)
1123  document->SetError(TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding);
1124 
1125  delete attrib;
1126  return 0;
1127  }
1128 
1129 // Handle the strange case of double attributes:
1130 #ifdef TIXML_USE_STL
1131  TiXmlAttribute* node = attributeSet.Find(attrib->NameTStr());
1132 #else
1133  TiXmlAttribute* node = attributeSet.Find(attrib->Name());
1134 #endif
1135 
1136  if (node) {
1137  node->SetValue(attrib->Value());
1138  delete attrib;
1139  return 0;
1140  }
1141 
1142  attributeSet.Add(attrib);
1143  }
1144  }
1145 
1146  return p;
1147 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:944
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
static const char * ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
const TIXML_STRING & NameTStr() const
Definition: tinyxml.h:961
const TiXmlCursor & Cursor()
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:947
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
TiXmlCursor location
Definition: tinyxml.h:410
Always the top level node.
Definition: tinyxml.h:1655
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
const char * ReadValue(const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding)
void Add(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1427
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
void Stamp(const char *now, TiXmlEncoding encoding)
TIXML_STRING value
Definition: tinyxml.h:898
void SetDocument(TiXmlDocument *doc)
Definition: tinyxml.h:1021
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:979
#define TIXML_STRING
Definition: tinyxml.h:60
+ Here is the call graph for this function:

◆ PreviousSibling() [1/6]

const TiXmlNode* TiXmlNode::PreviousSibling ( ) const
inlineinherited

Navigate to a sibling node.

Definition at line 678 of file tinyxml.h.

References TiXmlNode::prev.

678 { return prev; }
TiXmlNode * prev
Definition: tinyxml.h:900

◆ PreviousSibling() [2/6]

TiXmlNode* TiXmlNode::PreviousSibling ( )
inlineinherited

Definition at line 679 of file tinyxml.h.

References TiXmlNode::prev.

Referenced by ticpp::Node::PreviousSibling().

679 { return prev; }
TiXmlNode * prev
Definition: tinyxml.h:900
+ Here is the caller graph for this function:

◆ PreviousSibling() [3/6]

const TiXmlNode * TiXmlNode::PreviousSibling ( const char *  _value) const
inherited

Navigate to a sibling node.

Definition at line 360 of file tinyxml.cpp.

References TiXmlNode::prev, and TiXmlNode::Value().

Referenced by TiXmlNode::PreviousSibling().

360  {
361  const TiXmlNode* node;
362 
363  for (node = prev; node; node = node->prev) {
364  if (strcmp(node->Value(), _value) == 0) return node;
365  }
366 
367  return 0;
368 }
TiXmlNode * prev
Definition: tinyxml.h:900
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:517
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PreviousSibling() [4/6]

TiXmlNode* TiXmlNode::PreviousSibling ( const char *  _prev)
inlineinherited

Definition at line 683 of file tinyxml.h.

References TiXmlNode::PreviousSibling().

Referenced by ticpp::Node::PreviousSibling().

683  {
684  return const_cast< TiXmlNode* >(
685  (const_cast< const TiXmlNode* >(this))->PreviousSibling(_prev));
686  }
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PreviousSibling() [5/6]

const TiXmlNode* TiXmlNode::PreviousSibling ( const std::string &  _value) const
inlineinherited

STL std::string form.

Definition at line 689 of file tinyxml.h.

◆ PreviousSibling() [6/6]

TiXmlNode* TiXmlNode::PreviousSibling ( const std::string &  _value)
inlineinherited

STL std::string form.

Definition at line 692 of file tinyxml.h.

◆ Print()

void TiXmlElement::Print ( FILE *  cfile,
int  depth 
) const
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.)

Implements TiXmlBase.

Definition at line 666 of file tinyxml.cpp.

References TiXmlNode::firstChild, TiXmlNode::lastChild, TiXmlAttribute::Next(), TiXmlNode::NextSibling(), TiXmlAttribute::Print(), and TiXmlNode::ToText().

666  {
667  int i;
668  assert(cfile);
669 
670  for (i = 0; i < depth; i++) {
671  fprintf(cfile, " ");
672  }
673 
674  fprintf(cfile, "<%s", value.c_str());
675 
676  const TiXmlAttribute* attrib;
677 
678  for (attrib = attributeSet.First(); attrib; attrib = attrib->Next()) {
679  fprintf(cfile, " ");
680  attrib->Print(cfile, depth);
681  }
682 
683  // There are 3 different formatting approaches:
684  // 1) An element without children is printed as a <foo /> node
685  // 2) An element with only a text child is printed as <foo> text </foo>
686  // 3) An element with children is printed on multiple lines.
687  TiXmlNode* node;
688 
689  if (!firstChild) {
690  fprintf(cfile, " />");
691  } else if (firstChild == lastChild && firstChild->ToText()) {
692  fprintf(cfile, ">");
693  firstChild->Print(cfile, depth + 1);
694  fprintf(cfile, "</%s>", value.c_str());
695  } else {
696  fprintf(cfile, ">");
697 
698  for (node = firstChild; node; node = node->NextSibling()) {
699  if (!node->ToText()) {
700  fprintf(cfile, "\n");
701  }
702 
703  node->Print(cfile, depth + 1);
704  }
705 
706  fprintf(cfile, "\n");
707 
708  for (i = 0; i < depth; ++i) {
709  fprintf(cfile, " ");
710  }
711 
712  fprintf(cfile, "</%s>", value.c_str());
713  }
714 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
TiXmlNode * firstChild
Definition: tinyxml.h:895
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:800
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cpp:1043
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
const TiXmlAttribute * First() const
Definition: tinyxml.h:1054
TIXML_STRING value
Definition: tinyxml.h:898
TiXmlNode * lastChild
Definition: tinyxml.h:896
virtual void Print(FILE *cfile, int depth) const =0
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:695
+ Here is the call graph for this function:

◆ QueryDoubleAttribute() [1/2]

int TiXmlElement::QueryDoubleAttribute ( const char *  name,
double _value 
) const

QueryDoubleAttribute examines the attribute - see QueryIntAttribute().

Definition at line 568 of file tinyxml.cpp.

References TiXmlAttribute::QueryDoubleValue(), and TIXML_NO_ATTRIBUTE.

Referenced by QueryFloatAttribute().

568  {
569  const TiXmlAttribute* node = attributeSet.Find(name);
570 
571  if (!node) return TIXML_NO_ATTRIBUTE;
572 
573  return node->QueryDoubleValue(dval);
574 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cpp:1118
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QueryDoubleAttribute() [2/2]

int TiXmlElement::QueryDoubleAttribute ( const std::string &  name,
double _value 
) const

Definition at line 577 of file tinyxml.cpp.

References TiXmlAttribute::QueryDoubleValue(), and TIXML_NO_ATTRIBUTE.

578  {
579  const TiXmlAttribute* node = attributeSet.Find(name);
580 
581  if (!node) return TIXML_NO_ATTRIBUTE;
582 
583  return node->QueryDoubleValue(dval);
584 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cpp:1118
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
+ Here is the call graph for this function:

◆ QueryFloatAttribute()

int TiXmlElement::QueryFloatAttribute ( const char *  name,
float *  _value 
) const
inline

QueryFloatAttribute examines the attribute - see QueryIntAttribute().

Definition at line 1143 of file tinyxml.h.

References QueryDoubleAttribute(), and TIXML_SUCCESS.

1143  {
1144  double d;
1145  int result = QueryDoubleAttribute(name, &d);
1146 
1147  if (result == TIXML_SUCCESS) {
1148  *_value = (float)d;
1149  }
1150 
1151  return result;
1152  }
int QueryDoubleAttribute(const char *name, double *_value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cpp:568
+ Here is the call graph for this function:

◆ QueryIntAttribute() [1/2]

int TiXmlElement::QueryIntAttribute ( const char *  name,
int *  _value 
) const

QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer error checking.

If the attribute is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE. If the attribute does not exist, then TIXML_NO_ATTRIBUTE is returned.

Definition at line 550 of file tinyxml.cpp.

References TiXmlAttribute::QueryIntValue(), and TIXML_NO_ATTRIBUTE.

550  {
551  const TiXmlAttribute* node = attributeSet.Find(name);
552 
553  if (!node) return TIXML_NO_ATTRIBUTE;
554 
555  return node->QueryIntValue(ival);
556 }
int QueryIntValue(int *_value) const
QueryIntValue examines the value string.
Definition: tinyxml.cpp:1112
An attribute is a name-value pair.
Definition: tinyxml.h:915
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
+ Here is the call graph for this function:

◆ QueryIntAttribute() [2/2]

int TiXmlElement::QueryIntAttribute ( const std::string &  name,
int *  _value 
) const

Definition at line 559 of file tinyxml.cpp.

References TiXmlAttribute::QueryIntValue(), and TIXML_NO_ATTRIBUTE.

559  {
560  const TiXmlAttribute* node = attributeSet.Find(name);
561 
562  if (!node) return TIXML_NO_ATTRIBUTE;
563 
564  return node->QueryIntValue(ival);
565 }
int QueryIntValue(int *_value) const
QueryIntValue examines the value string.
Definition: tinyxml.cpp:1112
An attribute is a name-value pair.
Definition: tinyxml.h:915
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
+ Here is the call graph for this function:

◆ QueryValueAttribute()

template<typename T >
int TiXmlElement::QueryValueAttribute ( const std::string &  name,
T *  outValue 
) const
inline

Template form of the attribute query which will try to read the attribute into the specified type.

Very easy, very powerful, but be careful to make sure to call this with the correct type.

NOTE: This method doesn't work correctly for 'string' types.

Returns
TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE

Definition at line 1164 of file tinyxml.h.

References TIXML_NO_ATTRIBUTE, TIXML_SUCCESS, TIXML_WRONG_TYPE, and TiXmlAttribute::ValueStr().

1164  {
1165  const TiXmlAttribute* node = attributeSet.Find(name);
1166 
1167  if (!node) return TIXML_NO_ATTRIBUTE;
1168 
1169  std::stringstream sstream(node->ValueStr());
1170  sstream >> *outValue;
1171 
1172  if (!sstream.fail()) return TIXML_SUCCESS;
1173 
1174  return TIXML_WRONG_TYPE;
1175  }
An attribute is a name-value pair.
Definition: tinyxml.h:915
const std::string & ValueStr() const
Return the value of this attribute.
Definition: tinyxml.h:951
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
+ Here is the call graph for this function:

◆ ReadName()

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

Definition at line 409 of file tinyxmlparser.cpp.

References TiXmlBase::IsAlpha(), and TiXmlBase::IsAlphaNum().

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

◆ ReadText()

const char * TiXmlBase::ReadText ( const char *  in,
TIXML_STRING text,
bool  ignoreWhiteSpace,
const char *  endTag,
bool  ignoreCase,
TiXmlEncoding  encoding 
)
staticprotectedinherited

Definition at line 566 of file tinyxmlparser.cpp.

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

571  {
572  *text = "";
573 
574  if (!trimWhiteSpace // certain tags always keep whitespace
575  ||
576  !condenseWhiteSpace) { // if true, whitespace is always kept
577  // Keep all the white space.
578  while (p && *p && !StringEqual(p, endTag, caseInsensitive, encoding)) {
579  int len;
580  char cArr[4] = {0, 0, 0, 0};
581  p = GetChar(p, cArr, &len, encoding);
582  text->append(cArr, len);
583  }
584  } else {
585  bool whitespace = false;
586 
587  // Remove leading white space:
588  p = SkipWhiteSpace(p, encoding);
589 
590  while (p && *p && !StringEqual(p, endTag, caseInsensitive, encoding)) {
591  if (*p == '\r' || *p == '\n') {
592  whitespace = true;
593  ++p;
594  } else if (IsWhiteSpace(*p)) {
595  whitespace = true;
596  ++p;
597  } else {
598  // If we've found whitespace, add it before the
599  // new character. Any whitespace just becomes a space.
600  if (whitespace) {
601  (*text) += ' ';
602  whitespace = false;
603  }
604 
605  int len;
606  char cArr[4] = {0, 0, 0, 0};
607  p = GetChar(p, cArr, &len, encoding);
608 
609  if (len == 1)
610  (*text) += cArr[0]; // more efficient
611  else
612  text->append(cArr, len);
613  }
614  }
615  }
616 
617  if (p) p += strlen(endTag);
618 
619  return p;
620 }
static bool condenseWhiteSpace
Definition: tinyxml.h:445
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:328
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:368
+ Here is the call graph for this function:

◆ ReadValue()

const char * TiXmlElement::ReadValue ( const char *  in,
TiXmlParsingData prevData,
TiXmlEncoding  encoding 
)
protected

Definition at line 1149 of file tinyxmlparser.cpp.

References TiXmlText::Blank(), TiXmlBase::IsWhiteSpaceCondensed(), TiXmlText::Parse(), TiXmlDocument::SetError(), TiXmlBase::SkipWhiteSpace(), TiXmlBase::StringEqual(), TiXmlBase::TIXML_ERROR_OUT_OF_MEMORY, TiXmlBase::TIXML_ERROR_READING_ELEMENT_VALUE, TiXmlText::TiXmlElement, and TiXmlText::TiXmlText().

Referenced by Parse().

1151  {
1152  TiXmlDocument* document = GetDocument();
1153 
1154  // Read in text and elements in any order.
1155  const char* pWithWhiteSpace = p;
1156  p = SkipWhiteSpace(p, encoding);
1157 
1158  while (p && *p) {
1159  if (*p != '<') {
1160  // Take what we have, make a text element.
1161  TiXmlText* textNode = new TiXmlText("");
1162 
1163  if (!textNode) {
1164  if (document)
1165  document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding);
1166 
1167  return 0;
1168  }
1169 
1171  p = textNode->Parse(p, data, encoding);
1172  } else {
1173  // Special case: we want to keep the white space
1174  // so that leading spaces aren't removed.
1175  p = textNode->Parse(pWithWhiteSpace, data, encoding);
1176  }
1177 
1178  if (!textNode->Blank())
1179  LinkEndChild(textNode);
1180  else
1181  delete textNode;
1182  } else {
1183  // We hit a '<'
1184  // Have we hit a new element or an end tag? This could also be
1185  // a TiXmlText in the "CDATA" style.
1186  if (StringEqual(p, "</", false, encoding)) {
1187  return p;
1188  } else {
1189  TiXmlNode* node = Identify(p, encoding);
1190 
1191  if (node) {
1192  p = node->Parse(p, data, encoding);
1193  LinkEndChild(node);
1194  } else {
1195  return 0;
1196  }
1197  }
1198  }
1199 
1200  pWithWhiteSpace = p;
1201  p = SkipWhiteSpace(p, encoding);
1202  }
1203 
1204  if (!p) {
1205  if (document)
1206  document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding);
1207  }
1208 
1209  return p;
1210 }
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
Definition: tinyxml.cpp:153
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:247
Always the top level node.
Definition: tinyxml.h:1655
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)=0
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
XML text.
Definition: tinyxml.h:1386
bool Blank() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveAttribute() [1/2]

void TiXmlElement::RemoveAttribute ( const char *  name)

Deletes an attribute with the given name.

Definition at line 370 of file tinyxml.cpp.

370  {
371 #ifdef TIXML_USE_STL
372  TIXML_STRING str(name);
373  TiXmlAttribute* node = attributeSet.Find(str);
374 #else
375  TiXmlAttribute* node = attributeSet.Find(name);
376 #endif
377 
378  if (node) {
379  attributeSet.Remove(node);
380  delete node;
381  }
382 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
void Remove(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1442
#define TIXML_STRING
Definition: tinyxml.h:60

◆ RemoveAttribute() [2/2]

void TiXmlElement::RemoveAttribute ( const std::string &  name)
inline

STL std::string form.

Definition at line 1232 of file tinyxml.h.

◆ RemoveChild()

bool TiXmlNode::RemoveChild ( TiXmlNode removeThis)
inherited

Delete a child of this node.

Definition at line 291 of file tinyxml.cpp.

References TiXmlNode::firstChild, TiXmlNode::lastChild, TiXmlNode::next, TiXmlNode::parent, and TiXmlNode::prev.

Referenced by ticpp::Node::RemoveChild().

291  {
292  if (removeThis->parent != this) {
293  assert(0);
294  return false;
295  }
296 
297  if (removeThis->next)
298  removeThis->next->prev = removeThis->prev;
299  else
300  lastChild = removeThis->prev;
301 
302  if (removeThis->prev)
303  removeThis->prev->next = removeThis->next;
304  else
305  firstChild = removeThis->next;
306 
307  delete removeThis;
308  return true;
309 }
TiXmlNode * prev
Definition: tinyxml.h:900
TiXmlNode * firstChild
Definition: tinyxml.h:895
TiXmlNode * parent
Definition: tinyxml.h:892
TiXmlNode * next
Definition: tinyxml.h:901
TiXmlNode * lastChild
Definition: tinyxml.h:896
+ Here is the caller graph for this function:

◆ ReplaceChild()

TiXmlNode * TiXmlNode::ReplaceChild ( TiXmlNode replaceThis,
const TiXmlNode withThis 
)
inherited

Replace a child of this node.

Returns a pointer to the new object or nullptr if an error occured.

Definition at line 265 of file tinyxml.cpp.

References TiXmlNode::Clone(), TiXmlNode::firstChild, TiXmlNode::lastChild, TiXmlNode::next, TiXmlNode::parent, and TiXmlNode::prev.

Referenced by ticpp::Node::ReplaceChild().

266  {
267  if (replaceThis->parent != this) return 0;
268 
269  TiXmlNode* node = withThis.Clone();
270 
271  if (!node) return 0;
272 
273  node->next = replaceThis->next;
274  node->prev = replaceThis->prev;
275 
276  if (replaceThis->next)
277  replaceThis->next->prev = node;
278  else
279  lastChild = node;
280 
281  if (replaceThis->prev)
282  replaceThis->prev->next = node;
283  else
284  firstChild = node;
285 
286  delete replaceThis;
287  node->parent = this;
288  return node;
289 }
TiXmlNode * prev
Definition: tinyxml.h:900
TiXmlNode * firstChild
Definition: tinyxml.h:895
TiXmlNode * parent
Definition: tinyxml.h:892
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
TiXmlNode * next
Definition: tinyxml.h:901
TiXmlNode * lastChild
Definition: tinyxml.h:896
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Row()

int TiXmlBase::Row ( ) const
inlineinherited

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 275 of file tinyxml.h.

References TiXmlBase::location, and TiXmlCursor::row.

Referenced by ticpp::Base::Row().

275 { return location.row + 1; }
TiXmlCursor location
Definition: tinyxml.h:410
+ Here is the caller graph for this function:

◆ SetAttribute() [1/4]

void TiXmlElement::SetAttribute ( const char *  name,
const char *  _value 
)

Sets an attribute of name to a given value.

The attribute will be created if it does not exist, or changed if it does.

Definition at line 615 of file tinyxml.cpp.

References TiXmlDocument::SetError(), TIXML_ENCODING_UNKNOWN, TiXmlBase::TIXML_ERROR_OUT_OF_MEMORY, and TiXmlAttribute::TiXmlAttribute().

Referenced by CopyTo(), SetAttribute(), and SetDoubleAttribute().

615  {
616 #ifdef TIXML_USE_STL
617  TIXML_STRING _name(cname);
618  TIXML_STRING _value(cvalue);
619 #else
620  const char* _name = cname;
621  const char* _value = cvalue;
622 #endif
623 
624  TiXmlAttribute* node = attributeSet.Find(_name);
625 
626  if (node) {
627  node->SetValue(_value);
628  return;
629  }
630 
631  TiXmlAttribute* attrib = new TiXmlAttribute(cname, cvalue);
632 
633  if (attrib) {
634  attributeSet.Add(attrib);
635  } else {
636  TiXmlDocument* document = GetDocument();
637 
638  if (document)
640  }
641 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
Always the top level node.
Definition: tinyxml.h:1655
void Add(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1427
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:979
#define TIXML_STRING
Definition: tinyxml.h:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAttribute() [2/4]

void TiXmlElement::SetAttribute ( const std::string &  name,
const std::string &  _value 
)

STL std::string form.

STL std::string form.

Definition at line 644 of file tinyxml.cpp.

References TiXmlDocument::SetError(), TIXML_ENCODING_UNKNOWN, and TiXmlBase::TIXML_ERROR_OUT_OF_MEMORY.

645  {
646  TiXmlAttribute* node = attributeSet.Find(name);
647 
648  if (node) {
649  node->SetValue(_value);
650  return;
651  }
652 
653  TiXmlAttribute* attrib = new TiXmlAttribute(name, _value);
654 
655  if (attrib) {
656  attributeSet.Add(attrib);
657  } else {
658  TiXmlDocument* document = GetDocument();
659 
660  if (document)
662  }
663 }
An attribute is a name-value pair.
Definition: tinyxml.h:915
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1325
Always the top level node.
Definition: tinyxml.h:1655
void Add(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1427
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1482
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:979
+ Here is the call graph for this function:

◆ SetAttribute() [3/4]

void TiXmlElement::SetAttribute ( const std::string &  name,
int  _value 
)

Definition at line 598 of file tinyxml.cpp.

598  {
599  std::ostringstream oss;
600  oss << val;
601  SetAttribute(name, oss.str());
602 }
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
Definition: tinyxml.cpp:615

◆ SetAttribute() [4/4]

void TiXmlElement::SetAttribute ( const char *  name,
int  value 
)

Sets an attribute of name to a given value.

The attribute will be created if it does not exist, or changed if it does.

Definition at line 587 of file tinyxml.cpp.

References SetAttribute().

587  {
588  char buf[64];
589 #if defined(TIXML_SNPRINTF)
590  TIXML_SNPRINTF(buf, sizeof(buf), "%d", val);
591 #else
592  sprintf(buf, "%d", val);
593 #endif
594  SetAttribute(name, buf);
595 }
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
Definition: tinyxml.cpp:615
+ Here is the call graph for this function:

◆ SetCondenseWhiteSpace()

static void TiXmlBase::SetCondenseWhiteSpace ( bool  condense)
inlinestaticinherited

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 242 of file tinyxml.h.

References TiXmlBase::condenseWhiteSpace.

242  {
243  condenseWhiteSpace = condense;
244  }
static bool condenseWhiteSpace
Definition: tinyxml.h:445

◆ SetDoubleAttribute()

void TiXmlElement::SetDoubleAttribute ( const char *  name,
double  value 
)

Sets an attribute of name to a given value.

The attribute will be created if it does not exist, or changed if it does.

Definition at line 605 of file tinyxml.cpp.

References SetAttribute().

605  {
606  char buf[256];
607 #if defined(TIXML_SNPRINTF)
608  TIXML_SNPRINTF(buf, sizeof(buf), "%f", val);
609 #else
610  sprintf(buf, "%f", val);
611 #endif
612  SetAttribute(name, buf);
613 }
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
Definition: tinyxml.cpp:615
+ Here is the call graph for this function:

◆ SetUserData()

void TiXmlBase::SetUserData ( void *  user)
inlineinherited

Set a pointer to arbitrary user data.

Definition at line 278 of file tinyxml.h.

References TiXmlBase::userData.

◆ SetValue() [1/2]

void TiXmlNode::SetValue ( const char *  _value)
inlineinherited

Changes the value of the node.

Defined as:

Document: filename of the xml file
Element:  name of the element
Comment:  the comment text
Unknown:  the tag contents
Text:   the text string

Definition at line 538 of file tinyxml.h.

538 { value = _value; }
TIXML_STRING value
Definition: tinyxml.h:898

◆ SetValue() [2/2]

void TiXmlNode::SetValue ( const std::string &  _value)
inlineinherited

STL std::string form.

Definition at line 542 of file tinyxml.h.

References TiXmlNode::value.

542 { value = _value; }
TIXML_STRING value
Definition: tinyxml.h:898

◆ SkipWhiteSpace()

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

Definition at line 333 of file tinyxmlparser.cpp.

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

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

333  {
334  if (!p || !*p) {
335  return 0;
336  }
337 
338  if (encoding == TIXML_ENCODING_UTF8) {
339  while (*p) {
340  const unsigned char* pU = (const unsigned char*)p;
341 
342  // Skip the stupid Microsoft UTF-8 Byte order marks
343  if (*(pU + 0) == TIXML_UTF_LEAD_0 && *(pU + 1) == TIXML_UTF_LEAD_1 &&
344  *(pU + 2) == TIXML_UTF_LEAD_2) {
345  p += 3;
346  continue;
347  } else if (*(pU + 0) == TIXML_UTF_LEAD_0 && *(pU + 1) == 0xbfU &&
348  *(pU + 2) == 0xbeU) {
349  p += 3;
350  continue;
351  } else if (*(pU + 0) == TIXML_UTF_LEAD_0 && *(pU + 1) == 0xbfU &&
352  *(pU + 2) == 0xbfU) {
353  p += 3;
354  continue;
355  }
356 
357  if (IsWhiteSpace(*p) || *p == '\n' ||
358  *p == '\r') // Still using old rules for white space.
359  ++p;
360  else
361  break;
362  }
363  } else {
364  while ((*p && IsWhiteSpace(*p)) || *p == '\n' || *p == '\r')
365  ++p;
366  }
367 
368  return p;
369 }
const unsigned char TIXML_UTF_LEAD_2
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:328
const unsigned char TIXML_UTF_LEAD_1
const unsigned char TIXML_UTF_LEAD_0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StreamIn()

void TiXmlElement::StreamIn ( std::istream *  in,
TIXML_STRING tag 
)
protectedvirtual

Implements TiXmlNode.

Definition at line 870 of file tinyxmlparser.cpp.

References TiXmlBase::IsWhiteSpace(), TiXmlDocument::SetError(), TIXML_ENCODING_UNKNOWN, TiXmlBase::TIXML_ERROR_EMBEDDED_nullptr, TiXmlText::TiXmlElement, and TiXmlText::TiXmlText().

870  {
871  // We're called with some amount of pre-parsing. That is, some of "this"
872  // element is in "tag". Go ahead and stream to the closing ">"
873  while (in->good()) {
874  int c = in->get();
875 
876  if (c <= 0) {
877  TiXmlDocument* document = GetDocument();
878 
879  if (document)
880  document->SetError(
882 
883  return;
884  }
885 
886  (*tag) += (char)c;
887 
888  if (c == '>') break;
889  }
890 
891  if (tag->length() < 3) return;
892 
893  // Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
894  // If not, identify and stream.
895 
896  if (tag->at(tag->length() - 1) == '>' && tag->at(tag->length() - 2) == '/') {
897  // All good!
898  return;
899  } else if (tag->at(tag->length() - 1) == '>') {
900  // There is more. Could be:
901  // text
902  // cdata text (which looks like another node)
903  // closing tag
904  // another node.
905  for (;;) {
906  StreamWhiteSpace(in, tag);
907 
908  // Do we have text?
909  if (in->good() && in->peek() != '<') {
910  // Yep, text.
911  TiXmlText text("");
912  text.StreamIn(in, tag);
913 
914  // What follows text is a closing tag or another node.
915  // Go around again and figure it out.
916  continue;
917  }
918 
919  // We now have either a closing tag...or another node.
920  // We should be at a "<", regardless.
921  if (!in->good()) return;
922 
923  assert(in->peek() == '<');
924  int tagIndex = (int)tag->length();
925 
926  bool closingTag = false;
927  bool firstCharFound = false;
928 
929  for (;;) {
930  if (!in->good()) return;
931 
932  int c = in->peek();
933 
934  if (c <= 0) {
935  TiXmlDocument* document = GetDocument();
936 
937  if (document)
938  document->SetError(
940 
941  return;
942  }
943 
944  if (c == '>') break;
945 
946  *tag += (char)c;
947  in->get();
948 
949  // Early out if we find the CDATA id.
950  if (c == '[' && tag->size() >= 9) {
951  size_t len = tag->size();
952  const char* start = tag->c_str() + len - 9;
953 
954  if (strcmp(start, "<![CDATA[") == 0) {
955  assert(!closingTag);
956  break;
957  }
958  }
959 
960  if (!firstCharFound && c != '<' && !IsWhiteSpace(c)) {
961  firstCharFound = true;
962 
963  if (c == '/') closingTag = true;
964  }
965  }
966 
967  // If it was a closing tag, then read in the closing '>' to clean up the
968  // input
969  // stream.
970  // If it was not, the streaming will be done by the tag.
971  if (closingTag) {
972  if (!in->good()) return;
973 
974  int c = in->get();
975 
976  if (c <= 0) {
977  TiXmlDocument* document = GetDocument();
978 
979  if (document)
980  document->SetError(
982 
983  return;
984  }
985 
986  assert(c == '>');
987  *tag += (char)c;
988 
989  // We are done, once we've found our closing tag.
990  return;
991  } else {
992  // If not a closing tag, id it, and stream.
993  const char* tagloc = tag->c_str() + tagIndex;
994  TiXmlNode* node = Identify(tagloc, TIXML_DEFAULT_ENCODING);
995 
996  if (!node) return;
997 
998  node->StreamIn(in, tag);
999  delete node;
1000  node = 0;
1001 
1002  // No return: go around from the beginning: text, closing tag, or node.
1003  }
1004  }
1005  }
1006 }
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)=0
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:328
const TiXmlEncoding TIXML_DEFAULT_ENCODING
Definition: tinyxml.h:185
Always the top level node.
Definition: tinyxml.h:1655
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cpp:424
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:454
XML text.
Definition: tinyxml.h:1386
static bool StreamWhiteSpace(std::istream *in, TIXML_STRING *tag)
+ Here is the call graph for this function:

◆ StreamTo()

bool TiXmlBase::StreamTo ( std::istream *  in,
int  character,
TIXML_STRING tag 
)
staticprotectedinherited

Definition at line 386 of file tinyxmlparser.cpp.

386  {
387  // assert( character > 0 && character < 128 ); // else it won't work in utf-8
388  while (in->good()) {
389  int c = in->peek();
390 
391  if (c == character) return true;
392 
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 
400  return false;
401 }

◆ StreamWhiteSpace()

bool TiXmlBase::StreamWhiteSpace ( std::istream *  in,
TIXML_STRING tag 
)
staticprotectedinherited

Definition at line 372 of file tinyxmlparser.cpp.

References TiXmlBase::IsWhiteSpace().

372  {
373  for (;;) {
374  if (!in->good()) return false;
375 
376  int c = in->peek();
377 
378  // At this scope, we can't get to a document. So fail silently.
379  if (!IsWhiteSpace(c) || c <= 0) return true;
380 
381  *tag += (char)in->get();
382  }
383 }
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:328
+ Here is the call graph for this function:

◆ StringEqual()

bool TiXmlBase::StringEqual ( const char *  p,
const char *  endTag,
bool  ignoreCase,
TiXmlEncoding  encoding 
)
staticprotectedinherited

Definition at line 532 of file tinyxmlparser.cpp.

References TiXmlBase::ToLower().

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

535  {
536  assert(p);
537  assert(tag);
538 
539  if (!p || !*p) {
540  assert(0);
541  return false;
542  }
543 
544  const char* q = p;
545 
546  if (ignoreCase) {
547  while (*q && *tag && ToLower(*q, encoding) == ToLower(*tag, encoding)) {
548  ++q;
549  ++tag;
550  }
551 
552  if (*tag == 0) return true;
553  } else {
554  while (*q && *tag && *q == *tag) {
555  ++q;
556  ++tag;
557  }
558 
559  if (*tag == 0) // Have we found the end of the tag, and everything equal?
560  return true;
561  }
562 
563  return false;
564 }
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:419
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToComment() [1/2]

virtual const TiXmlComment* TiXmlNode::ToComment ( ) const
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlComment.

Definition at line 792 of file tinyxml.h.

◆ ToComment() [2/2]

virtual TiXmlComment* TiXmlNode::ToComment ( )
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlComment.

Definition at line 821 of file tinyxml.h.

Referenced by ticpp::Node::ToComment().

+ Here is the caller graph for this function:

◆ ToDeclaration() [1/2]

virtual const TiXmlDeclaration* TiXmlNode::ToDeclaration ( ) const
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDeclaration.

Definition at line 804 of file tinyxml.h.

◆ ToDeclaration() [2/2]

virtual TiXmlDeclaration* TiXmlNode::ToDeclaration ( )
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDeclaration.

Definition at line 833 of file tinyxml.h.

Referenced by TiXmlDocument::Parse(), and ticpp::Node::ToDeclaration().

+ Here is the caller graph for this function:

◆ ToDocument() [1/2]

virtual const TiXmlDocument* TiXmlNode::ToDocument ( ) const
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDocument.

Definition at line 784 of file tinyxml.h.

◆ ToDocument() [2/2]

virtual TiXmlDocument* TiXmlNode::ToDocument ( )
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDocument.

Definition at line 813 of file tinyxml.h.

◆ ToElement() [1/2]

virtual const TiXmlElement* TiXmlElement::ToElement ( ) const
inlinevirtual

Cast to a more defined type. Will return null not of the requested type.

Reimplemented from TiXmlNode.

Definition at line 1296 of file tinyxml.h.

◆ ToElement() [2/2]

virtual TiXmlElement* TiXmlElement::ToElement ( )
inlinevirtual

Cast to a more defined type. Will return null not of the requested type.

Reimplemented from TiXmlNode.

Definition at line 1300 of file tinyxml.h.

◆ ToLower()

static int TiXmlBase::ToLower ( int  v,
TiXmlEncoding  encoding 
)
inlinestaticprotectedinherited

Definition at line 419 of file tinyxml.h.

References TIXML_ENCODING_UTF8.

Referenced by TiXmlBase::StringEqual().

419  {
420  if (encoding == TIXML_ENCODING_UTF8) {
421  if (v < 128) return std::tolower(v);
422 
423  return v;
424  } else {
425  return std::tolower(v);
426  }
427  }
+ Here is the caller graph for this function:

◆ ToStylesheetReference() [1/2]

virtual const TiXmlStylesheetReference* TiXmlNode::ToStylesheetReference ( ) const
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlStylesheetReference.

Definition at line 808 of file tinyxml.h.

◆ ToStylesheetReference() [2/2]

virtual TiXmlStylesheetReference* TiXmlNode::ToStylesheetReference ( )
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlStylesheetReference.

Definition at line 837 of file tinyxml.h.

Referenced by ticpp::Node::ToStylesheetReference().

+ Here is the caller graph for this function:

◆ ToText() [1/2]

virtual const TiXmlText* TiXmlNode::ToText ( ) const
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlText.

Definition at line 800 of file tinyxml.h.

Referenced by GetText().

+ Here is the caller graph for this function:

◆ ToText() [2/2]

virtual TiXmlText* TiXmlNode::ToText ( )
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlText.

Definition at line 829 of file tinyxml.h.

Referenced by Print(), ticpp::Node::ToText(), and TiXmlHandle::ToText().

+ Here is the caller graph for this function:

◆ ToUnknown() [1/2]

virtual const TiXmlUnknown* TiXmlNode::ToUnknown ( ) const
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlUnknown.

Definition at line 796 of file tinyxml.h.

◆ ToUnknown() [2/2]

virtual TiXmlUnknown* TiXmlNode::ToUnknown ( )
inlinevirtualinherited

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlUnknown.

Definition at line 825 of file tinyxml.h.

Referenced by TiXmlHandle::ToUnknown().

+ Here is the caller graph for this function:

◆ Type()

int TiXmlNode::Type ( ) const
inlineinherited

Query the type (as an enumerated value, above) of this node.

The possible types are: DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, and DECLARATION.

Definition at line 770 of file tinyxml.h.

References TiXmlNode::type.

Referenced by TiXmlNode::InsertAfterChild(), TiXmlNode::InsertBeforeChild(), TiXmlNode::InsertEndChild(), TiXmlNode::LinkEndChild(), ticpp::Node::NodeFactory(), and ticpp::Node::Type().

770 { return type; }
NodeType type
Definition: tinyxml.h:893
+ Here is the caller graph for this function:

◆ Value()

const char* TiXmlNode::Value ( ) const
inlineinherited

The meaning of 'value' changes for the specific type of TiXmlNode.

Document: filename of the xml file
Element:  name of the element
Comment:  the comment text
Unknown:  the tag contents
Text:   the text string

The subclasses will wrap this function.

Definition at line 517 of file tinyxml.h.

Referenced by TiXmlNode::FirstChild(), TiXmlNode::LastChild(), TiXmlNode::NextSibling(), and TiXmlNode::PreviousSibling().

517 { return value.c_str(); }
TIXML_STRING value
Definition: tinyxml.h:898
+ Here is the caller graph for this function:

◆ ValueStr()

const std::string& TiXmlNode::ValueStr ( ) const
inlineinherited

Return Value() as a std::string.

If you only use STL, this is more efficient than calling Value(). Only available in STL mode.

Definition at line 524 of file tinyxml.h.

References TiXmlNode::value.

Referenced by ticpp::Node::Value().

524 { return value; }
TIXML_STRING value
Definition: tinyxml.h:898
+ Here is the caller graph for this function:

◆ ValueTStr()

const TIXML_STRING& TiXmlNode::ValueTStr ( ) const
inlineinherited

Definition at line 527 of file tinyxml.h.

References TiXmlNode::value.

527 { return value; }
TIXML_STRING value
Definition: tinyxml.h:898

Member Data Documentation

◆ attributeSet

TiXmlAttributeSet TiXmlElement::attributeSet
private

Definition at line 1325 of file tinyxml.h.

◆ errorString

const char * TiXmlBase::errorString
staticprotectedinherited
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 408 of file tinyxml.h.

◆ firstChild

◆ lastChild

◆ location

◆ m_spawnedWrappers

std::vector< ticpp::Base* > TiCppRC::m_spawnedWrappers
inherited

Remember all wrappers that we've created with 'new' - ( e.g.

NodeFactory, FirstChildElement, etc. )

Definition at line 63 of file ticpprc.h.

◆ next

◆ parent

◆ prev

◆ type

NodeType TiXmlNode::type
protectedinherited

Definition at line 893 of file tinyxml.h.

Referenced by TiXmlNode::TiXmlNode(), and TiXmlNode::Type().

◆ userData

void* TiXmlBase::userData
protectedinherited

Field containing a generic user pointer.

Definition at line 413 of file tinyxml.h.

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

◆ utf8ByteTable

const int TiXmlBase::utf8ByteTable
staticinherited

Definition at line 290 of file tinyxml.h.

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

◆ value

TIXML_STRING TiXmlNode::value
protectedinherited

Definition at line 898 of file tinyxml.h.

Referenced by TiXmlNode::SetValue(), TiXmlNode::ValueStr(), and TiXmlNode::ValueTStr().


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