Public Member Functions | Protected Member Functions

TiXmlUnknown Class Reference

#include <tinyxml.h>

Inheritance diagram for TiXmlUnknown:
Inheritance graph
[legend]
Collaboration diagram for TiXmlUnknown:
Collaboration graph
[legend]

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, TiXmlString *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 1352 of file tinyxml.h.


Constructor & Destructor Documentation

TiXmlUnknown::TiXmlUnknown (  ) [inline]

Definition at line 1355 of file tinyxml.h.

Referenced by Clone().

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

Definition at line 1356 of file tinyxml.h.

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

Definition at line 1358 of file tinyxml.h.

References CopyTo().


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 1435 of file tinyxml.cpp.

References TiXmlVisitor::Visit().

{
        return visitor->Visit( *this );
}
TiXmlNode * TiXmlUnknown::Clone (  ) const [virtual]

Creates a copy of this Unknown and returns it.

Implements TiXmlNode.

Definition at line 1441 of file tinyxml.cpp.

References CopyTo(), and TiXmlUnknown().

{
        TiXmlUnknown* clone = new TiXmlUnknown();

        if ( !clone )
                return 0;

        CopyTo( clone );
        return clone;
}
void TiXmlUnknown::CopyTo ( TiXmlUnknown target ) const [protected]

Definition at line 1429 of file tinyxml.cpp.

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

{
        TiXmlNode::CopyTo( target );
}
void TiXmlUnknown::operator= ( const TiXmlUnknown copy ) [inline]

Definition at line 1359 of file tinyxml.h.

References CopyTo().

{ copy.CopyTo( this ); }
const char * TiXmlUnknown::Parse ( const char *  p,
TiXmlParsingData data,
TiXmlEncoding  encoding 
) [virtual]

Implements TiXmlBase.

Definition at line 1275 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.

{
        TiXmlDocument* document = GetDocument();
        p = SkipWhiteSpace( p, encoding );

        if ( data )
        {
                data->Stamp( p, encoding );
                location = data->Cursor();
        }
        if ( !p || !*p || *p != '<' )
        {
                if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding );
                return 0;
        }
        ++p;
    value = "";

        while ( p && *p && *p != '>' )
        {
                value += *p;
                ++p;
        }

        if ( !p )
        {
                if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
        }
        if ( *p == '>' )
                return p+1;
        return p;
}
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 1421 of file tinyxml.cpp.

References TiXmlNode::value.

{
        for ( int i=0; i<depth; i++ )
                fprintf( cfile, "    " );
        fprintf( cfile, "<%s>", value.c_str() );
}
void TiXmlUnknown::StreamIn ( std::istream *  in,
TiXmlString *  tag 
) [protected, virtual]

Implements TiXmlNode.

Definition at line 1251 of file tinyxmlparser.cpp.

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

{
        while ( in->good() )
        {
                int c = in->get();      
                if ( c <= 0 )
                {
                        TiXmlDocument* document = GetDocument();
                        if ( document )
                                document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
                        return;
                }
                (*tag) += (char) c;

                if ( c == '>' )
                {
                        // All is well.
                        return;         
                }
        }
}
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 1368 of file tinyxml.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines