osgEarth 2.1.1
|
#include <tinyxml.h>
Public Member Functions | |
TiXmlText (const char *initValue) | |
virtual | ~TiXmlText () |
TiXmlText (const TiXmlText ©) | |
void | operator= (const TiXmlText &base) |
virtual void | Print (FILE *cfile, int depth) const |
bool | CDATA () const |
Queries whether this represents text using a CDATA section. | |
void | SetCDATA (bool _cdata) |
Turns on or off a CDATA representation of text. | |
virtual const char * | Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding) |
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 bool | Accept (TiXmlVisitor *content) const |
Protected Member Functions | |
virtual TiXmlNode * | Clone () const |
[internal use] Creates a new Element and returns it. | |
void | CopyTo (TiXmlText *target) const |
bool | Blank () const |
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 1213 of file tinyxml.h.
: TiXmlNode (TiXmlNode::TINYXML_TEXT) { SetValue( initValue ); cdata = false; }
TiXmlText::TiXmlText | ( | const TiXmlText & | copy | ) | [inline] |
Definition at line 1229 of file tinyxml.h.
: TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); }
bool TiXmlText::Accept | ( | TiXmlVisitor * | content | ) | const [virtual] |
Walk the XML tree visiting this node and all of its children.
Implements TiXmlNode.
Definition at line 1314 of file tinyxml.cpp.
{ return visitor->Visit( *this ); }
bool TiXmlText::Blank | ( | ) | const [protected] |
Definition at line 1628 of file tinyxmlparser.cpp.
{ for ( unsigned i=0; i<value.length(); i++ ) if ( !IsWhiteSpace( value[i] ) ) return false; return true; }
bool TiXmlText::CDATA | ( | ) | const [inline] |
TiXmlNode * TiXmlText::Clone | ( | ) | const [protected, virtual] |
void TiXmlText::CopyTo | ( | TiXmlText * | target | ) | const [protected] |
Definition at line 1307 of file tinyxml.cpp.
{ TiXmlNode::CopyTo( target ); target->cdata = cdata; }
void TiXmlText::operator= | ( | const TiXmlText & | base | ) | [inline] |
const char * TiXmlText::Parse | ( | const char * | p, |
TiXmlParsingData * | data, | ||
TiXmlEncoding | encoding | ||
) | [virtual] |
Implements TiXmlBase.
Definition at line 1495 of file tinyxmlparser.cpp.
{ 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 1286 of file tinyxml.cpp.
{ 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] |
virtual TiXmlText* TiXmlText::ToText | ( | ) | [inline, virtual] |
virtual const TiXmlText* TiXmlText::ToText | ( | ) | const [inline, virtual] |
friend class TiXmlElement [friend] |
bool TiXmlText::cdata [private] |