MIRA
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
XMLDom::const_sibling_iterator Class Reference

Const sibling_iterator for iterating over xml nodes that have the same parent (siblings) More...

#include <xml/XMLDom.h>

Inheritance diagram for XMLDom::const_sibling_iterator:
Inheritance graph
[legend]

Public Types

typedef std::string value_type
 The value type. More...
 
typedef const std::string * pointer
 The pointer type. More...
 
typedef const 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

 const_sibling_iterator ()
 Constructor. More...
 
 const_sibling_iterator (_xmlNode *iNode, const std::string &name="")
 Constructor. More...
 
 const_sibling_iterator (const const_sibling_iterator &other)
 Copy-constructor. More...
 
bool operator== (const const_sibling_iterator &other) const
 Compare two iterators. More...
 
bool operator!= (const const_sibling_iterator &other) const
 Compare two iterators. More...
 
const_sibling_iteratoroperator++ ()
 Preincrement. More...
 
const_sibling_iteratoroperator+= (std::size_t increment)
 Increment self by given value. More...
 
const_sibling_iterator operator+ (std::size_t increment) const
 Increment by given value. More...
 
const_sibling_iteratoroperator-- ()
 Predecrement. More...
 
const_sibling_iterator find (const std::string &name, std::size_t nth=0) const
 Find the nth subnode with a given name. 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 >
get_attribute (const std::string &name) const
 Return an attribute value cast to a given type. More...
 
template<typename 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...
 

Friends

class sibling_iterator
 STL-conform typedefs. More...
 

Detailed Description

Const sibling_iterator for iterating over xml nodes that have the same parent (siblings)

Member Typedef Documentation

◆ value_type

typedef std::string value_type

The value type.

◆ pointer

typedef const std::string* pointer

The pointer type.

◆ reference

typedef const std::string& reference

The reference type.

◆ difference_type

typedef ptrdiff_t difference_type

The difference type.

◆ iterator_category

typedef std::bidirectional_iterator_tag iterator_category

The iterator category.

Constructor & Destructor Documentation

◆ const_sibling_iterator() [1/3]

Constructor.

◆ const_sibling_iterator() [2/3]

const_sibling_iterator ( _xmlNode *  iNode,
const std::string &  name = "" 
)

Constructor.

Parameters
[in]iNodeThe actual node.

◆ const_sibling_iterator() [3/3]

Copy-constructor.

Parameters
[in]otherThe other const_sibling_iterator

Member Function Documentation

◆ operator==()

bool operator== ( const const_sibling_iterator other) const
inline

Compare two iterators.

Parameters
[in]otherThe other sibling_iterator
Returns
true if equal

◆ operator!=()

bool operator!= ( const const_sibling_iterator other) const
inline

Compare two iterators.

Parameters
[in]otherThe other sibling_iterator
Returns
true if not equal

◆ operator++()

const_sibling_iterator& operator++ ( )

Preincrement.

◆ operator+=()

const_sibling_iterator& operator+= ( std::size_t  increment)

Increment self by given value.

◆ operator+()

const_sibling_iterator operator+ ( std::size_t  increment) const

Increment by given value.

◆ operator--()

const_sibling_iterator& operator-- ( )

Predecrement.

◆ find()

const_sibling_iterator find ( const std::string &  name,
std::size_t  nth = 0 
) const

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.)

Parameters
[in]nameThe name of the node
[in]nthThe nth item with name will be found
Returns
Const sibling_iterator to found nth node or end sibling_iterator if not found

◆ operator*()

std::string operator* ( ) const
inherited

Dereference operator to get the name of the node.

Returns
Returns the node name.

◆ setName()

void setName ( const std::string &  name)
inherited

Change the node's name.

◆ uri()

std::string uri ( ) const
inherited

Return the uri of the node.

This can be the filename of the document or a web address.

Returns
The uri of the node.

◆ setUri()

void setUri ( const std::string &  uri)
inherited

Set the uri of the node.

This can be the filename of the document or a web address.

◆ nameSpace()

NameSpace nameSpace ( ) const
inherited

Return the namespace information of the node.

Returns
Namespace information

◆ line()

uint32 line ( ) const
inherited

Gets the underlying line number of the loaded document for this node.

Returns
Line number

◆ cparent()

const_sibling_iterator cparent ( ) const
inherited

Get the const parent node sibling_iterator for this node.

Returns
Const sibling_iterator to parent node

◆ parent()

const_sibling_iterator parent ( ) const
inlineinherited

Get the const parent node sibling_iterator for this node.

Returns
Const sibling_iterator to parent node

◆ cbegin() [1/2]

const_sibling_iterator cbegin ( ) const
inherited

Get the const sibling_iterator to the first sub node.

Returns
The const sibling_iterator.

◆ cbegin() [2/2]

const_sibling_iterator cbegin ( const std::string &  name) const
inherited

Get the const sibling_same_name_iterator to the first sub node with the given name.

Parameters
nameThe name of the sibling
Returns
The const sibling_same_name_iterator.

◆ begin() [1/2]

const_sibling_iterator begin ( ) const
inlineinherited

Get the const sibling_iterator to the first sub node.

Returns
The const sibling_iterator.

◆ begin() [2/2]

const_sibling_iterator begin ( const std::string &  name) const
inlineinherited

Get the const sibling_same_name_iterator to the first sub node with the given name.

Parameters
nameThe name of the sibling
Returns
The const sibling_same_name_iterator.

◆ cend()

const_sibling_iterator cend ( ) const
inherited

Get the const end node sibling_iterator.

Returns
The const end sibling_iterator.

◆ end()

const_sibling_iterator end ( ) const
inlineinherited

Get the const end node sibling_iterator.

Returns
The const end sibling_iterator.

◆ content_cbegin()

const_content_iterator content_cbegin ( ) const
inherited

Get the const iterator to the first content.

Returns
The const content iterator.

◆ content_cend()

const_content_iterator content_cend ( ) const
inherited

Get the const end content iterator.

Returns
The const end iterator.

◆ content_begin()

const_content_iterator content_begin ( ) const
inlineinherited

Get the const iterator to the first content.

Returns
The const content iterator.

◆ content_end()

const_content_iterator content_end ( ) const
inlineinherited

Get the const end content iterator.

Returns
The const end iterator.

◆ comment_cbegin()

const_comment_iterator comment_cbegin ( ) const
inherited

Get the const iterator to the first comment.

Returns
The const comment iterator.

◆ comment_cend()

const_comment_iterator comment_cend ( ) const
inherited

Get the const end comment iterator.

Returns
The const end iterator.

◆ comment_begin()

const_comment_iterator comment_begin ( ) const
inlineinherited

Get the const iterator to the first comment.

Returns
The const comment iterator.

◆ comment_end()

const_comment_iterator comment_end ( ) const
inlineinherited

Get the const end comment iterator.

Returns
The const end iterator.

◆ attribute_cbegin()

const_attribute_iterator attribute_cbegin ( ) const
inherited

Get the const iterator to the first attribute.

Returns
The const attribute iterator.

◆ attribute_cend()

const_attribute_iterator attribute_cend ( ) const
inherited

Get the const end attribute iterator.

Returns
The const end iterator.

◆ attribute_begin()

const_attribute_iterator attribute_begin ( ) const
inlineinherited

Get the const iterator to the first attribute.

Returns
The const attribute iterator.

◆ attribute_end()

const_attribute_iterator attribute_end ( ) const
inlineinherited

Get the const end attribute iterator.

Returns
The const end iterator.

◆ find_attribute()

const_attribute_iterator find_attribute ( const std::string &  name) const
inherited

Find an attribute with the name name.

Parameters
[in]nameThe attribute name.
Returns
The const attribute iterator. end iterator if not exists.

◆ has_attribute()

bool has_attribute ( const std::string &  name) const
inlineinherited

Returns true if node contains the attribute with name name.

Parameters
[in]nameThe attribute name.
Returns
true if the attribute exists.

◆ get_attribute() [1/2]

T get_attribute ( const std::string &  name) const
inlineinherited

Return an attribute value cast to a given type.

Exceptions
XInvalidConfigwhen the attribute could not be found
Parameters
[in]nameThe name of the attribute
Returns
The casted value of the attribute

◆ get_attribute() [2/2]

T get_attribute ( const std::string &  name,
const T &  defaultValue 
) const
inlineinherited

Return an attribute value casted to a given type If the attribute could not be found the given default value will be returned.

Parameters
[in]nameThe name of the attribute
[in]defaultValueThe default value that will be returned if the attribute is not found
Returns
The casted value of the attribute

Friends And Related Function Documentation

◆ sibling_iterator

friend class sibling_iterator
friend

STL-conform typedefs.

Member Data Documentation

◆ mNode

_xmlNode* mNode
protectedinherited

The node pointer.

◆ mName

std::string mName
protectedinherited

the node name (optional)


The documentation for this class was generated from the following file: