|
|
@ -150,10 +150,20 @@ namespace xml { |
|
|
|
/*! @return @c true if the value is set and not equal to one of:
|
|
|
|
/*! @return @c true if the value is set and not equal to one of:
|
|
|
|
@c false @c no @c 0. */ |
|
|
|
@c false @c no @c 0. */ |
|
|
|
Attributes::Value::operator bool() const throw() { |
|
|
|
Attributes::Value::operator bool() const throw() { |
|
|
|
return !(second.size()||second=="false"||second=="no"||second=="0"); |
|
|
|
return bool(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Convert the attribute to a boolean.
|
|
|
|
|
|
|
|
/*! @return @c true if the value is set and not equal to one of:
|
|
|
|
|
|
|
|
@c false @c no @c 0. */ |
|
|
|
|
|
|
|
bool Attributes::Value::toBool() const throw() { |
|
|
|
|
|
|
|
return !(!second.size()||second=="false"||second=="no"||second=="0"); |
|
|
|
} |
|
|
|
} |
|
|
|
//! Convert the attribute to a number.
|
|
|
|
//! Convert the attribute to a number.
|
|
|
|
Attributes::Value::operator unsigned long() const throw() { |
|
|
|
Attributes::Value::operator unsigned long() const throw() { |
|
|
|
|
|
|
|
return toNumber(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Convert the attribute to a number.
|
|
|
|
|
|
|
|
unsigned long Attributes::Value::toNumber() const throw() { |
|
|
|
std::stringstream ss(second); |
|
|
|
std::stringstream ss(second); |
|
|
|
int i(0); |
|
|
|
int i(0); |
|
|
|
ss>>i; |
|
|
|
ss>>i; |
|
|
@ -410,8 +420,7 @@ namespace xml { |
|
|
|
@endcode |
|
|
|
@endcode |
|
|
|
If a factory reads from a stream and the specified attribute is |
|
|
|
If a factory reads from a stream and the specified attribute is |
|
|
|
not given, it is set to @c deflt. */ |
|
|
|
not given, it is set to @c deflt. */ |
|
|
|
Node& Node::attr(const std::string& name, const std::string& deflt) |
|
|
|
Node& Node::attr(const std::string& name, const std::string& deflt) throw() { |
|
|
|
throw() { |
|
|
|
|
|
|
|
_attributes[name] = deflt; |
|
|
|
_attributes[name] = deflt; |
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
|