Tag Class Reference
[System]

XML tag holding a map of attributes and their values. More...

#include <Tag.hpp>

List of all members.

Public Types

typedef map< string, string >
::iterator 
iterator

Public Member Functions

 Tag ()
 Tag (const string &name)
iterator begin ()
void clear ()
iterator end ()
bool get (const string &key, bool &value, bool required=true) const
bool get (const string &key, char &value, bool required=true) const
bool get (const string &key, float &value, bool required=true) const
bool get (const string &key, float value[4], bool required=true) const
bool get (const string &key, Vector &value, bool required=true) const
bool get (const string &key, int &value, bool required=true) const
bool get (const string &key, string &value, bool required=true, bool lowercase=true) const
string getLocation () const
int getLine () const
string getFilename () const
string getName () const
bool hasAttribute (const string &name) const
bool isClosing () const
bool isLeaf () const
string & operator[] (const string &key)
string operator[] (const string &key) const
void setClosing (bool leaf)
void setLeaf (bool leaf)
void setLine (int line)
void setName (const string &name)
void setFilename (const string &filename)

Static Public Member Functions

static string toLocation (string filename, int line)

Protected Member Functions

void error (string key) const
void error (string key, string type) const

Private Attributes

bool closing
bool leaf
int line
map< string, string > attributes
string filename
string name

Friends

ostream & operator<< (ostream &stream, const Tag &tag)

Detailed Description

XML tag holding a map of attributes and their values.


Constructor & Destructor Documentation

Tag (  ) 

Creates an empty tag.

Tag ( const string &  name  ) 

Creates a tag named name.


Member Function Documentation

void clear (  ) 

Resets the tag to an empty state.

void error ( string  key,
string  type 
) const [protected]
Exceptions:
Exception if attribute key can't be converted to a type.
void error ( string  key  )  const [protected]
Exceptions:
Exception if tag doesn't have an attribute named key.
bool get ( const string &  key,
string &  value,
bool  required = true,
bool  lowercase = true 
) const

Gets the value of an attribute as a string.

Parameters:
key Name of the attribute.
value String to store the value in.
required If attribute is not found, throw an error.
lowercase True if the value should be converted to lowercase.
bool get ( const string &  key,
int &  value,
bool  required = true 
) const

Gets the value of an attribute as an integer.

bool get ( const string &  key,
float  value[4],
bool  required = true 
) const

Gets the value of a four-value float array.

bool get ( const string &  key,
float &  value,
bool  required = true 
) const

Gets the value of an attribute as a float.

bool get ( const string &  key,
char &  value,
bool  required = true 
) const

Gets the value of an attribute as a character.

bool get ( const string &  key,
bool &  value,
bool  required = true 
) const

Gets the value of an attribute as a boolean.

string getLocation (  )  const
Returns:
String describing the location of the tag in the file.
bool hasAttribute ( const string &  name  )  const
Returns:
True if the tag has an attribute named name
bool isLeaf (  )  const [inline]

Indicates if the tag was created with a trailing slash.

string operator[] ( const string &  key  )  const

Gets an attribute in the tag.

string & operator[] ( const string &  key  ) 

Gets and sets an attribute in the tag.

string toLocation ( string  filename,
int  line 
) [static]
Returns:
String describing the location of a tag in the file.

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const Tag tag 
) [friend]

Prints tag to stream.


The documentation for this class was generated from the following files:
Generated on Wed Jun 9 01:36:37 2010 for Gander by  doxygen 1.6.3