Public Types | Public Member Functions | Protected Attributes | Friends
efl::eina::_common_iterator_base< T > Struct Template Reference

Common implementations for iterators. More...

Public Types

typedef T const value_type
 Type for elements returned by the iterator. More...
 
typedef value_typepointer
 Type for a pointer to an element. More...
 
typedef value_typereference
 Type for a reference to an element. More...
 
typedef std::ptrdiff_t difference_type
 Type to represent the distance between two iterators. More...
 
typedef std::input_iterator_tag iterator_category
 Defines the iterator as being an input iterator. More...
 

Public Member Functions

 _common_iterator_base ()
 Default constructor. More...
 
 _common_iterator_base (Eina_Iterator *iterator)
 Creates a iterator wrapping the given native Eina_Iterator handle. More...
 
 ~_common_iterator_base ()
 Release the internal native Eina iterator handle.
 
 _common_iterator_base (self_type const &other)
 Creates an iterator from another iterator of the same type. More...
 
_common_iterator_baseoperator= (self_type const &other)
 Acquire the internal handle of the given iterator. More...
 
Eina_Iteratornative_handle () const
 Get the handle for the wrapped Eina_Iterator. More...
 

Protected Attributes

Eina_Iterator_iterator
 

Friends

bool operator== (_common_iterator_base< T > const &lhs, _common_iterator_base< T > const &rhs)
 Check if the iterators wrap the same handle. More...
 
bool operator!= (_common_iterator_base< T > const &lhs, _common_iterator_base< T > const &rhs)
 Check if the iterators wrap the different handles. More...
 

Detailed Description

template<typename T>
struct efl::eina::_common_iterator_base< T >

Common implementations for iterators.

Member Typedef Documentation

◆ value_type

template<typename T>
typedef T const efl::eina::_common_iterator_base< T >::value_type

Type for elements returned by the iterator.

◆ pointer

template<typename T>
typedef value_type* efl::eina::_common_iterator_base< T >::pointer

Type for a pointer to an element.

◆ reference

template<typename T>
typedef value_type& efl::eina::_common_iterator_base< T >::reference

Type for a reference to an element.

◆ difference_type

template<typename T>
typedef std::ptrdiff_t efl::eina::_common_iterator_base< T >::difference_type

Type to represent the distance between two iterators.

◆ iterator_category

template<typename T>
typedef std::input_iterator_tag efl::eina::_common_iterator_base< T >::iterator_category

Defines the iterator as being an input iterator.

Constructor & Destructor Documentation

◆ _common_iterator_base() [1/3]

template<typename T>
efl::eina::_common_iterator_base< T >::_common_iterator_base ( )
inline

Default constructor.

Creates an iterator that points to nothing.

◆ _common_iterator_base() [2/3]

template<typename T>
efl::eina::_common_iterator_base< T >::_common_iterator_base ( Eina_Iterator iterator)
inlineexplicit

Creates a iterator wrapping the given native Eina_Iterator handle.

Parameters
iteratorHandle to a native Eina_Iterator.

This constructor creates an iterator that wraps the given native Eina_Iterator handle, providing a generic interface to it.

Warning
The created iterator object gains ownership of the handle and will deallocate it at destruction time.

◆ _common_iterator_base() [3/3]

template<typename T>
efl::eina::_common_iterator_base< T >::_common_iterator_base ( self_type const &  other)
inline

Creates an iterator from another iterator of the same type.

Parameters
otherAnother iterator of the same type.
Warning
The supplied iterator transfer its internal handle to the new iterator, thus other will point to nothing after the call of this constructor.

Member Function Documentation

◆ operator=()

template<typename T>
_common_iterator_base& efl::eina::_common_iterator_base< T >::operator= ( self_type const &  other)
inline

Acquire the internal handle of the given iterator.

Parameters
otherAnother iterator of the same type.
Returns
Reference for itself.
Warning
The supplied iterator transfer its internal handle to the new iterator, thus other will point to nothing after the call of this constructor.

◆ native_handle()

template<typename T>
Eina_Iterator* efl::eina::_common_iterator_base< T >::native_handle ( ) const
inline

Get the handle for the wrapped Eina_Iterator.

Returns
Internal handle for the native Eina iterator.

This member function returns the native Eina_Iterator handle that is wrapped inside this object.

Warning
It is important to take care when using it, since the handle will be automatically release upon object destruction.

Friends And Related Function Documentation

◆ operator==

template<typename T>
bool operator== ( _common_iterator_base< T > const &  lhs,
_common_iterator_base< T > const &  rhs 
)
friend

Check if the iterators wrap the same handle.

Parameters
lhsIterator at the left side of the expression.
lhsIterator at the right side of the expression.
Returns
true if both iterators wrap the same handle, false otherwise.

◆ operator!=

template<typename T>
bool operator!= ( _common_iterator_base< T > const &  lhs,
_common_iterator_base< T > const &  rhs 
)
friend

Check if the iterators wrap the different handles.

Parameters
lhsIterator at the left side of the expression.
lhsIterator at the right side of the expression.
Returns
true if the iterators wrap different handles, false otherwise.