#include <OBTtinyxml.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 |
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 TiXmlComment * | ToComment () |
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. | |
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 |
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 TiXmlComment * | ToComment () |
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) |
void | CopyTo (TiXmlComment *target) const |
virtual void | StreamIn (std::istream *in, TIXML_STRING *tag) |
Definition at line 1161 of file OBTtinyxml.h.
OBT::TiXmlComment::TiXmlComment | ( | ) | [inline] |
Constructs an empty comment.
Definition at line 1165 of file OBTtinyxml.h.
Referenced by Clone().
01165 : TiXmlNode( TiXmlNode::COMMENT ) {}
OBT::TiXmlComment::TiXmlComment | ( | const char * | _value | ) | [inline] |
Construct a comment from text.
Definition at line 1167 of file OBTtinyxml.h.
01167 : TiXmlNode( TiXmlNode::COMMENT ) { 01168 setValue( _value ); 01169 }
OBT::TiXmlComment::TiXmlComment | ( | const TiXmlComment & | copy | ) |
Definition at line 1289 of file OBTtinyxml.cpp.
References CopyTo().
01289 : TiXmlNode( TiXmlNode::COMMENT ) 01290 { 01291 copy.CopyTo( this ); 01292 }
virtual OBT::TiXmlComment::~TiXmlComment | ( | ) | [inline, virtual] |
OBT::TiXmlComment::TiXmlComment | ( | ) | [inline] |
Constructs an empty comment.
Definition at line 1164 of file tiny/OBTtinyxml.h.
01164 : TiXmlNode( TiXmlNode::COMMENT ) {}
OBT::TiXmlComment::TiXmlComment | ( | const char * | _value | ) | [inline] |
Construct a comment from text.
Definition at line 1166 of file tiny/OBTtinyxml.h.
References OBT::TiXmlNode::SetValue().
01166 : TiXmlNode( TiXmlNode::COMMENT ) { 01167 SetValue( _value ); 01168 }
OBT::TiXmlComment::TiXmlComment | ( | const TiXmlComment & | ) |
virtual OBT::TiXmlComment::~TiXmlComment | ( | ) | [inline, virtual] |
void OBT::TiXmlComment::operator= | ( | const TiXmlComment & | base | ) |
Definition at line 1295 of file OBTtinyxml.cpp.
References OBT::TiXmlNode::Clear(), and CopyTo().
01296 { 01297 Clear(); 01298 base.CopyTo( this ); 01299 }
TiXmlNode * OBT::TiXmlComment::Clone | ( | ) | const [virtual] |
Returns a copy of this Comment.
Implements OBT::TiXmlNode.
Definition at line 1325 of file OBTtinyxml.cpp.
References CopyTo(), and TiXmlComment().
01326 { 01327 TiXmlComment* clone = new TiXmlComment(); 01328 01329 if ( !clone ) 01330 return 0; 01331 01332 CopyTo( clone ); 01333 return clone; 01334 }
void OBT::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 OBT::TiXmlBase.
Definition at line 1302 of file OBTtinyxml.cpp.
References OBT::TiXmlNode::value.
01303 { 01304 assert( cfile ); 01305 for ( int i=0; i<depth; i++ ) 01306 { 01307 fprintf( cfile, " " ); 01308 } 01309 fprintf( cfile, "<!--%s-->", value.c_str() ); 01310 }
const char * OBT::TiXmlComment::Parse | ( | const char * | p, | |
TiXmlParsingData * | data, | |||
TiXmlEncoding | encoding | |||
) | [virtual] |
Implements OBT::TiXmlBase.
Definition at line 1337 of file OBTtinyxmlparser.cpp.
References OBT::TiXmlParsingData::Cursor(), OBT::TiXmlNode::GetDocument(), OBT::TiXmlBase::location, OBT::TiXmlDocument::SetError(), OBT::TiXmlBase::SkipWhiteSpace(), OBT::TiXmlParsingData::Stamp(), OBT::TiXmlBase::StringEqual(), OBT::TiXmlBase::TIXML_ERROR_PARSING_COMMENT, and OBT::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* OBT::TiXmlComment::ToComment | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from OBT::TiXmlNode.
Definition at line 1185 of file OBTtinyxml.h.
virtual TiXmlComment* OBT::TiXmlComment::ToComment | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from OBT::TiXmlNode.
Definition at line 1186 of file OBTtinyxml.h.
bool OBT::TiXmlComment::Accept | ( | TiXmlVisitor * | visitor | ) | const [virtual] |
Walk the XML tree visiting this node and all of its children.
Implements OBT::TiXmlNode.
Definition at line 1319 of file OBTtinyxml.cpp.
References OBT::TiXmlVisitor::Visit().
void OBT::TiXmlComment::CopyTo | ( | TiXmlComment * | target | ) | const [protected] |
Definition at line 1313 of file OBTtinyxml.cpp.
References OBT::TiXmlNode::CopyTo().
Referenced by Clone(), operator=(), and TiXmlComment().
01314 { 01315 TiXmlNode::CopyTo( target ); 01316 }
void OBT::TiXmlComment::StreamIn | ( | std::istream * | in, | |
TIXML_STRING * | tag | |||
) | [protected, virtual] |
Implements OBT::TiXmlNode.
Definition at line 1310 of file OBTtinyxmlparser.cpp.
References OBT::TiXmlNode::GetDocument(), OBT::TiXmlDocument::SetError(), OBT::TIXML_ENCODING_UNKNOWN, and OBT::TiXmlBase::TIXML_ERROR_EMBEDDED_NULL.
01311 { 01312 while ( in->good() ) 01313 { 01314 int c = in->get(); 01315 if ( c <= 0 ) 01316 { 01317 TiXmlDocument* document = GetDocument(); 01318 if ( document ) 01319 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); 01320 return; 01321 } 01322 01323 (*tag) += (char) c; 01324 01325 if ( c == '>' 01326 && tag->at( tag->length() - 2 ) == '-' 01327 && tag->at( tag->length() - 3 ) == '-' ) 01328 { 01329 // All is well. 01330 return; 01331 } 01332 } 01333 }
void OBT::TiXmlComment::operator= | ( | const TiXmlComment & | base | ) |
virtual TiXmlNode* OBT::TiXmlComment::Clone | ( | ) | const [virtual] |
virtual void OBT::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 OBT::TiXmlBase.
virtual const char* OBT::TiXmlComment::Parse | ( | const char * | p, | |
TiXmlParsingData * | data, | |||
TiXmlEncoding | encoding | |||
) | [virtual] |
Implements OBT::TiXmlBase.
virtual const TiXmlComment* OBT::TiXmlComment::ToComment | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from OBT::TiXmlNode.
Definition at line 1184 of file tiny/OBTtinyxml.h.
virtual TiXmlComment* OBT::TiXmlComment::ToComment | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from OBT::TiXmlNode.
Definition at line 1185 of file tiny/OBTtinyxml.h.
virtual bool OBT::TiXmlComment::Accept | ( | TiXmlVisitor * | visitor | ) | const [virtual] |
void OBT::TiXmlComment::CopyTo | ( | TiXmlComment * | target | ) | const [protected] |
virtual void OBT::TiXmlComment::StreamIn | ( | std::istream * | in, | |
TIXML_STRING * | tag | |||
) | [protected, virtual] |
Implements OBT::TiXmlNode.