TiXmlUnknown Class Reference

#include <tinyxml.h>

Inheritance diagram for TiXmlUnknown:
TiXmlNode TiXmlBase

List of all members.

Public Member Functions

 TiXmlUnknown ()
virtual ~TiXmlUnknown ()
 TiXmlUnknown (const TiXmlUnknown &copy)
void operator= (const TiXmlUnknown &copy)
virtual TiXmlNodeClone () const
 Creates a copy of this Unknown and returns it.
virtual void Print (FILE *cfile, int depth) const
virtual const char * Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual const TiXmlUnknownToUnknown () const
 Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlUnknownToUnknown ()
 Cast to a more defined type. Will return null not of the requested type.
virtual bool Accept (TiXmlVisitor *content) const

Protected Member Functions

void CopyTo (TiXmlUnknown *target) const
virtual void StreamIn (std::istream *in, TIXML_STRING *tag)

Detailed Description

Any tag that tinyXml doesn't recognize is saved as an unknown. It is a tag of text, but should not be modified. It will be written back to the XML, unchanged, when the file is saved.

DTD tags get thrown into TiXmlUnknowns.

Definition at line 1325 of file tinyxml.h.


Constructor & Destructor Documentation

TiXmlUnknown::TiXmlUnknown (  )  [inline]

Definition at line 1328 of file tinyxml.h.

Referenced by Clone().

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

Definition at line 1329 of file tinyxml.h.

01329 {}

TiXmlUnknown::TiXmlUnknown ( const TiXmlUnknown copy  )  [inline]

Definition at line 1331 of file tinyxml.h.

References CopyTo().

01331 : TiXmlNode( TiXmlNode::UNKNOWN )               { copy.CopyTo( this ); }


Member Function Documentation

bool TiXmlUnknown::Accept ( TiXmlVisitor content  )  const [virtual]

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

Implements TiXmlNode.

Definition at line 1466 of file tinyxml.cpp.

References TiXmlVisitor::Visit().

01467 {
01468         return visitor->Visit( *this );
01469 }

TiXmlNode * TiXmlUnknown::Clone (  )  const [virtual]

Creates a copy of this Unknown and returns it.

Implements TiXmlNode.

Definition at line 1472 of file tinyxml.cpp.

References CopyTo(), and TiXmlUnknown().

01473 {
01474         TiXmlUnknown* clone = new TiXmlUnknown();
01475 
01476         if ( !clone )
01477                 return 0;
01478 
01479         CopyTo( clone );
01480         return clone;
01481 }

void TiXmlUnknown::CopyTo ( TiXmlUnknown target  )  const [protected]

Reimplemented from TiXmlNode.

Definition at line 1460 of file tinyxml.cpp.

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

01461 {
01462         TiXmlNode::CopyTo( target );
01463 }

void TiXmlUnknown::operator= ( const TiXmlUnknown copy  )  [inline]

Reimplemented from TiXmlNode.

Definition at line 1332 of file tinyxml.h.

References CopyTo().

01332 { copy.CopyTo( this ); }

const char * TiXmlUnknown::Parse ( const char *  p,
TiXmlParsingData data,
TiXmlEncoding  encoding 
) [virtual]

Implements TiXmlBase.

Definition at line 1270 of file tinyxmlparser.cpp.

References TiXmlParsingData::Cursor(), TiXmlNode::GetDocument(), TiXmlBase::location, TiXmlDocument::SetError(), TiXmlBase::SkipWhiteSpace(), TiXmlParsingData::Stamp(), TiXmlBase::TIXML_ERROR_PARSING_UNKNOWN, and TiXmlNode::value.

01271 {
01272         TiXmlDocument* document = GetDocument();
01273         p = SkipWhiteSpace( p, encoding );
01274 
01275         if ( data )
01276         {
01277                 data->Stamp( p, encoding );
01278                 location = data->Cursor();
01279         }
01280         if ( !p || !*p || *p != '<' )
01281         {
01282                 if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding );
01283                 return 0;
01284         }
01285         ++p;
01286     value = "";
01287 
01288         while ( p && *p && *p != '>' )
01289         {
01290                 value += *p;
01291                 ++p;
01292         }
01293 
01294         if ( !p )
01295         {
01296                 if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
01297         }
01298         if ( *p == '>' )
01299                 return p+1;
01300         return p;
01301 }

void TiXmlUnknown::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 1452 of file tinyxml.cpp.

References TiXmlNode::value.

01453 {
01454         for ( int i=0; i<depth; i++ )
01455                 fprintf( cfile, "    " );
01456         fprintf( cfile, "<%s>", value.c_str() );
01457 }

void TiXmlUnknown::StreamIn ( std::istream *  in,
TIXML_STRING *  tag 
) [protected, virtual]

Implements TiXmlNode.

Definition at line 1246 of file tinyxmlparser.cpp.

References TiXmlNode::GetDocument(), TiXmlDocument::SetError(), TIXML_ENCODING_UNKNOWN, and TiXmlBase::TIXML_ERROR_EMBEDDED_NULL.

01247 {
01248         while ( in->good() )
01249         {
01250                 int c = in->get();      
01251                 if ( c <= 0 )
01252                 {
01253                         TiXmlDocument* document = GetDocument();
01254                         if ( document )
01255                                 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
01256                         return;
01257                 }
01258                 (*tag) += (char) c;
01259 
01260                 if ( c == '>' )
01261                 {
01262                         // All is well.
01263                         return;         
01264                 }
01265         }
01266 }

virtual TiXmlUnknown* TiXmlUnknown::ToUnknown (  )  [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1342 of file tinyxml.h.

virtual const TiXmlUnknown* TiXmlUnknown::ToUnknown (  )  const [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1341 of file tinyxml.h.


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

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1