XML attribute.
More...
#include <Xml.h>
List of all members.
Public Member Functions |
| | Attr (XmlTree *xml, const std::string &name, const std::string &value) |
| | Constructs an XML attribute named name with the value value.
|
| | operator const std::string & () const |
| | Returns an empty string for a non-existent attribute.
|
| template<typename T > |
| Attr & | operator= (const T &val) |
| | Assigns the Attr a new value, and creates it if it doesn't exist. The equivalent of calling setAttribute( this->getName(), toString( newValue ) ).
|
| bool | operator== (const char *rhs) const |
| bool | operator== (const std::string &rhs) const |
| bool | operator!= (const char *rhs) const |
| bool | operator!= (const std::string &rhs) const |
| template<typename T > |
| T | as () const |
| | Returns the value of the attribute cast to T using ci::fromString().
|
| bool | empty () const |
| | Returns true if the Attr value is empty.
|
| const std::string & | getName () const |
| | Returns the name of the attribute as a string.
|
| std::string | getValue () const |
| | Returns the value of the attribute as a string.
|
| template<typename T > |
| T | getValue () const |
| | Returns the value of the attribute parsed as a T. Requires T to support the istream>> operator.
float size = myAttr.getValue<float>( "size" );
|
| void | setValue (const std::string &value) |
| template<typename T > |
| void | setValue (const T &value) |
Detailed Description
Constructor & Destructor Documentation
Constructs an XML attribute named name with the value value.
Member Function Documentation
| cinder::XmlTree::Attr::operator const std::string & |
( |
| ) |
const |
Returns an empty string for a non-existent attribute.
template<typename T >
| Attr& cinder::XmlTree::Attr::operator= |
( |
const T & |
val | ) |
|
Assigns the Attr a new value, and creates it if it doesn't exist. The equivalent of calling setAttribute( this->getName(), toString( newValue ) ).
| bool cinder::XmlTree::Attr::operator== |
( |
const char * |
rhs | ) |
const |
| bool cinder::XmlTree::Attr::operator== |
( |
const std::string & |
rhs | ) |
const |
| bool cinder::XmlTree::Attr::operator!= |
( |
const char * |
rhs | ) |
const |
| bool cinder::XmlTree::Attr::operator!= |
( |
const std::string & |
rhs | ) |
const |
Returns true if the Attr value is empty.
Returns the name of the attribute as a string.
Returns the value of the attribute as a string.
Returns the value of the attribute parsed as a T. Requires T to support the istream>> operator.
float size = myAttr.getValue<float>( "size" );
Sets the value of the attribute to value.
Sets the value of the attribute to value, which is cast to a string first. Requires T to support the ostream<< operator.
The documentation for this class was generated from the following file: