Added xml_attribute::set_value overloads
git-svn-id: http://pugixml.googlecode.com/svn/trunk@127 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
3a9e08becd
commit
01d8a24051
@ -1875,31 +1875,25 @@ namespace pugi
|
|||||||
|
|
||||||
xml_attribute& xml_attribute::operator=(int rhs)
|
xml_attribute& xml_attribute::operator=(int rhs)
|
||||||
{
|
{
|
||||||
char buf[128];
|
set_value(rhs);
|
||||||
sprintf(buf, "%d", rhs);
|
|
||||||
set_value(buf);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml_attribute& xml_attribute::operator=(unsigned int rhs)
|
xml_attribute& xml_attribute::operator=(unsigned int rhs)
|
||||||
{
|
{
|
||||||
char buf[128];
|
set_value(rhs);
|
||||||
sprintf(buf, "%u", rhs);
|
|
||||||
set_value(buf);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml_attribute& xml_attribute::operator=(double rhs)
|
xml_attribute& xml_attribute::operator=(double rhs)
|
||||||
{
|
{
|
||||||
char buf[128];
|
set_value(rhs);
|
||||||
sprintf(buf, "%g", rhs);
|
|
||||||
set_value(buf);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml_attribute& xml_attribute::operator=(bool rhs)
|
xml_attribute& xml_attribute::operator=(bool rhs)
|
||||||
{
|
{
|
||||||
set_value(rhs ? "true" : "false");
|
set_value(rhs);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1925,6 +1919,32 @@ namespace pugi
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool xml_attribute::set_value(int rhs)
|
||||||
|
{
|
||||||
|
char buf[128];
|
||||||
|
sprintf(buf, "%d", rhs);
|
||||||
|
return set_value(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xml_attribute::set_value(unsigned int rhs)
|
||||||
|
{
|
||||||
|
char buf[128];
|
||||||
|
sprintf(buf, "%u", rhs);
|
||||||
|
return set_value(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xml_attribute::set_value(double rhs)
|
||||||
|
{
|
||||||
|
char buf[128];
|
||||||
|
sprintf(buf, "%g", rhs);
|
||||||
|
return set_value(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xml_attribute::set_value(bool rhs)
|
||||||
|
{
|
||||||
|
return set_value(rhs ? "true" : "false");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
bool operator&&(const xml_attribute& lhs, bool rhs)
|
bool operator&&(const xml_attribute& lhs, bool rhs)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -583,6 +583,38 @@ namespace pugi
|
|||||||
*/
|
*/
|
||||||
bool set_value(const char* rhs);
|
bool set_value(const char* rhs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set attribute value to \a rhs.
|
||||||
|
*
|
||||||
|
* \param rhs - new attribute value
|
||||||
|
* \return success flag (call fails if attribute is empty or there is not enough memory)
|
||||||
|
*/
|
||||||
|
bool set_value(int rhs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set attribute value to \a rhs.
|
||||||
|
*
|
||||||
|
* \param rhs - new attribute value
|
||||||
|
* \return success flag (call fails if attribute is empty or there is not enough memory)
|
||||||
|
*/
|
||||||
|
bool set_value(unsigned int rhs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set attribute value to \a rhs.
|
||||||
|
*
|
||||||
|
* \param rhs - new attribute value
|
||||||
|
* \return success flag (call fails if attribute is empty or there is not enough memory)
|
||||||
|
*/
|
||||||
|
bool set_value(double rhs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set attribute value to either 'true' or 'false' (depends on whether \a rhs is true or false).
|
||||||
|
*
|
||||||
|
* \param rhs - new attribute value
|
||||||
|
* \return success flag (call fails if attribute is empty or there is not enough memory)
|
||||||
|
*/
|
||||||
|
bool set_value(bool rhs);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Check if attribute is empty.
|
* Check if attribute is empty.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user