xmlwrapp
Lightweight C++ XML parsing library
|
The xml::attributes class is used to access all the attributes of one xml::node. More...
#include <attributes.h>
Classes | |
class | attr |
The xml::attributes::attr class is used to hold information about one attribute. More... | |
class | const_iterator |
Const Iterator class for accessing attribute pairs. More... | |
class | iterator |
Iterator class for accessing attribute pairs. More... | |
Public Types | |
typedef std::size_t | size_type |
size type More... | |
Public Member Functions | |
attributes () | |
Create a new xml::attributes object with no attributes. More... | |
attributes (const attributes &other) | |
Copy construct a xml::attributes object. More... | |
attributes & | operator= (const attributes &other) |
Copy the given xml::attributes object into this one. More... | |
void | swap (attributes &other) |
Swap this xml::attributes object with another one. More... | |
iterator | begin () |
Get an iterator that points to the first attribute. More... | |
const_iterator | begin () const |
Get a const_iterator that points to the first attribute. More... | |
iterator | end () |
Get an iterator that points one past the the last attribute. More... | |
const_iterator | end () const |
Get a const_iterator that points one past the last attribute. More... | |
void | insert (const char *name, const char *value) |
Add an attribute to the attributes list. More... | |
iterator | find (const char *name) |
Find the attribute with the given name. More... | |
const_iterator | find (const char *name) const |
Find the attribute with the given name. More... | |
iterator | erase (iterator to_erase) |
Erase the attribute that is pointed to by the given iterator. More... | |
void | erase (const char *name) |
Erase the attribute with the given name. More... | |
bool | empty () const |
Find out if there are any attributes in this xml::attributes object. More... | |
size_type | size () const |
Find out how many attributes there are in this xml::attributes object. More... | |
The xml::attributes class is used to access all the attributes of one xml::node.
You can add, find and erase attributes by name, and for some member functions, use the provided iterator classes.
The iterator classes allow you to access one XML attribute. This is done using the xml::attributes::attr class interface.
typedef std::size_t xml::attributes::size_type |
size type
xml::attributes::attributes | ( | ) |
Create a new xml::attributes object with no attributes.
xml::attributes::attributes | ( | const attributes & | other | ) |
Copy construct a xml::attributes object.
other | The xml::attributes object to copy from. |
iterator xml::attributes::begin | ( | ) |
Get an iterator that points to the first attribute.
const_iterator xml::attributes::begin | ( | ) | const |
Get a const_iterator that points to the first attribute.
bool xml::attributes::empty | ( | ) | const |
Find out if there are any attributes in this xml::attributes object.
iterator xml::attributes::end | ( | ) |
Get an iterator that points one past the the last attribute.
const_iterator xml::attributes::end | ( | ) | const |
Get a const_iterator that points one past the last attribute.
Erase the attribute that is pointed to by the given iterator.
This will invalidate any iterators for this attribute, as well as any pointers or references to it.
to_erase | An iterator that points to the attribute to erased. |
void xml::attributes::erase | ( | const char * | name | ) |
Erase the attribute with the given name.
This will invalidate any iterators that are pointing to that attribute, as well as any pointers or references to that attribute.
name | The name of the attribute to erase. |
iterator xml::attributes::find | ( | const char * | name | ) |
Find the attribute with the given name.
If the attribute is not found on the current node, the DTD will be searched for a default value. This is, of course, if there was a DTD parsed with the XML document.
name | The name of the attribute to find. |
const_iterator xml::attributes::find | ( | const char * | name | ) | const |
Find the attribute with the given name.
If the attribute is not found on the current node, the DTD will be searched for a default value. This is, of course, if there was a DTD parsed with the XML document.
name | The name of the attribute to find. |
void xml::attributes::insert | ( | const char * | name, |
const char * | value | ||
) |
Add an attribute to the attributes list.
If there is another attribute with the same name, it will be replaced with this one.
name | The name of the attribute to add. |
value | The value of the attribute to add. |
attributes& xml::attributes::operator= | ( | const attributes & | other | ) |
Copy the given xml::attributes object into this one.
other | The xml::attributes object to copy from. |
size_type xml::attributes::size | ( | ) | const |
Find out how many attributes there are in this xml::attributes object.
void xml::attributes::swap | ( | attributes & | other | ) |
Swap this xml::attributes object with another one.
other | The other xml::attributes object to swap with. |