osgEarth 2.1.1
|
#include <tinyxml.h>
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 TiXmlNode * | Clone () 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 TiXmlComment * | ToComment () const |
Cast to a more defined type. Will return null not of the requested type. | |
virtual TiXmlComment * | ToComment () |
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 |
TiXmlComment::TiXmlComment | ( | ) | [inline] |
Constructs an empty comment.
Definition at line 1159 of file tinyxml.h.
: TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {}
TiXmlComment::TiXmlComment | ( | const char * | _value | ) | [inline] |
Construct a comment from text.
Definition at line 1161 of file tinyxml.h.
: TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { SetValue( _value ); }
TiXmlComment::TiXmlComment | ( | const TiXmlComment & | copy | ) |
Definition at line 1238 of file tinyxml.cpp.
: TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { copy.CopyTo( this ); }
virtual TiXmlComment::~TiXmlComment | ( | ) | [inline, virtual] |
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 ); }
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; }
void TiXmlComment::CopyTo | ( | TiXmlComment * | target | ) | const [protected] |
Definition at line 1262 of file tinyxml.cpp.
{ TiXmlNode::CopyTo( target ); }
void TiXmlComment::operator= | ( | const TiXmlComment & | base | ) |
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; }
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] |
virtual TiXmlComment* TiXmlComment::ToComment | ( | ) | [inline, virtual] |