DART  6.7.3
dart::utils::TemplatedElementEnumerator< ElementType > Class Template Reference

TemplatedElementEnumerator is a convenience class to help visiting all the child elements of given parent element. More...

#include <XmlHelpers.hpp>

Public Member Functions

 TemplatedElementEnumerator (ElementPtr parentElement, const std::string &childElementName)
 Constructor that takes parent element and. More...
 
 ~TemplatedElementEnumerator ()
 Destructor. More...
 
bool next ()
 Set the current element to the next sibling element or to the first child element of given parent element if it exists; returns success. More...
 
ElementPtr get () const
 Get the current element. More...
 
ElementPtr operator-> () const
 Dereference operator. More...
 
ElementRef operator* () const
 Dereference operator. More...
 
bool operator== (const TemplatedElementEnumerator< ElementType > &rhs) const
 Equality operator. More...
 
TemplatedElementEnumerator< ElementType > & operator= (const TemplatedElementEnumerator< ElementType > &rhs)
 Assignment operator. More...
 

Protected Types

using ElementPtr = ElementType *
 
using ElementRef = ElementType &
 

Private Member Functions

bool valid () const
 Returns true if the current element is valid (not a nullptr) More...
 

Private Attributes

ElementPtr mParentElement
 Parent element. More...
 
std::string mChildElementName
 Child element name. More...
 
ElementPtr mCurrentElement
 Currently visiting child element. More...
 

Detailed Description

template<typename ElementType>
class dart::utils::TemplatedElementEnumerator< ElementType >

TemplatedElementEnumerator is a convenience class to help visiting all the child elements of given parent element.

This class is templated to cover const and non-const tinyxml2::XMLElement types.

Member Typedef Documentation

◆ ElementPtr

template<typename ElementType >
using dart::utils::TemplatedElementEnumerator< ElementType >::ElementPtr = ElementType*
protected

◆ ElementRef

template<typename ElementType >
using dart::utils::TemplatedElementEnumerator< ElementType >::ElementRef = ElementType&
protected

Constructor & Destructor Documentation

◆ TemplatedElementEnumerator()

template<typename ElementType >
dart::utils::TemplatedElementEnumerator< ElementType >::TemplatedElementEnumerator ( ElementPtr  parentElement,
const std::string &  childElementName 
)
inline

Constructor that takes parent element and.

◆ ~TemplatedElementEnumerator()

template<typename ElementType >
dart::utils::TemplatedElementEnumerator< ElementType >::~TemplatedElementEnumerator ( )
inline

Destructor.

Member Function Documentation

◆ get()

template<typename ElementType >
ElementPtr dart::utils::TemplatedElementEnumerator< ElementType >::get ( ) const
inline

Get the current element.

◆ next()

template<typename ElementType >
bool dart::utils::TemplatedElementEnumerator< ElementType >::next ( )
inline

Set the current element to the next sibling element or to the first child element of given parent element if it exists; returns success.

◆ operator*()

template<typename ElementType >
ElementRef dart::utils::TemplatedElementEnumerator< ElementType >::operator* ( ) const
inline

Dereference operator.

◆ operator->()

template<typename ElementType >
ElementPtr dart::utils::TemplatedElementEnumerator< ElementType >::operator-> ( ) const
inline

Dereference operator.

◆ operator=()

template<typename ElementType >
TemplatedElementEnumerator<ElementType>& dart::utils::TemplatedElementEnumerator< ElementType >::operator= ( const TemplatedElementEnumerator< ElementType > &  rhs)
inline

Assignment operator.

◆ operator==()

template<typename ElementType >
bool dart::utils::TemplatedElementEnumerator< ElementType >::operator== ( const TemplatedElementEnumerator< ElementType > &  rhs) const
inline

Equality operator.

◆ valid()

template<typename ElementType >
bool dart::utils::TemplatedElementEnumerator< ElementType >::valid ( ) const
inlineprivate

Returns true if the current element is valid (not a nullptr)

Member Data Documentation

◆ mChildElementName

template<typename ElementType >
std::string dart::utils::TemplatedElementEnumerator< ElementType >::mChildElementName
private

Child element name.

◆ mCurrentElement

template<typename ElementType >
ElementPtr dart::utils::TemplatedElementEnumerator< ElementType >::mCurrentElement
private

Currently visiting child element.

◆ mParentElement

template<typename ElementType >
ElementPtr dart::utils::TemplatedElementEnumerator< ElementType >::mParentElement
private

Parent element.