#include <tinyxml.h>
Public Member Functions | |
virtual bool | Accept (TiXmlVisitor *content) const |
bool | CDATA () const |
Queries whether this represents text using a CDATA section. | |
TiXmlText & | operator= (const TiXmlText &base) |
virtual const char * | Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding) |
virtual void | Print (FILE *cfile, int depth) const |
void | SetCDATA (bool _cdata) |
Turns on or off a CDATA representation of text. | |
TiXmlText (const char *initValue) | |
TiXmlText (const TiXmlText ©) | |
TiXmlText (const std::string &initValue) | |
Constructor. | |
virtual const TiXmlText * | ToText () const |
Cast to a more defined type. Will return null not of the requested type. | |
virtual TiXmlText * | ToText () |
Cast to a more defined type. Will return null not of the requested type. | |
virtual | ~TiXmlText () |
Protected Member Functions | |
bool | Blank () const |
virtual TiXmlNode * | Clone () const |
[internal use] Creates a new Element and returns it. | |
void | CopyTo (TiXmlText *target) const |
virtual void | StreamIn (std::istream *in, TIXML_STRING *tag) |
Private Attributes | |
bool | cdata |
Friends | |
class | TiXmlElement |
XML text. A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCDATA() and query it with CDATA().
TiXmlText::TiXmlText | ( | const char * | initValue | ) | [inline] |
Constructor for text element. By default, it is treated as normal, encoded text. If you want it be output as a CDATA text element, set the parameter _cdata to 'true'
Definition at line 1215 of file tinyxml.h.
References cdata, and TiXmlNode::SetValue().
Referenced by Clone().
: TiXmlNode (TiXmlNode::TEXT) { SetValue( initValue ); cdata = false; }
TiXmlText::TiXmlText | ( | const std::string & | initValue | ) | [inline] |
Constructor.
Definition at line 1224 of file tinyxml.h.
References cdata, and TiXmlNode::SetValue().
: TiXmlNode (TiXmlNode::TEXT) { SetValue( initValue ); cdata = false; }
TiXmlText::TiXmlText | ( | const TiXmlText & | copy | ) | [inline] |
bool TiXmlText::Accept | ( | TiXmlVisitor * | content | ) | const [virtual] |
Walk the XML tree visiting this node and all of its children.
Implements TiXmlNode.
Definition at line 1380 of file tinyxml.cc.
References TiXmlVisitor::Visit().
{ return visitor->Visit( *this ); }
bool TiXmlText::Blank | ( | ) | const [protected] |
Definition at line 1641 of file tinyxmlparser.cc.
References i, TiXmlBase::IsWhiteSpace(), and TiXmlNode::value.
Referenced by TiXmlElement::ReadValue().
bool TiXmlText::CDATA | ( | ) | const [inline] |
Queries whether this represents text using a CDATA section.
Definition at line 1238 of file tinyxml.h.
References cdata.
Referenced by TiXmlPrinter::Visit(), and TiXmlPrinter::VisitEnter().
{ return cdata; }
TiXmlNode * TiXmlText::Clone | ( | ) | const [protected, virtual] |
void TiXmlText::CopyTo | ( | TiXmlText * | target | ) | const [protected] |
Definition at line 1373 of file tinyxml.cc.
References cdata.
Referenced by Clone(), operator=(), and TiXmlText().
{ TiXmlNode::CopyTo( target ); target->cdata = cdata; }
const char * TiXmlText::Parse | ( | const char * | p, |
TiXmlParsingData * | data, | ||
TiXmlEncoding | encoding | ||
) | [virtual] |
Implements TiXmlBase.
Definition at line 1508 of file tinyxmlparser.cc.
References cdata, TiXmlParsingData::Cursor(), end, TiXmlNode::GetDocument(), TiXmlBase::location, AlCaHLTBitMon_ParallelJobs::p, TiXmlBase::ReadText(), TiXmlDocument::SetError(), TiXmlParsingData::Stamp(), TiXmlBase::StringEqual(), TiXmlBase::TIXML_ERROR_PARSING_CDATA, TIXML_STRING, and TiXmlNode::value.
Referenced by TiXmlElement::ReadValue().
{ value = ""; TiXmlDocument* document = GetDocument(); if ( data ) { data->Stamp( p, encoding ); location = data->Cursor(); } const char* const startTag = "<![CDATA["; const char* const endTag = "]]>"; if ( cdata || StringEqual( p, startTag, false, encoding ) ) { cdata = true; if ( !StringEqual( p, startTag, false, encoding ) ) { document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); return 0; } p += strlen( startTag ); // Keep all the white space, ignore the encoding, etc. while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) { value += *p; ++p; } TIXML_STRING dummy; p = ReadText( p, &dummy, false, endTag, false, encoding ); return p; } else { bool ignoreWhite = true; const char* end = "<"; p = ReadText( p, &value, ignoreWhite, end, false, encoding ); if ( p ) return p-1; // don't truncate the '<' return 0; } }
void TiXmlText::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 1352 of file tinyxml.cc.
References cdata, TiXmlBase::EncodeString(), i, TIXML_STRING, and TiXmlNode::value.
{ assert( cfile ); if ( cdata ) { int i; fprintf( cfile, "\n" ); for ( i=0; i<depth; i++ ) { fprintf( cfile, " " ); } fprintf( cfile, "<![CDATA[%s]]>\n", value.c_str() ); // unformatted output } else { TIXML_STRING buffer; EncodeString( value, &buffer ); fprintf( cfile, "%s", buffer.c_str() ); } }
void TiXmlText::SetCDATA | ( | bool | _cdata | ) | [inline] |
Turns on or off a CDATA representation of text.
Definition at line 1240 of file tinyxml.h.
References cdata.
Referenced by TiXmlNode::Identify().
{ cdata = _cdata; }
virtual void TiXmlText::StreamIn | ( | std::istream * | in, |
TIXML_STRING * | tag | ||
) | [protected, virtual] |
Implements TiXmlNode.
virtual const TiXmlText* TiXmlText::ToText | ( | ) | const [inline, virtual] |
virtual TiXmlText* TiXmlText::ToText | ( | ) | [inline, virtual] |
friend class TiXmlElement [friend] |
bool TiXmlText::cdata [private] |
Definition at line 1263 of file tinyxml.h.
Referenced by CDATA(), CopyTo(), Parse(), Print(), SetCDATA(), and TiXmlText().