Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
XMLAttributes Class Referenceabstract

#include <easyxml.hpp>

Inheritance diagram for XMLAttributes:
ExpatAtts XMLAttributesDefault

Public Member Functions

 XMLAttributes ()
 Constructor.
 
virtual ~XMLAttributes ()
 Destructor.
 
virtual int size () const =0
 
virtual const char * getName (int i) const =0
 
virtual const char * getValue (int i) const =0
 
virtual int findAttribute (const char *name) const
 
virtual bool hasAttribute (const char *name) const
 
virtual const char * getValue (const char *name) const
 

Detailed Description

Interface for XML attributes.

This interface is used to provide a list of attributes to the application. The interface is a pure abstract class so that different implementations can be substituted for the sake of efficiency.

See Also
XMLAttributesDefault

Member Function Documentation

int XMLAttributes::findAttribute ( const char *  name) const
virtual

Look up the index of an attribute by name.

Attribute names must be unique. This method will return an index that can be used with the getValue(const char *) method if the attribute is found.

Parameters
nameThe name of the attribute.
Returns
The index of the attribute with the name specified, or -1 if no such attribute is present in the list.
virtual const char* XMLAttributes::getName ( int  i) const
pure virtual

Get the name of an attribute by index.

The index must be less than the size of the list and greater than or equal to zero.

Parameters
iThe index of the attribute (zero-based).
See Also
size

Implemented in XMLAttributesDefault, and ExpatAtts.

virtual const char* XMLAttributes::getValue ( int  i) const
pure virtual

Get the string value of an attribute by index.

The index must be less than the size of the list and greater than or equal to zero.

Parameters
iThe index of the attribute (zero-based).
See Also
size

Implemented in XMLAttributesDefault, and ExpatAtts.

const char * XMLAttributes::getValue ( const char *  name) const
virtual

Look up the value of an attribute by name.

This method provides a convenient short-cut to invoking findAttribute and getValue(const char *).

Parameters
nameThe name of the attribute to look up.
Returns
The attribute's value as a string, or 0 if no attribute was found with the name specified.
bool XMLAttributes::hasAttribute ( const char *  name) const
virtual

Test whether an attribute is present.

Parameters
nameThe name of the attribute.
Returns
true if an attribute with the specified name is present in the attribute list, false otherwise.
virtual int XMLAttributes::size ( ) const
pure virtual

Get the number of attributes present.

Returns
The number of attributes in the list (may be 0).

Implemented in XMLAttributesDefault, and ExpatAtts.


The documentation for this class was generated from the following files: