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

TiXmlText Class Reference

#include <tinyxml.h>

Inheritance diagram for TiXmlText:
Collaboration diagram for TiXmlText:

List of all members.

Public Member Functions

 TiXmlText (const char *initValue)
virtual ~TiXmlText ()
 TiXmlText (const TiXmlText &copy)
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 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 bool Accept (TiXmlVisitor *content) const

Protected Member Functions

virtual TiXmlNodeClone () 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

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 1205 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 1213 of file tinyxml.h.

                                            : TiXmlNode (TiXmlNode::TINYXML_TEXT)
        {
                SetValue( initValue );
                cdata = false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual TiXmlText::~TiXmlText ( ) [inline, virtual]

Definition at line 1218 of file tinyxml.h.

{}
TiXmlText::TiXmlText ( const TiXmlText copy) [inline]

Definition at line 1229 of file tinyxml.h.

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

Here is the call graph for this function:


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 1314 of file tinyxml.cpp.

{
        return visitor->Visit( *this );
}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TiXmlText::CDATA ( ) const [inline]

Queries whether this represents text using a CDATA section.

Definition at line 1236 of file tinyxml.h.

{ return cdata; }

Here is the caller graph for this function:

TiXmlNode * TiXmlText::Clone ( ) const [protected, virtual]

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

Implements TiXmlNode.

Definition at line 1320 of file tinyxml.cpp.

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

        if ( !clone )
                return 0;

        CopyTo( clone );
        return clone;
}

Here is the call graph for this function:

void TiXmlText::CopyTo ( TiXmlText target) const [protected]

Definition at line 1307 of file tinyxml.cpp.

{
        TiXmlNode::CopyTo( target );
        target->cdata = cdata;
}

Here is the caller graph for this function:

void TiXmlText::operator= ( const TiXmlText base) [inline]

Definition at line 1230 of file tinyxml.h.

{ base.CopyTo( this ); }

Here is the call graph for this function:

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;
        }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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() );
        }
}

Here is the call graph for this function:

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

Turns on or off a CDATA representation of text.

Definition at line 1238 of file tinyxml.h.

{ cdata = _cdata; }

Here is the caller graph for this function:

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 1243 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 1242 of file tinyxml.h.


Friends And Related Function Documentation

friend class TiXmlElement [friend]

Reimplemented from TiXmlNode.

Definition at line 1207 of file tinyxml.h.


Member Data Documentation

bool TiXmlText::cdata [private]

Definition at line 1261 of file tinyxml.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines