Interface for XML attributes. More...
#include <easyxml.hxx>
Public Member Functions | |
XMLAttributes () | |
Constructor. | |
virtual | ~XMLAttributes () |
Destructor. | |
virtual int | size () const =0 |
Get the number of attributes present. | |
virtual const char * | getName (int i) const =0 |
Get the name of an attribute by index. | |
virtual const char * | getValue (int i) const =0 |
Get the string value of an attribute by index. | |
virtual int | findAttribute (const char *name) const |
Look up the index of an attribute by name. | |
virtual bool | hasAttribute (const char *name) const |
Test whether an attribute is present. | |
virtual const char * | getValue (const char *name) const |
Look up the value of an attribute by name. |
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.
Definition at line 33 of file easyxml.hxx.
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.
name | The name of the attribute. |
Definition at line 34 of file easyxml.cxx.
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.
i | The index of the attribute (zero-based). |
Implemented in XMLAttributesDefault.
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 *).
name | The name of the attribute to look up. |
Definition at line 51 of file easyxml.cxx.
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.
i | The index of the attribute (zero-based). |
Implemented in XMLAttributesDefault.
bool XMLAttributes::hasAttribute | ( | const char * | name | ) | const [virtual] |
Test whether an attribute is present.
name | The name of the attribute. |
Definition at line 45 of file easyxml.cxx.
virtual int XMLAttributes::size | ( | ) | const [pure virtual] |
Get the number of attributes present.
Implemented in XMLAttributesDefault.