xmlTiny::TiXmlComment Class Reference

An XML comment. More...

#include <OBTtinyxml.h>

Inheritance diagram for xmlTiny::TiXmlComment:

Inheritance graph
[legend]
Collaboration diagram for xmlTiny::TiXmlComment:

Collaboration graph
[legend]

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
 All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.
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 TiXmlCommentToComment ()
 Cast to a more defined type. Will return null not of the requested type.
virtual bool Accept (TiXmlVisitor *visitor) const
 Walk the XML tree visiting this node and all of its children.

Protected Member Functions

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


Detailed Description

An XML comment.

Definition at line 1159 of file tiny/tmp/OBTtinyxml.h.


Constructor & Destructor Documentation

xmlTiny::TiXmlComment::TiXmlComment (  )  [inline]

Constructs an empty comment.

Definition at line 1163 of file tiny/tmp/OBTtinyxml.h.

Referenced by Clone().

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

Construct a comment from text.

Definition at line 1165 of file tiny/tmp/OBTtinyxml.h.

References xmlTiny::TiXmlNode::SetValue().

01165                                            : TiXmlNode( TiXmlNode::COMMENT ) {
01166                 SetValue( _value );
01167         }

xmlTiny::TiXmlComment::TiXmlComment ( const TiXmlComment copy  ) 

Definition at line 1290 of file tiny/tmp/OBTtinyxml.cpp.

References CopyTo().

01290                                                      : TiXmlNode( TiXmlNode::COMMENT )
01291 {
01292         copy.CopyTo( this );
01293 }

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

Definition at line 1171 of file tiny/tmp/OBTtinyxml.h.

01171 {}


Member Function Documentation

void xmlTiny::TiXmlComment::operator= ( const TiXmlComment base  ) 

Definition at line 1296 of file tiny/tmp/OBTtinyxml.cpp.

References xmlTiny::TiXmlNode::Clear(), and CopyTo().

01297 {
01298         Clear();
01299         base.CopyTo( this );
01300 }

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

Returns a copy of this Comment.

Implements xmlTiny::TiXmlNode.

Definition at line 1326 of file tiny/tmp/OBTtinyxml.cpp.

References CopyTo(), and TiXmlComment().

01327 {
01328         TiXmlComment* clone = new TiXmlComment();
01329 
01330         if ( !clone )
01331                 return 0;
01332 
01333         CopyTo( clone );
01334         return clone;
01335 }

void xmlTiny::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 xmlTiny::TiXmlBase.

Definition at line 1303 of file tiny/tmp/OBTtinyxml.cpp.

References xmlTiny::TiXmlNode::value.

01304 {
01305         assert( cfile );
01306         for ( int i=0; i<depth; i++ )
01307         {
01308                 fprintf( cfile,  "    " );
01309         }
01310         fprintf( cfile, "<!--%s-->", value.c_str() );
01311 }

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

Implements xmlTiny::TiXmlBase.

Definition at line 1337 of file tiny/tmp/OBTtinyxmlparser.cpp.

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

01338 {
01339         TiXmlDocument* document = GetDocument();
01340         value = "";
01341 
01342         p = SkipWhiteSpace( p, encoding );
01343 
01344         if ( data )
01345         {
01346                 data->Stamp( p, encoding );
01347                 location = data->Cursor();
01348         }
01349         const char* startTag = "<!--";
01350         const char* endTag   = "-->";
01351 
01352         if ( !StringEqual( p, startTag, false, encoding ) )
01353         {
01354                 document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
01355                 return 0;
01356         }
01357         p += strlen( startTag );
01358 
01359         // [ 1475201 ] TinyXML parses entities in comments
01360         // Oops - ReadText doesn't work, because we don't want to parse the entities.
01361         // p = ReadText( p, &value, false, endTag, false, encoding );
01362         //
01363         // from the XML spec:
01364         /*
01365          [Definition: Comments may appear anywhere in a document outside other markup; in addition, 
01366                       they may appear within the document type declaration at places allowed by the grammar. 
01367                                   They are not part of the document's character data; an XML processor MAY, but need not, 
01368                                   make it possible for an application to retrieve the text of comments. For compatibility, 
01369                                   the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity 
01370                                   references MUST NOT be recognized within comments.
01371 
01372                                   An example of a comment:
01373 
01374                                   <!-- declarations for <head> & <body> -->
01375         */
01376 
01377     value = "";
01378         // Keep all the white space.
01379         while ( p && *p && !StringEqual( p, endTag, false, encoding ) )
01380         {
01381                 value.append( p, 1 );
01382                 ++p;
01383         }
01384         if ( p ) 
01385                 p += strlen( endTag );
01386 
01387         return p;
01388 }

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

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

Reimplemented from xmlTiny::TiXmlNode.

Definition at line 1183 of file tiny/tmp/OBTtinyxml.h.

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

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

Reimplemented from xmlTiny::TiXmlNode.

Definition at line 1184 of file tiny/tmp/OBTtinyxml.h.

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

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

Implements xmlTiny::TiXmlNode.

Definition at line 1320 of file tiny/tmp/OBTtinyxml.cpp.

References xmlTiny::TiXmlVisitor::Visit().

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

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

Definition at line 1314 of file tiny/tmp/OBTtinyxml.cpp.

References xmlTiny::TiXmlNode::CopyTo().

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

01315 {
01316         TiXmlNode::CopyTo( target );
01317 }

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

Implements xmlTiny::TiXmlNode.


Generated on Wed Oct 1 11:34:25 2008 for OBT by  doxygen 1.5.3