Crazy Eddie's GUI System
0.8.7
|
Class representing a block of attributes associated with an XML element. More...
Public Member Functions | |
XMLAttributes (void) | |
XMLAttributes constructor. | |
virtual | ~XMLAttributes (void) |
XMLAttributes Destructor. | |
void | add (const String &attrName, const String &attrValue) |
Adds an attribute to the attribute block. If the attribute value already exists, it is replaced with the new value. More... | |
void | remove (const String &attrName) |
Removes an attribute from the attribute block. More... | |
bool | exists (const String &attrName) const |
Return whether the named attribute exists within the attribute block. More... | |
size_t | getCount (void) const |
Return the number of attributes in the attribute block. More... | |
const String & | getName (size_t index) const |
Return the name of an attribute based upon its index within the attribute block. More... | |
const String & | getValue (size_t index) const |
Return the value string of an attribute based upon its index within the attribute block. More... | |
const String & | getValue (const String &attrName) const |
Return the value string for attribute attrName. More... | |
const String & | getValueAsString (const String &attrName, const String &def="") const |
Return the value of attribute attrName as a string. More... | |
bool | getValueAsBool (const String &attrName, bool def=false) const |
Return the value of attribute attrName as a boolean value. More... | |
int | getValueAsInteger (const String &attrName, int def=0) const |
Return the value of attribute attrName as a integer value. More... | |
float | getValueAsFloat (const String &attrName, float def=0.0f) const |
Return the value of attribute attrName as a floating point value. More... | |
Protected Types | |
typedef std::map< String, String, StringFastLessCompare > | AttributeMap |
Protected Attributes | |
AttributeMap | d_attrs |
Class representing a block of attributes associated with an XML element.
bool CEGUI::XMLAttributes::exists | ( | const String & | attrName | ) | const |
Return whether the named attribute exists within the attribute block.
attrName | String object holding the name of the attribute to be checked. |
size_t CEGUI::XMLAttributes::getCount | ( | void | ) | const |
Return the number of attributes in the attribute block.
const String& CEGUI::XMLAttributes::getName | ( | size_t | index | ) | const |
Return the name of an attribute based upon its index within the attribute block.
index | zero based index of the attribute whos name is to be returned. |
IllegalRequestException | thrown if index is out of range for this attribute block. |
const String& CEGUI::XMLAttributes::getValue | ( | size_t | index | ) | const |
Return the value string of an attribute based upon its index within the attribute block.
index | zero based index of the attribute whos value string is to be returned. |
IllegalRequestException | thrown if index is out of range for this attribute block. |
Return the value string for attribute attrName.
attrName | String object holding the name of the attribute whos value string is to be returned |
UnknownObjectException | thrown if no attribute named attrName is present in the attribute block. |
bool CEGUI::XMLAttributes::getValueAsBool | ( | const String & | attrName, |
bool | def = false |
||
) | const |
Return the value of attribute attrName as a boolean value.
attrName | String object holding the name of the attribute whos value is to be returned. |
def | bool value specifying the default value to be returned if attrName does not exist in the attribute block. For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms. |
IllegalRequestException | thrown if the attribute value string coul dnot be converted to the requested type. |
float CEGUI::XMLAttributes::getValueAsFloat | ( | const String & | attrName, |
float | def = 0.0f |
||
) | const |
Return the value of attribute attrName as a floating point value.
attrName | String object holding the name of the attribute whos value is to be returned. |
def | float value specifying the default value to be returned if attrName does not exist in the attribute block. For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms. |
IllegalRequestException | thrown if the attribute value string coul dnot be converted to the requested type. |
int CEGUI::XMLAttributes::getValueAsInteger | ( | const String & | attrName, |
int | def = 0 |
||
) | const |
Return the value of attribute attrName as a integer value.
attrName | String object holding the name of the attribute whos value is to be returned. |
def | integer value specifying the default value to be returned if attrName does not exist in the attribute block. For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms. |
IllegalRequestException | thrown if the attribute value string coul dnot be converted to the requested type. |
const String& CEGUI::XMLAttributes::getValueAsString | ( | const String & | attrName, |
const String & | def = "" |
||
) | const |
Return the value of attribute attrName as a string.
attrName | String object holding the name of the attribute whos value is to be returned. |
def | String object holding the default value to be returned if attrName does not exist in the attribute block. For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms. |