TiXmlBase Class Reference

TiXmlBase is a base class for every class in TinyXml. More...

#include <tinyxml.h>

Inheritance diagram for TiXmlBase:

Inheritance graph
[legend]
Collaboration diagram for TiXmlBase:

Collaboration graph
[legend]

Data Structures

struct  Entity

Public Member Functions

 TiXmlBase ()
virtual ~TiXmlBase ()
virtual void Print (FILE *cfile, int depth) const =0
 All TinyXml classes can print themselves to a filestream.

Static Public Member Functions

static void SetCondenseWhiteSpace (bool condense)
 The world does not agree on whether white space should be kept or not.
static bool IsWhiteSpaceCondensed ()
 Return the current white space setting.

Protected Types

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

Protected Member Functions

virtual void StreamOut (TIXML_OSTREAM *) const =0
virtual const char * Parse (const char *p)=0

Static Protected Member Functions

static const char * SkipWhiteSpace (const char *)
static bool IsWhiteSpace (int c)
static bool StreamWhiteSpace (TIXML_ISTREAM *in, TIXML_STRING *tag)
static bool StreamTo (TIXML_ISTREAM *in, int character, TIXML_STRING *tag)
static const char * ReadName (const char *p, TIXML_STRING *name)
static const char * ReadText (const char *in, TIXML_STRING *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase)
static const char * GetEntity (const char *in, char *value)
static const char * GetChar (const char *p, char *value)
static void PutString (const TIXML_STRING &str, TIXML_OSTREAM *out)
static void PutString (const TIXML_STRING &str, TIXML_STRING *out)
static bool StringEqual (const char *p, const char *endTag, bool ignoreCase)

Static Protected Attributes

static const char * errorString [TIXML_ERROR_STRING_COUNT]

Private Types

enum  { NUM_ENTITY = 5, MAX_ENTITY_LENGTH = 6 }

Static Private Attributes

static Entity entity [NUM_ENTITY]
static bool condenseWhiteSpace = true

Friends

class TiXmlNode
class TiXmlElement
class TiXmlDocument

Detailed Description

TiXmlBase is a base class for every class in TinyXml.

It does little except to establish that TinyXml classes can be printed and provide some utility functions.

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

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

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

	A Decleration contains: Attributes (not on tree)
	

Definition at line 131 of file tinyxml.h.


Member Enumeration Documentation

anonymous enum [protected]

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_STRING_COUNT 

Definition at line 217 of file tinyxml.h.

anonymous enum [private]

Enumerator:
NUM_ENTITY 
MAX_ENTITY_LENGTH 

Definition at line 245 of file tinyxml.h.


Constructor & Destructor Documentation

TiXmlBase::TiXmlBase (  )  [inline]

Definition at line 138 of file tinyxml.h.

virtual TiXmlBase::~TiXmlBase (  )  [inline, virtual]

Definition at line 139 of file tinyxml.h.


Member Function Documentation

static const char* TiXmlBase::GetChar ( const char *  p,
char *  value 
) [inline, static, protected]

Definition at line 191 of file tinyxml.h.

References GetEntity().

Referenced by ReadText().

const char * TiXmlBase::GetEntity ( const char *  in,
char *  value 
) [static, protected]

Definition at line 141 of file tinyxmlparser.cpp.

References TiXmlBase::Entity::chr, entity, NUM_ENTITY, and TIXML_STRING.

Referenced by GetChar().

static bool TiXmlBase::IsWhiteSpace ( int  c  )  [inline, static, protected]

Definition at line 162 of file tinyxml.h.

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

static bool TiXmlBase::IsWhiteSpaceCondensed (  )  [inline, static]

Return the current white space setting.

Definition at line 157 of file tinyxml.h.

References condenseWhiteSpace.

virtual const char* TiXmlBase::Parse ( const char *  p  )  [protected, pure virtual]

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

All TinyXml classes can print themselves to a filestream.

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

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

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

Referenced by TiXmlDocument::Print(), and TiXmlElement::Print().

void TiXmlBase::PutString ( const TIXML_STRING &  str,
TIXML_STRING *  out 
) [static, protected]

Definition at line 63 of file tinyxml.cpp.

References entity.

void TiXmlBase::PutString ( const TIXML_STRING &  str,
TIXML_OSTREAM *  out 
) [static, protected]

const char * TiXmlBase::ReadName ( const char *  p,
TIXML_STRING *  name 
) [static, protected]

Definition at line 115 of file tinyxmlparser.cpp.

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

const char * TiXmlBase::ReadText ( const char *  in,
TIXML_STRING *  text,
bool  ignoreWhiteSpace,
const char *  endTag,
bool  ignoreCase 
) [static, protected]

static void TiXmlBase::SetCondenseWhiteSpace ( bool  condense  )  [inline, static]

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 these values is not thread safe.

Definition at line 154 of file tinyxml.h.

References condenseWhiteSpace.

const char * TiXmlBase::SkipWhiteSpace ( const char *  p  )  [static, protected]

virtual void TiXmlBase::StreamOut ( TIXML_OSTREAM *   )  const [protected, pure virtual]

bool TiXmlBase::StreamTo ( TIXML_ISTREAM *  in,
int  character,
TIXML_STRING *  tag 
) [static, protected]

Definition at line 100 of file tinyxmlparser.cpp.

Referenced by TiXmlDocument::StreamIn().

bool TiXmlBase::StreamWhiteSpace ( TIXML_ISTREAM *  in,
TIXML_STRING *  tag 
) [static, protected]

Definition at line 87 of file tinyxmlparser.cpp.

References IsWhiteSpace().

Referenced by TiXmlElement::StreamIn().

bool TiXmlBase::StringEqual ( const char *  p,
const char *  endTag,
bool  ignoreCase 
) [static, protected]


Friends And Related Function Documentation

friend class TiXmlDocument [friend]

Reimplemented in TiXmlNode.

Definition at line 135 of file tinyxml.h.

friend class TiXmlElement [friend]

Reimplemented in TiXmlNode, and TiXmlText.

Definition at line 134 of file tinyxml.h.

friend class TiXmlNode [friend]

Definition at line 133 of file tinyxml.h.


Field Documentation

bool TiXmlBase::condenseWhiteSpace = true [static, private]

Definition at line 252 of file tinyxml.h.

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

Initial value:

 
{
    { "&amp;",  5, '&' },
    { "&lt;",   4, '<' },
    { "&gt;",   4, '>' },
    { "&quot;", 6, '\"' },
    { "&apos;", 6, '\'' }
}

Definition at line 251 of file tinyxml.h.

Referenced by GetEntity(), and PutString().

const char * TiXmlBase::errorString [static, protected]

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."
}

Definition at line 236 of file tinyxml.h.


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

Generated on Sun Nov 23 04:12:56 2008 for Sofa by  doxygen 1.5.7.1