MIRA
|
Iterator for iterating over xml nodes that have the same parent (sibligs) More...
#include <xml/XMLDom.h>
Public Types | |
typedef std::string | value_type |
STL-conform typedefs. More... | |
typedef std::string * | pointer |
The pointer type. More... | |
typedef std::string & | reference |
The reference type. More... | |
typedef ptrdiff_t | difference_type |
The difference type. More... | |
typedef std::bidirectional_iterator_tag | iterator_category |
The iterator category. More... | |
Public Member Functions | |
sibling_iterator () | |
Default-constructor. More... | |
sibling_iterator (_xmlNode *iNode, const std::string &name="") | |
Constructor. More... | |
sibling_iterator (const sibling_iterator &other) | |
Copy-constructor. More... | |
bool | operator== (const sibling_iterator &other) const |
Compare two iterators. More... | |
bool | operator!= (const sibling_iterator &other) const |
Compare two iterators. More... | |
operator const_sibling_iterator () const | |
Converts this sibling_iterator to a const sibling_iterator. More... | |
const sibling_iterator & | operator= (const std::string &name) |
Change the name of this node. More... | |
sibling_iterator & | operator++ () |
Preincrement. More... | |
sibling_iterator & | operator+= (std::size_t increment) |
Increment self by given value. More... | |
sibling_iterator | operator+ (std::size_t increment) const |
Increment by given value. More... | |
sibling_iterator & | operator-- () |
Predecrement. More... | |
sibling_iterator | parent () |
Get the parent node sibling_iterator for this node. More... | |
sibling_iterator | begin () |
Get the sibling_iterator to the first sub node. More... | |
sibling_iterator | begin (const std::string &name) |
Get the sibling_iterator to the first sub node with given name. More... | |
sibling_iterator | end () |
Get the end node sibling_iterator. More... | |
sibling_iterator | find (const std::string &name, std::size_t nth=0) |
Find the nth subnode with a given name. More... | |
content_iterator | content_begin () |
Get the iterator to the first content. More... | |
content_iterator | content_end () |
Get the end content iterator. More... | |
comment_iterator | comment_begin () |
Get the iterator to the first comment. More... | |
comment_iterator | comment_end () |
Get the end comment sibling_iterator. More... | |
attribute_iterator | attribute_begin () |
Get the iterator to the first attribute. More... | |
attribute_iterator | attribute_end () |
Get the end attribute iterator. More... | |
attribute_iterator | find_attribute (const std::string &name) |
Find an attribute with the name name. More... | |
XMLDom::sibling_iterator & | add_attribute (const Attribute &attribute) |
Add an attribute to this node. More... | |
XMLDom::sibling_iterator & | add_attribute (const std::string &name, const std::string &value) |
Add an attribute to this node. More... | |
template<typename T > | |
XMLDom::sibling_iterator & | add_attribute (const std::string &name, const T &value) |
Add an attribute to this node. More... | |
template<typename T > | |
XMLDom::sibling_iterator & | add_attribute (const std::string &name, const T &value, int precision) |
Add an attribute to this node. More... | |
void | remove_attribute (attribute_iterator it) |
Removes the attribute the given iterator points on from this node, if it exists. More... | |
XMLDom::sibling_iterator & | add_comment (const std::string &comment) |
Add a comment to this node. More... | |
XMLDom::sibling_iterator & | add_content (const std::string &content) |
Add content to this node. More... | |
XMLDom::sibling_iterator & | add_cdata_content (const std::string &cdata_content) |
Add a cdata content block to this node. More... | |
XMLDom::sibling_iterator | add_child (const std::string &name, const NameSpace &ns=NameSpace()) |
Add a sub node to this node. More... | |
XMLDom::sibling_iterator | add_child (const XMLDom::const_sibling_iterator &node) |
Add a sub node to this node. More... | |
XMLDom::sibling_iterator | insert_before (const XMLDom::const_sibling_iterator &node) |
Inserts a given node before this node. More... | |
XMLDom::sibling_iterator | insert_before (const std::string &name, const NameSpace &ns=NameSpace()) |
Inserts a sub node before this node. More... | |
XMLDom::sibling_iterator | insert_after (const XMLDom::const_sibling_iterator &node) |
Inserts a given node after this node. More... | |
XMLDom::sibling_iterator | insert_after (const std::string &name, const NameSpace &ns=NameSpace()) |
Inserts a sub node after this node. More... | |
XMLDom::sibling_iterator | replace (const XMLDom::const_sibling_iterator &node) |
Replaces this node by a recursive copy of iNode. More... | |
XMLDom::sibling_iterator | replace (const std::string &name, const NameSpace &ns=NameSpace()) |
Replaces this node by new one. More... | |
XMLDom::sibling_iterator & | insert_comment_before (const XMLDom::const_comment_iterator &comment) |
Insert a comment before this node. More... | |
XMLDom::sibling_iterator & | insert_comment_before (const std::string &comment) |
Insert a comment before this node. More... | |
XMLDom::sibling_iterator & | insert_comment_after (const XMLDom::const_comment_iterator &comment) |
Insert a comment after this node. More... | |
XMLDom::sibling_iterator & | insert_comment_after (const std::string &comment) |
Insert a comment after this node. More... | |
XMLDom::sibling_iterator & | insert_content_before (const XMLDom::const_content_iterator &content) |
Insert content before this node. More... | |
XMLDom::sibling_iterator & | insert_content_before (const std::string &content) |
Insert content before this node. More... | |
XMLDom::sibling_iterator & | insert_content_after (const XMLDom::const_content_iterator &content) |
Insert content after this node. More... | |
XMLDom::sibling_iterator & | insert_content_after (const std::string &content) |
Insert content after this node. More... | |
XMLDom::sibling_iterator | replace_by_comment (const XMLDom::const_comment_iterator &node) |
Replaces this node by comment node. More... | |
XMLDom::sibling_iterator | replace_by_comment (const std::string &comment) |
Replaces this node by a comment. More... | |
XMLDom::sibling_iterator | replace_by_content (const XMLDom::const_content_iterator &node) |
Replaces this node by content node. More... | |
XMLDom::sibling_iterator | replace_by_content (const std::string &content) |
Replaces this node by content. More... | |
XMLDom::sibling_iterator | remove () |
Removes this node from the document. More... | |
std::string | operator* () const |
Dereference operator to get the name of the node. More... | |
void | setName (const std::string &name) |
Change the node's name. More... | |
std::string | uri () const |
Return the uri of the node. More... | |
void | setUri (const std::string &uri) |
Set the uri of the node. More... | |
NameSpace | nameSpace () const |
Return the namespace information of the node. More... | |
uint32 | line () const |
Gets the underlying line number of the loaded document for this node. More... | |
const_sibling_iterator | cparent () const |
Get the const parent node sibling_iterator for this node. More... | |
const_sibling_iterator | parent () const |
Get the const parent node sibling_iterator for this node. More... | |
const_sibling_iterator | cbegin () const |
Get the const sibling_iterator to the first sub node. More... | |
const_sibling_iterator | cbegin (const std::string &name) const |
Get the const sibling_same_name_iterator to the first sub node with the given name. More... | |
const_sibling_iterator | begin () const |
Get the const sibling_iterator to the first sub node. More... | |
const_sibling_iterator | begin (const std::string &name) const |
Get the const sibling_same_name_iterator to the first sub node with the given name. More... | |
const_sibling_iterator | cend () const |
Get the const end node sibling_iterator. More... | |
const_sibling_iterator | end () const |
Get the const end node sibling_iterator. More... | |
const_content_iterator | content_cbegin () const |
Get the const iterator to the first content. More... | |
const_content_iterator | content_cend () const |
Get the const end content iterator. More... | |
const_content_iterator | content_begin () const |
Get the const iterator to the first content. More... | |
const_content_iterator | content_end () const |
Get the const end content iterator. More... | |
const_comment_iterator | comment_cbegin () const |
Get the const iterator to the first comment. More... | |
const_comment_iterator | comment_cend () const |
Get the const end comment iterator. More... | |
const_comment_iterator | comment_begin () const |
Get the const iterator to the first comment. More... | |
const_comment_iterator | comment_end () const |
Get the const end comment iterator. More... | |
const_attribute_iterator | attribute_cbegin () const |
Get the const iterator to the first attribute. More... | |
const_attribute_iterator | attribute_cend () const |
Get the const end attribute iterator. More... | |
const_attribute_iterator | attribute_begin () const |
Get the const iterator to the first attribute. More... | |
const_attribute_iterator | attribute_end () const |
Get the const end attribute iterator. More... | |
const_attribute_iterator | find_attribute (const std::string &name) const |
Find an attribute with the name name. More... | |
bool | has_attribute (const std::string &name) const |
Returns true if node contains the attribute with name name. More... | |
template<typename T > | |
T | get_attribute (const std::string &name) const |
Return an attribute value cast to a given type. More... | |
template<typename T > | |
T | get_attribute (const std::string &name, const T &defaultValue) const |
Return an attribute value casted to a given type If the attribute could not be found the given default value will be returned. More... | |
Protected Attributes | |
_xmlNode * | mNode |
The node pointer. More... | |
std::string | mName |
the node name (optional) More... | |
Iterator for iterating over xml nodes that have the same parent (sibligs)
typedef std::string value_type |
STL-conform typedefs.
The value type.
typedef std::string* pointer |
The pointer type.
typedef std::string& reference |
The reference type.
typedef ptrdiff_t difference_type |
The difference type.
typedef std::bidirectional_iterator_tag iterator_category |
The iterator category.
sibling_iterator | ( | ) |
Default-constructor.
sibling_iterator | ( | _xmlNode * | iNode, |
const std::string & | name = "" |
||
) |
Constructor.
[in] | iNode | The actual node. |
|
inline |
Copy-constructor.
[in] | other | The other sibling_iterator |
|
inline |
|
inline |
|
inline |
Converts this sibling_iterator to a const sibling_iterator.
const sibling_iterator& operator= | ( | const std::string & | name | ) |
sibling_iterator& operator++ | ( | ) |
Preincrement.
sibling_iterator& operator+= | ( | std::size_t | increment | ) |
Increment self by given value.
sibling_iterator operator+ | ( | std::size_t | increment | ) | const |
Increment by given value.
sibling_iterator& operator-- | ( | ) |
Predecrement.
sibling_iterator parent | ( | ) |
Get the parent node sibling_iterator for this node.
sibling_iterator begin | ( | ) |
Get the sibling_iterator to the first sub node.
sibling_iterator begin | ( | const std::string & | name | ) |
Get the sibling_iterator to the first sub node with given name.
If the returned iterator is incremented or decremented it will move to the next/previous sibling with the same name.
[in] | name | The name of the sibling |
sibling_iterator end | ( | ) |
Get the end node sibling_iterator.
sibling_iterator find | ( | const std::string & | name, |
std::size_t | nth = 0 |
||
) |
Find the nth subnode with a given name.
The name can contain '/''s for separation of child names. In this case the DOM tree is traversed recursively. e.g. find("Node/SubNode/SubSubNode") returns an sibling_iterator to SubSubNode if exists. It returns the nth SubSubNode of the first SubNode in the first Node.)
[in] | name | The name of the node |
[in] | nth | The nth item with name will be found |
content_iterator content_begin | ( | ) |
Get the iterator to the first content.
content_iterator content_end | ( | ) |
Get the end content iterator.
comment_iterator comment_begin | ( | ) |
Get the iterator to the first comment.
comment_iterator comment_end | ( | ) |
Get the end comment sibling_iterator.
attribute_iterator attribute_begin | ( | ) |
Get the iterator to the first attribute.
attribute_iterator attribute_end | ( | ) |
Get the end attribute iterator.
attribute_iterator find_attribute | ( | const std::string & | name | ) |
Find an attribute with the name name.
[in] | name | The attribute name. |
XMLDom::sibling_iterator& add_attribute | ( | const Attribute & | attribute | ) |
Add an attribute to this node.
[in] | attribute | The attribute pair. |
XMLDom::sibling_iterator& add_attribute | ( | const std::string & | name, |
const std::string & | value | ||
) |
Add an attribute to this node.
[in] | name | The attribute name. |
[in] | value | The attribute value. |
|
inline |
Add an attribute to this node.
[in] | name | The attribute name. |
[in] | value | The attribute value. |
|
inline |
Add an attribute to this node.
[in] | name | The attribute name. |
[in] | value | The attribute value. |
[in] | precision | The precision that should be used, e.g. if the attribute is a floating point number. |
void remove_attribute | ( | attribute_iterator | it | ) |
Removes the attribute the given iterator points on from this node, if it exists.
Otherwise, does nothing. The iterator will become invalid after this operation.
XMLDom::sibling_iterator& add_comment | ( | const std::string & | comment | ) |
XMLDom::sibling_iterator& add_content | ( | const std::string & | content | ) |
XMLDom::sibling_iterator& add_cdata_content | ( | const std::string & | cdata_content | ) |
Add a cdata content block to this node.
[in] | cdata_content | The content string that will be wrapped in cdata tags. |
XMLDom::sibling_iterator add_child | ( | const std::string & | name, |
const NameSpace & | ns = NameSpace() |
||
) |
Add a sub node to this node.
[in] | name | The name of the sub node. |
XMLDom::sibling_iterator add_child | ( | const XMLDom::const_sibling_iterator & | node | ) |
Add a sub node to this node.
[in] | node | The child node to add. |
XMLDom::sibling_iterator insert_before | ( | const XMLDom::const_sibling_iterator & | node | ) |
Inserts a given node before this node.
[in] | node | The node to be inserted |
XMLDom::sibling_iterator insert_before | ( | const std::string & | name, |
const NameSpace & | ns = NameSpace() |
||
) |
Inserts a sub node before this node.
[in] | name | The name of the sub node. |
XMLDom::sibling_iterator insert_after | ( | const XMLDom::const_sibling_iterator & | node | ) |
Inserts a given node after this node.
[in] | node | The node to be inserted |
XMLDom::sibling_iterator insert_after | ( | const std::string & | name, |
const NameSpace & | ns = NameSpace() |
||
) |
Inserts a sub node after this node.
[in] | name | The name of the sub node. |
XMLDom::sibling_iterator replace | ( | const XMLDom::const_sibling_iterator & | node | ) |
Replaces this node by a recursive copy of iNode.
[in] | node | The node to copy |
XMLDom::sibling_iterator replace | ( | const std::string & | name, |
const NameSpace & | ns = NameSpace() |
||
) |
Replaces this node by new one.
[in] | name | The name of the new node. |
XMLDom::sibling_iterator& insert_comment_before | ( | const XMLDom::const_comment_iterator & | comment | ) |
Insert a comment before this node.
[in] | comment | The comment node to insert. |
XMLDom::sibling_iterator& insert_comment_before | ( | const std::string & | comment | ) |
Insert a comment before this node.
[in] | comment | The comment string. |
XMLDom::sibling_iterator& insert_comment_after | ( | const XMLDom::const_comment_iterator & | comment | ) |
Insert a comment after this node.
[in] | comment | The comment node to insert. |
XMLDom::sibling_iterator& insert_comment_after | ( | const std::string & | comment | ) |
Insert a comment after this node.
[in] | comment | The comment string. |
XMLDom::sibling_iterator& insert_content_before | ( | const XMLDom::const_content_iterator & | content | ) |
Insert content before this node.
[in] | content | The content node to insert. |
XMLDom::sibling_iterator& insert_content_before | ( | const std::string & | content | ) |
Insert content before this node.
[in] | content | The content string. |
XMLDom::sibling_iterator& insert_content_after | ( | const XMLDom::const_content_iterator & | content | ) |
Insert content after this node.
[in] | content | The content node to insert. |
XMLDom::sibling_iterator& insert_content_after | ( | const std::string & | content | ) |
Insert content after this node.
[in] | content | The content string. |
XMLDom::sibling_iterator replace_by_comment | ( | const XMLDom::const_comment_iterator & | node | ) |
Replaces this node by comment node.
[in] | node | The comment node to copy |
XMLDom::sibling_iterator replace_by_comment | ( | const std::string & | comment | ) |
Replaces this node by a comment.
[in] | comment | The comment. |
XMLDom::sibling_iterator replace_by_content | ( | const XMLDom::const_content_iterator & | node | ) |
Replaces this node by content node.
[in] | node | The content node to copy |
XMLDom::sibling_iterator replace_by_content | ( | const std::string & | content | ) |
Replaces this node by content.
[in] | content | The content. |
XMLDom::sibling_iterator remove | ( | ) |
Removes this node from the document.
|
inherited |
Dereference operator to get the name of the node.
|
inherited |
Change the node's name.
|
inherited |
Return the uri of the node.
This can be the filename of the document or a web address.
|
inherited |
Set the uri of the node.
This can be the filename of the document or a web address.
|
inherited |
Return the namespace information of the node.
|
inherited |
Gets the underlying line number of the loaded document for this node.
|
inherited |
Get the const parent node sibling_iterator for this node.
|
inlineinherited |
Get the const parent node sibling_iterator for this node.
|
inherited |
Get the const sibling_iterator to the first sub node.
|
inherited |
Get the const sibling_same_name_iterator to the first sub node with the given name.
name | The name of the sibling |
|
inlineinherited |
Get the const sibling_iterator to the first sub node.
|
inlineinherited |
Get the const sibling_same_name_iterator to the first sub node with the given name.
name | The name of the sibling |
|
inherited |
Get the const end node sibling_iterator.
|
inlineinherited |
Get the const end node sibling_iterator.
|
inherited |
Get the const iterator to the first content.
|
inherited |
Get the const end content iterator.
|
inlineinherited |
Get the const iterator to the first content.
|
inlineinherited |
Get the const end content iterator.
|
inherited |
Get the const iterator to the first comment.
|
inherited |
Get the const end comment iterator.
|
inlineinherited |
Get the const iterator to the first comment.
|
inlineinherited |
Get the const end comment iterator.
|
inherited |
Get the const iterator to the first attribute.
|
inherited |
Get the const end attribute iterator.
|
inlineinherited |
Get the const iterator to the first attribute.
|
inlineinherited |
Get the const end attribute iterator.
|
inherited |
Find an attribute with the name name.
[in] | name | The attribute name. |
|
inlineinherited |
Returns true if node contains the attribute with name name.
[in] | name | The attribute name. |
|
inlineinherited |
Return an attribute value cast to a given type.
XInvalidConfig | when the attribute could not be found |
[in] | name | The name of the attribute |
|
inlineinherited |
Return an attribute value casted to a given type If the attribute could not be found the given default value will be returned.
[in] | name | The name of the attribute |
[in] | defaultValue | The default value that will be returned if the attribute is not found |
|
protectedinherited |
The node pointer.
|
protectedinherited |
the node name (optional)