CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes | Friends

TiXmlText Class Reference

#include <tinyxml.h>

Inheritance diagram for TiXmlText:
TiXmlNode TiXmlNode TiXmlBase TiXmlBase TiXmlBase TiXmlBase

List of all members.

Public Member Functions

virtual bool Accept (TiXmlVisitor *content) const
virtual bool Accept (TiXmlVisitor *content) const
bool CDATA () const
 Queries whether this represents text using a CDATA section.
bool CDATA () const
 Queries whether this represents text using a CDATA section.
void operator= (const TiXmlText &base)
TiXmlTextoperator= (const TiXmlText &base)
virtual const char * Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual const char * Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual void Print (FILE *cfile, int depth) const
virtual void Print (FILE *cfile, int depth) const
void SetCDATA (bool _cdata)
 Turns on or off a CDATA representation of text.
void SetCDATA (bool _cdata)
 Turns on or off a CDATA representation of text.
 TiXmlText (const TiXmlText &copy)
 TiXmlText (const char *initValue)
 TiXmlText (const TiXmlText &copy)
 TiXmlText (const std::string &initValue)
 Constructor.
 TiXmlText (const char *initValue)
 TiXmlText (const std::string &initValue)
 Constructor.
virtual TiXmlTextToText ()
 Cast to a more defined type. Will return null not of the requested type.
virtual const TiXmlTextToText () const
 Cast to a more defined type. Will return null not of the requested type.
virtual const TiXmlTextToText () const
 Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlTextToText ()
 Cast to a more defined type. Will return null not of the requested type.
virtual ~TiXmlText ()
virtual ~TiXmlText ()

Protected Member Functions

bool Blank () const
bool Blank () const
virtual TiXmlNodeClone () const
 [internal use] Creates a new Element and returns it.
virtual TiXmlNodeClone () const
 [internal use] Creates a new Element and returns it.
void CopyTo (TiXmlText *target) const
void CopyTo (TiXmlText *target) const
virtual void StreamIn (std::istream *in, TIXML_STRING *tag)
virtual void StreamIn (std::istream *in, TIXML_STRING *tag)

Private Attributes

bool cdata

Friends

class TiXmlElement

Detailed Description

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().

Definition at line 1207 of file tinyxml.h.


Constructor & Destructor Documentation

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;
        }
virtual TiXmlText::~TiXmlText ( ) [inline, virtual]

Definition at line 1220 of file tinyxml.h.

{}
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]

Definition at line 1231 of file tinyxml.h.

References CopyTo().

: TiXmlNode( TiXmlNode::TEXT )  { copy.CopyTo( this ); }
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 1147 of file tinyxml.h.

References cdata, and TiXmlNode::SetValue().

                                            : TiXmlNode (TiXmlNode::TEXT)
        {
                SetValue( initValue );
                cdata = false;
        }
virtual TiXmlText::~TiXmlText ( ) [inline, virtual]

Definition at line 1152 of file tinyxml.h.

{}
TiXmlText::TiXmlText ( const std::string &  initValue) [inline]

Constructor.

Definition at line 1155 of file tinyxml.h.

References cdata, and TiXmlNode::SetValue().

                                                : TiXmlNode (TiXmlNode::TEXT)
        {
                SetValue( initValue );
                cdata = false;
        }
TiXmlText::TiXmlText ( const TiXmlText copy) [inline]

Definition at line 1161 of file tinyxml.h.

References CopyTo().

: TiXmlNode( TiXmlNode::TEXT )  { copy.CopyTo( this ); }

Member Function Documentation

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 );
}
virtual bool TiXmlText::Accept ( TiXmlVisitor content) const [virtual]

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

Implements TiXmlNode.

bool TiXmlText::Blank ( ) const [protected]

Definition at line 1645 of file tinyxmlparser.cc.

References i, TiXmlBase::IsWhiteSpace(), and TiXmlNode::value.

Referenced by TiXmlElement::ReadValue().

{
        for ( unsigned i=0; i<value.length(); i++ )
                if ( !IsWhiteSpace( value[i] ) )
                        return false;
        return true;
}
bool TiXmlText::Blank ( ) const [protected]
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; }
bool TiXmlText::CDATA ( ) const [inline]

Queries whether this represents text using a CDATA section.

Definition at line 1168 of file tinyxml.h.

References cdata.

{ return cdata; }
TiXmlNode * TiXmlText::Clone ( ) const [protected, virtual]

[internal use] Creates a new Element and returns it.

Implements TiXmlNode.

Definition at line 1386 of file tinyxml.cc.

References clone(), CopyTo(), and TiXmlText().

{
        TiXmlText* clone = 0;
        clone = new TiXmlText( "" );

        if ( !clone )
                return 0;

        CopyTo( clone );
        return clone;
}
virtual TiXmlNode* TiXmlText::Clone ( ) const [protected, virtual]

[internal use] Creates a new Element and returns it.

Implements TiXmlNode.

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;
}
void TiXmlText::CopyTo ( TiXmlText target) const [protected]
void TiXmlText::operator= ( const TiXmlText base) [inline]

Definition at line 1162 of file tinyxml.h.

References CopyTo().

{ base.CopyTo( this ); }
TiXmlText& TiXmlText::operator= ( const TiXmlText base) [inline]

Definition at line 1232 of file tinyxml.h.

References CopyTo().

{ base.CopyTo( this ); return *this;}
virtual const char* TiXmlText::Parse ( const char *  p,
TiXmlParsingData data,
TiXmlEncoding  encoding 
) [virtual]

Implements TiXmlBase.

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

Implements TiXmlBase.

Definition at line 1512 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() );
        }
}
virtual 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.

void TiXmlText::SetCDATA ( bool  _cdata) [inline]

Turns on or off a CDATA representation of text.

Definition at line 1170 of file tinyxml.h.

References cdata.

{ cdata = _cdata; }
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 void TiXmlText::StreamIn ( std::istream *  in,
TIXML_STRING *  tag 
) [protected, virtual]

Implements TiXmlNode.

virtual const TiXmlText* TiXmlText::ToText ( ) const [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1244 of file tinyxml.h.

virtual TiXmlText* TiXmlText::ToText ( ) [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1245 of file tinyxml.h.

virtual TiXmlText* TiXmlText::ToText ( ) [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1175 of file tinyxml.h.

virtual const TiXmlText* TiXmlText::ToText ( ) const [inline, virtual]

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

Reimplemented from TiXmlNode.

Definition at line 1174 of file tinyxml.h.


Friends And Related Function Documentation

TiXmlElement [friend]

Reimplemented from TiXmlNode.

Definition at line 1209 of file tinyxml.h.


Member Data Documentation

bool TiXmlText::cdata [private]

Definition at line 1263 of file tinyxml.h.

Referenced by CDATA(), CopyTo(), Parse(), Print(), SetCDATA(), and TiXmlText().