Cogs.Foundation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator Class Reference

Iterator type for iterating over typed component collections. More...

#include <ComponentCollection.h>

Public Types

typedef std::forward_iterator_tag iterator_category
 Type of iterator. Can only be used to iterate forward over components in a pool.
 
typedef ComponentType value_type
 Value type for dereferencing the iterator is the templated ComponentType.
 
typedef size_t difference_type
 Difference type to calculate iterator distance.
 
typedef ComponentType * pointer
 Pointer type to the templated ComponentType.
 
typedef ComponentType & reference
 Reference type to the templated ComponentType.
 

Public Member Functions

 ComponentCollectionIterator (ComponentCollection &collection, size_t index)
 Creates a new iterator over the given collection with the given index.
 
 ComponentCollectionIterator (const ComponentCollectionIterator &other)
 Creates a new iterator copying the state of other.
 
constexpr bool operator== (const ComponentCollectionIterator &other) const
 Comparison operator. If the current index of both iterators are equal the iterators are considered equal.
 
ComponentCollectionIterator operator++ ()
 Post increment operator. Moves the iterator to the next component indexed in the collection.
 
ComponentCollectionIteratoroperator++ (int)
 Pre increment operator. Moves the iterator to the next component indexed in the collection.
 
ComponentType & operator* ()
 Dereference operator. Returns a reference to the component at the iterators current iterator index.
 
const ComponentType & operator* () const
 Const dereference operator. Returns a const reference to the component at the current iterator index.
 
const ComponentType * operator-> () const
 Pointer operator. Returns a pointer to the component at the current iterator index.
 

Detailed Description

template<typename ComponentType>
class Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator

Iterator type for iterating over typed component collections.

Member Typedef Documentation

◆ difference_type

template<typename ComponentType >
typedef size_t Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::difference_type

Difference type to calculate iterator distance.

◆ iterator_category

template<typename ComponentType >
typedef std::forward_iterator_tag Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::iterator_category

Type of iterator. Can only be used to iterate forward over components in a pool.

◆ pointer

template<typename ComponentType >
typedef ComponentType* Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::pointer

Pointer type to the templated ComponentType.

◆ reference

template<typename ComponentType >
typedef ComponentType& Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::reference

Reference type to the templated ComponentType.

◆ value_type

template<typename ComponentType >
typedef ComponentType Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::value_type

Value type for dereferencing the iterator is the templated ComponentType.

Constructor & Destructor Documentation

◆ ComponentCollectionIterator() [1/2]

template<typename ComponentType >
Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::ComponentCollectionIterator ( ComponentCollection collection,
size_t  index 
)
inline

Creates a new iterator over the given collection with the given index.

◆ ComponentCollectionIterator() [2/2]

template<typename ComponentType >
Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::ComponentCollectionIterator ( const ComponentCollectionIterator other)
inline

Creates a new iterator copying the state of other.

Member Function Documentation

◆ operator*() [1/2]

template<typename ComponentType >
ComponentType & Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::operator* ( )
inline

Dereference operator. Returns a reference to the component at the iterators current iterator index.

◆ operator*() [2/2]

template<typename ComponentType >
const ComponentType & Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::operator* ( ) const
inline

Const dereference operator. Returns a const reference to the component at the current iterator index.

◆ operator++() [1/2]

template<typename ComponentType >
ComponentCollectionIterator Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::operator++ ( )
inline

Post increment operator. Moves the iterator to the next component indexed in the collection.

◆ operator++() [2/2]

template<typename ComponentType >
ComponentCollectionIterator & Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::operator++ ( int  )
inline

Pre increment operator. Moves the iterator to the next component indexed in the collection.

◆ operator->()

template<typename ComponentType >
const ComponentType * Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::operator-> ( ) const
inline

Pointer operator. Returns a pointer to the component at the current iterator index.

◆ operator==()

template<typename ComponentType >
constexpr bool Cogs::ComponentModel::ComponentCollection< ComponentType >::ComponentCollectionIterator::operator== ( const ComponentCollectionIterator other) const
inlineconstexpr

Comparison operator. If the current index of both iterators are equal the iterators are considered equal.


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