XMLAttributes Class Reference

Interface for XML attributes. More...

#include <easyxml.hxx>

Inheritance diagram for XMLAttributes:
XMLAttributesDefault

List of all members.

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.

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

Definition at line 33 of file easyxml.hxx.


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:
name The 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.

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.

Parameters:
i The index of the attribute (zero-based).
See also:
size

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

Parameters:
name The 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.

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.

Parameters:
i The index of the attribute (zero-based).
See also:
size

Implemented in XMLAttributesDefault.

bool XMLAttributes::hasAttribute ( const char *  name  )  const [virtual]

Test whether an attribute is present.

Parameters:
name The name of the attribute.
Returns:
true if an attribute with the specified name is present in the attribute list, false otherwise.

Definition at line 45 of file easyxml.cxx.

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.


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

Generated on 23 Feb 2010 for SimGear by  doxygen 1.6.1