osgEarth 2.1.1
Public Member Functions | Protected Member Functions

TiXmlComment Class Reference

#include <tinyxml.h>

Inheritance diagram for TiXmlComment:
Collaboration diagram for TiXmlComment:

List of all members.

Public Member Functions

 TiXmlComment ()
 Constructs an empty comment.
 TiXmlComment (const char *_value)
 Construct a comment from text.
 TiXmlComment (const TiXmlComment &)
void operator= (const TiXmlComment &base)
virtual ~TiXmlComment ()
virtual TiXmlNodeClone () const
 Returns a copy of this Comment.
virtual void Print (FILE *cfile, int depth) const
virtual const char * Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual const TiXmlCommentToComment () const
 Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlCommentToComment ()
 Cast to a more defined type. Will return null not of the requested type.
virtual bool Accept (TiXmlVisitor *visitor) const

Protected Member Functions

void CopyTo (TiXmlComment *target) const

Detailed Description

An XML comment.

Definition at line 1155 of file tinyxml.h.


Constructor & Destructor Documentation

TiXmlComment::TiXmlComment ( ) [inline]

Constructs an empty comment.

Definition at line 1159 of file tinyxml.h.

Here is the caller graph for this function:

TiXmlComment::TiXmlComment ( const char *  _value) [inline]

Construct a comment from text.

Definition at line 1161 of file tinyxml.h.

Here is the call graph for this function:

TiXmlComment::TiXmlComment ( const TiXmlComment copy)

Definition at line 1238 of file tinyxml.cpp.

Here is the call graph for this function:

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

Definition at line 1167 of file tinyxml.h.

{}

Member Function Documentation

bool TiXmlComment::Accept ( TiXmlVisitor visitor) const [virtual]

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

Implements TiXmlNode.

Definition at line 1268 of file tinyxml.cpp.

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

Here is the call graph for this function:

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

Returns a copy of this Comment.

Implements TiXmlNode.

Definition at line 1274 of file tinyxml.cpp.

{
        TiXmlComment* clone = new TiXmlComment();

        if ( !clone )
                return 0;

        CopyTo( clone );
        return clone;
}

Here is the call graph for this function:

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

Definition at line 1262 of file tinyxml.cpp.

{
        TiXmlNode::CopyTo( target );
}

Here is the caller graph for this function:

void TiXmlComment::operator= ( const TiXmlComment base)

Definition at line 1244 of file tinyxml.cpp.

{
        Clear();
        base.CopyTo( this );
}

Here is the call graph for this function:

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

Implements TiXmlBase.

Definition at line 1336 of file tinyxmlparser.cpp.

{
        TiXmlDocument* document = GetDocument();
        value = "";

        p = SkipWhiteSpace( p, encoding );

        if ( data )
        {
                data->Stamp( p, encoding );
                location = data->Cursor();
        }
        const char* startTag = "<!--";
        const char* endTag   = "-->";

        if ( !StringEqual( p, startTag, false, encoding ) )
        {
                document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
                return 0;
        }
        p += strlen( startTag );

        // [ 1475201 ] TinyXML parses entities in comments
        // Oops - ReadText doesn't work, because we don't want to parse the entities.
        // p = ReadText( p, &value, false, endTag, false, encoding );
        //
        // from the XML spec:
        /*
         [Definition: Comments may appear anywhere in a document outside other markup; in addition, 
                      they may appear within the document type declaration at places allowed by the grammar. 
                                  They are not part of the document's character data; an XML processor MAY, but need not, 
                                  make it possible for an application to retrieve the text of comments. For compatibility, 
                                  the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity 
                                  references MUST NOT be recognized within comments.

                                  An example of a comment:

                                  <!-- declarations for <head> & <body> -->
        */

    value = "";
        // Keep all the white space.
        while ( p && *p && !StringEqual( p, endTag, false, encoding ) )
        {
                value.append( p, 1 );
                ++p;
        }
        if ( p && *p ) 
                p += strlen( endTag );

        return p;
}

Here is the call graph for this function:

void TiXmlComment::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 1251 of file tinyxml.cpp.

{
        assert( cfile );
        for ( int i=0; i<depth; i++ )
        {
                fprintf( cfile,  "    " );
        }
        fprintf( cfile, "<!--%s-->", value.c_str() );
}
virtual const TiXmlComment* TiXmlComment::ToComment ( ) const [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1179 of file tinyxml.h.

virtual TiXmlComment* TiXmlComment::ToComment ( ) [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1180 of file tinyxml.h.


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