Cogs.Core
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.

Definition at line 162 of file ComponentCollection.h.

Member Typedef Documentation

◆ difference_type

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

Difference type to calculate iterator distance.

Definition at line 172 of file ComponentCollection.h.

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

Definition at line 166 of file ComponentCollection.h.

◆ pointer

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

Pointer type to the templated ComponentType.

Definition at line 175 of file ComponentCollection.h.

◆ reference

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

Reference type to the templated ComponentType.

Definition at line 178 of file ComponentCollection.h.

◆ value_type

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

Value type for dereferencing the iterator is the templated ComponentType.

Definition at line 169 of file ComponentCollection.h.

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.

Definition at line 181 of file ComponentCollection.h.

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

Definition at line 184 of file ComponentCollection.h.

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.

Definition at line 196 of file ComponentCollection.h.

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

Definition at line 199 of file ComponentCollection.h.

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

Definition at line 190 of file ComponentCollection.h.

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

Definition at line 193 of file ComponentCollection.h.

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

Definition at line 202 of file ComponentCollection.h.

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

Definition at line 187 of file ComponentCollection.h.


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