pugi::xml_attribute Class Reference

Collaboration diagram for pugi::xml_attribute:

Collaboration graph
[legend]
List of all members.

Detailed Description

A light-weight wrapper for manipulating attributes in DOM tree.

Note: xml_attribute does not allocate any memory for the attribute it wraps; it only wraps a pointer to existing attribute.


Public Member Functions

 xml_attribute ()
 Default ctor.
 operator unspecified_bool_type () const
 Safe bool conversion.
bool operator! () const
bool operator== (const xml_attribute &r) const
 Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
bool operator!= (const xml_attribute &r) const
 Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
bool operator< (const xml_attribute &r) const
 Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
bool operator> (const xml_attribute &r) const
 Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
bool operator<= (const xml_attribute &r) const
 Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
bool operator>= (const xml_attribute &r) const
 Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
xml_attribute next_attribute () const
 Get next attribute in attribute list of node that contains the attribute.
xml_attribute previous_attribute () const
 Get previous attribute in attribute list of node that contains the attribute.
int as_int () const
 Cast attribute value as int.
unsigned int as_uint () const
 Cast attribute value as unsigned int.
double as_double () const
 Cast attribute value as double.
float as_float () const
 Cast attribute value as float.
bool as_bool () const
 Cast attribute value as bool.
unsigned int document_order () const
xml_attributeoperator= (const char *rhs)
 Set attribute value to rhs.
xml_attributeoperator= (int rhs)
 Set attribute value to rhs.
xml_attributeoperator= (unsigned int rhs)
 Set attribute value to rhs.
xml_attributeoperator= (double rhs)
 Set attribute value to rhs.
xml_attributeoperator= (bool rhs)
 Set attribute value to either 'true' or 'false' (depends on whether rhs is true or false).
bool set_name (const char *rhs)
 Set attribute name to rhs.
bool set_value (const char *rhs)
 Set attribute value to rhs.
bool set_value (int rhs)
 Set attribute value to rhs.
bool set_value (unsigned int rhs)
 Set attribute value to rhs.
bool set_value (double rhs)
 Set attribute value to rhs.
bool set_value (bool rhs)
 Set attribute value to either 'true' or 'false' (depends on whether rhs is true or false).
bool empty () const
 Check if attribute is empty.
const char * name () const
 Get attribute name.
const char * value () const
 Get attribute value.

Friends

class xml_attribute_iterator
class xml_node


Constructor & Destructor Documentation

pugi::xml_attribute::xml_attribute  ) 
 

Default ctor.

Constructs an empty attribute.


Member Function Documentation

pugi::xml_attribute::operator unspecified_bool_type  )  const
 

Safe bool conversion.

Allows xml_node to be used in a context where boolean variable is expected, such as 'if (node)'.

bool pugi::xml_attribute::operator== const xml_attribute r  )  const
 

Compare wrapped pointer to the attribute to the pointer that is wrapped by r.

Parameters:
r - value to compare to
Returns:
comparison result

bool pugi::xml_attribute::operator!= const xml_attribute r  )  const
 

Compare wrapped pointer to the attribute to the pointer that is wrapped by r.

Parameters:
r - value to compare to
Returns:
comparison result

bool pugi::xml_attribute::operator< const xml_attribute r  )  const
 

Compare wrapped pointer to the attribute to the pointer that is wrapped by r.

Parameters:
r - value to compare to
Returns:
comparison result

bool pugi::xml_attribute::operator> const xml_attribute r  )  const
 

Compare wrapped pointer to the attribute to the pointer that is wrapped by r.

Parameters:
r - value to compare to
Returns:
comparison result

bool pugi::xml_attribute::operator<= const xml_attribute r  )  const
 

Compare wrapped pointer to the attribute to the pointer that is wrapped by r.

Parameters:
r - value to compare to
Returns:
comparison result

bool pugi::xml_attribute::operator>= const xml_attribute r  )  const
 

Compare wrapped pointer to the attribute to the pointer that is wrapped by r.

Parameters:
r - value to compare to
Returns:
comparison result

xml_attribute pugi::xml_attribute::next_attribute  )  const
 

Get next attribute in attribute list of node that contains the attribute.

Returns:
next attribute, if any; empty attribute otherwise

xml_attribute pugi::xml_attribute::previous_attribute  )  const
 

Get previous attribute in attribute list of node that contains the attribute.

Returns:
previous attribute, if any; empty attribute otherwise

int pugi::xml_attribute::as_int  )  const
 

Cast attribute value as int.

Returns:
attribute value as int, or 0 if conversion did not succeed or attribute is empty

unsigned int pugi::xml_attribute::as_uint  )  const
 

Cast attribute value as unsigned int.

Returns:
attribute value as unsigned int, or 0 if conversion did not succeed or attribute is empty
Note:
values out of non-negative int range (usually [0, 2^31-1]) get clamped to range boundaries

double pugi::xml_attribute::as_double  )  const
 

Cast attribute value as double.

Returns:
attribute value as double, or 0.0 if conversion did not succeed or attribute is empty

float pugi::xml_attribute::as_float  )  const
 

Cast attribute value as float.

Returns:
attribute value as float, or 0.0f if conversion did not succeed or attribute is empty

bool pugi::xml_attribute::as_bool  )  const
 

Cast attribute value as bool.

Returns true for attributes with values that start with '1', 't', 'T', 'y', 'Y', returns false for other attributes.

Returns:
attribute value as bool, or false if conversion did not succeed or attribute is empty

xml_attribute& pugi::xml_attribute::operator= const char *  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
self

xml_attribute& pugi::xml_attribute::operator= int  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
self

xml_attribute& pugi::xml_attribute::operator= unsigned int  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
self

xml_attribute& pugi::xml_attribute::operator= double  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
self

xml_attribute& pugi::xml_attribute::operator= bool  rhs  ) 
 

Set attribute value to either 'true' or 'false' (depends on whether rhs is true or false).

Parameters:
rhs - new attribute value
Returns:
self

bool pugi::xml_attribute::set_name const char *  rhs  ) 
 

Set attribute name to rhs.

Parameters:
rhs - new attribute name
Returns:
success flag (call fails if attribute is empty or there is not enough memory)

bool pugi::xml_attribute::set_value const char *  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
success flag (call fails if attribute is empty or there is not enough memory)

bool pugi::xml_attribute::set_value int  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
success flag (call fails if attribute is empty or there is not enough memory)

bool pugi::xml_attribute::set_value unsigned int  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
success flag (call fails if attribute is empty or there is not enough memory)

bool pugi::xml_attribute::set_value double  rhs  ) 
 

Set attribute value to rhs.

Parameters:
rhs - new attribute value
Returns:
success flag (call fails if attribute is empty or there is not enough memory)

bool pugi::xml_attribute::set_value bool  rhs  ) 
 

Set attribute value to either 'true' or 'false' (depends on whether rhs is true or false).

Parameters:
rhs - new attribute value
Returns:
success flag (call fails if attribute is empty or there is not enough memory)

bool pugi::xml_attribute::empty  )  const
 

Check if attribute is empty.

Returns:
true if attribute is empty, false otherwise

const char* pugi::xml_attribute::name  )  const
 

Get attribute name.

Returns:
attribute name, or "" if attribute is empty

const char* pugi::xml_attribute::value  )  const
 

Get attribute value.

Returns:
attribute value, or "" if attribute is empty


Generated on Thu Sep 17 22:15:56 2009 for pugixml by  doxygen 1.4.6-NO