#include <tinyxml.h>
Inheritance diagram for TiXmlText:

Public Member Functions | |
| TiXmlText (const char *initValue) | |
| virtual | ~TiXmlText () |
| TiXmlText (const std::string &initValue) | |
| Constructor. | |
| 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 |
| virtual void | StreamIn (std::istream *in, TIXML_STRING *tag) |
Private Attributes | |
| bool | cdata |
Friends | |
| class | TiXmlElement |
Definition at line 1183 of file tinyxml.h.
|
|
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 1191 of file tinyxml.h. References cdata, and TiXmlNode::SetValue(). Referenced by Clone(). 01191 : TiXmlNode (TiXmlNode::TEXT) 01192 { 01193 SetValue( initValue ); 01194 cdata = false; 01195 }
|
|
|
Definition at line 1196 of file tinyxml.h. 01196 {}
|
|
|
Constructor.
Definition at line 1200 of file tinyxml.h. References cdata, and TiXmlNode::SetValue(). 01200 : TiXmlNode (TiXmlNode::TEXT) 01201 { 01202 SetValue( initValue ); 01203 cdata = false; 01204 }
|
|
|
Definition at line 1207 of file tinyxml.h. References CopyTo().
|
|
|
Walk the XML tree visiting this node and all of its children. Implements TiXmlNode. Definition at line 1345 of file tinyxml.cpp. References TiXmlVisitor::Visit(). 01346 {
01347 return visitor->Visit( *this );
01348 }
|
|
|
Definition at line 1599 of file tinyxmlparser.cpp. References TiXmlBase::IsWhiteSpace(). Referenced by TiXmlElement::ReadValue(). 01600 {
01601 for ( unsigned i=0; i<value.length(); i++ )
01602 if ( !IsWhiteSpace( value[i] ) )
01603 return false;
01604 return true;
01605 }
|
|
|
Queries whether this represents text using a CDATA section.
Definition at line 1214 of file tinyxml.h. Referenced by TiXmlPrinter::Visit(), and TiXmlPrinter::VisitEnter(). 01214 { return cdata; }
|
|
|
[internal use] Creates a new Element and returns it.
Implements TiXmlNode. Definition at line 1351 of file tinyxml.cpp. References CopyTo(), and TiXmlText(). 01352 {
01353 TiXmlText* clone = 0;
01354 clone = new TiXmlText( "" );
01355
01356 if ( !clone )
01357 return 0;
01358
01359 CopyTo( clone );
01360 return clone;
01361 }
|
|
|
Definition at line 1338 of file tinyxml.cpp. References cdata, and TiXmlNode::CopyTo(). Referenced by Clone(), operator=(), and TiXmlText(). 01339 {
01340 TiXmlNode::CopyTo( target );
01341 target->cdata = cdata;
01342 }
|
|
|
Definition at line 1208 of file tinyxml.h. References base, and CopyTo().
|
|
||||||||||||||||
|
Implements TiXmlBase. Definition at line 1466 of file tinyxmlparser.cpp. References cdata, TiXmlParsingData::Cursor(), TiXmlNode::GetDocument(), TiXmlBase::ReadText(), TiXmlDocument::SetError(), TiXmlParsingData::Stamp(), TiXmlBase::StringEqual(), and TIXML_STRING. Referenced by TiXmlElement::ReadValue(). 01467 {
01468 value = "";
01469 TiXmlDocument* document = GetDocument();
01470
01471 if ( data )
01472 {
01473 data->Stamp( p, encoding );
01474 location = data->Cursor();
01475 }
01476
01477 const char* const startTag = "<![CDATA[";
01478 const char* const endTag = "]]>";
01479
01480 if ( cdata || StringEqual( p, startTag, false, encoding ) )
01481 {
01482 cdata = true;
01483
01484 if ( !StringEqual( p, startTag, false, encoding ) )
01485 {
01486 document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
01487 return 0;
01488 }
01489 p += strlen( startTag );
01490
01491 // Keep all the white space, ignore the encoding, etc.
01492 while ( p && *p
01493 && !StringEqual( p, endTag, false, encoding )
01494 )
01495 {
01496 value += *p;
01497 ++p;
01498 }
01499
01500 TIXML_STRING dummy;
01501 p = ReadText( p, &dummy, false, endTag, false, encoding );
01502 return p;
01503 }
01504 else
01505 {
01506 bool ignoreWhite = true;
01507
01508 const char* end = "<";
01509 p = ReadText( p, &value, ignoreWhite, end, false, encoding );
01510 if ( p )
01511 return p-1; // don't truncate the '<'
01512 return 0;
01513 }
01514 }
|
|
||||||||||||
|
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 1317 of file tinyxml.cpp. References TiXmlBase::PutString(), and TIXML_STRING. 01318 {
01319 assert( cfile );
01320 if ( cdata )
01321 {
01322 int i;
01323 fprintf( cfile, "\n" );
01324 for ( i=0; i<depth; i++ ) {
01325 fprintf( cfile, " " );
01326 }
01327 fprintf( cfile, "<![CDATA[%s]]>\n", value.c_str() ); // unformatted output
01328 }
01329 else
01330 {
01331 TIXML_STRING buffer;
01332 PutString( value, &buffer );
01333 fprintf( cfile, "%s", buffer.c_str() );
01334 }
01335 }
|
|
|
Turns on or off a CDATA representation of text.
Definition at line 1216 of file tinyxml.h. References cdata. Referenced by TiXmlNode::Identify(). 01216 { cdata = _cdata; }
|
|
||||||||||||
|
Implements TiXmlNode. Definition at line 1435 of file tinyxmlparser.cpp. References cdata, TiXmlNode::GetDocument(), len, TiXmlDocument::SetError(), and TIXML_ENCODING_UNKNOWN. Referenced by TiXmlElement::StreamIn(). 01436 {
01437 while ( in->good() )
01438 {
01439 int c = in->peek();
01440 if ( !cdata && (c == '<' ) )
01441 {
01442 return;
01443 }
01444 if ( c <= 0 )
01445 {
01446 TiXmlDocument* document = GetDocument();
01447 if ( document )
01448 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
01449 return;
01450 }
01451
01452 (*tag) += (char) c;
01453 in->get(); // "commits" the peek made above
01454
01455 if ( cdata && c == '>' && tag->size() >= 3 ) {
01456 size_t len = tag->size();
01457 if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) {
01458 // terminator of cdata.
01459 return;
01460 }
01461 }
01462 }
01463 }
|
|
|
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from TiXmlNode. |
|
|
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from TiXmlNode. |
|
|
Reimplemented from TiXmlNode. |
|
|
Definition at line 1239 of file tinyxml.h. Referenced by CopyTo(), Parse(), SetCDATA(), StreamIn(), and TiXmlText(). |
1.3.9.1