OpenBarnyard
 
Loading...
Searching...
No Matches
TGenericArray< T >::Iterator Class Reference

#include <TArray.h>

Public Types

using Storage = TGenericArray
 

Public Member Functions

 Iterator ()
 
 Iterator (const Iterator &other)
 
 Iterator (Storage &a_poArray)
 
 Iterator (TINT a_iIndex, Storage &a_poArray)
 
TINT Index () const
 
void Push (const T &element)
 
T * operator-> () const
 
T & Get ()
 
bool IsOver () const
 
const T & Get () const
 
TBOOL operator== (const Iterator &a_rIt) const
 
Iteratoroperator++ ()
 
Iterator operator++ (TINT)
 
Iteratoroperator-- ()
 
Iterator operator-- (TINT)
 
Iterator operator+ (TINT a_iValue) const
 
Iterator operator- (TINT a_iValue) const
 

Public Attributes

friend TGenericArray
 

Detailed Description

template<class T>
class TGenericArray< T >::Iterator

Definition at line 15 of file TArray.h.

Member Typedef Documentation

◆ Storage

template<class T>
using TGenericArray< T >::Iterator::Storage = TGenericArray

Definition at line 19 of file TArray.h.

Constructor & Destructor Documentation

◆ Iterator() [1/4]

template<class T>
TGenericArray< T >::Iterator::Iterator ( )
inline

Definition at line 22 of file TArray.h.

23 {
24 m_iIndex = 0;
25 m_poArray = TNULL;
26 }

◆ Iterator() [2/4]

template<class T>
TGenericArray< T >::Iterator::Iterator ( const Iterator & other)
inline

Definition at line 28 of file TArray.h.

29 {
30 m_poArray = other.m_poArray;
31 m_iIndex = 0;
32 }

◆ Iterator() [3/4]

template<class T>
TGenericArray< T >::Iterator::Iterator ( Storage & a_poArray)
inline

Definition at line 34 of file TArray.h.

35 {
36 m_iIndex = 0;
37 m_poArray = &a_poArray;
38 }

◆ Iterator() [4/4]

template<class T>
TGenericArray< T >::Iterator::Iterator ( TINT a_iIndex,
Storage & a_poArray )
inline

Definition at line 40 of file TArray.h.

41 {
42 m_iIndex = a_iIndex;
43 m_poArray = &a_poArray;
44 }

Member Function Documentation

◆ Get() [1/2]

template<class T>
T & TGenericArray< T >::Iterator::Get ( )
inline

Definition at line 65 of file TArray.h.

66 {
67 TASSERT( m_iIndex >= 0 );
68 TASSERT( m_poArray );
70 return m_poArray->m_pData[ m_iIndex ];
71 }
#define TASSERT(X,...)
Definition Defines.h:138

◆ Get() [2/2]

template<class T>
const T & TGenericArray< T >::Iterator::Get ( ) const
inline

Definition at line 78 of file TArray.h.

79 {
80 TASSERT( m_iIndex >= 0 );
81 TASSERT( m_poArray );
83 return m_poArray->m_pData[ m_iIndex ];
84 }

◆ Index()

template<class T>
TINT TGenericArray< T >::Iterator::Index ( ) const
inline

Definition at line 46 of file TArray.h.

47 {
48 return m_iIndex;
49 }

◆ IsOver()

template<class T>
bool TGenericArray< T >::Iterator::IsOver ( ) const
inline

Definition at line 73 of file TArray.h.

74 {
75 return ( m_iIndex >= m_poArray->Size() || m_iIndex == -1 );
76 }

◆ operator+()

template<class T>
Iterator TGenericArray< T >::Iterator::operator+ ( TINT a_iValue) const
inline

Definition at line 117 of file TArray.h.

118 {
119 return Iterator( m_iIndex + a_iValue, m_poArray );
120 }

◆ operator++() [1/2]

template<class T>
Iterator & TGenericArray< T >::Iterator::operator++ ( )
inline

Definition at line 91 of file TArray.h.

92 {
93 m_iIndex++;
94 return *this;
95 }

◆ operator++() [2/2]

template<class T>
Iterator TGenericArray< T >::Iterator::operator++ ( TINT )
inline

Definition at line 97 of file TArray.h.

98 {
99 Iterator temp = *this;
100 m_iIndex++;
101 return temp;
102 }

◆ operator-()

template<class T>
Iterator TGenericArray< T >::Iterator::operator- ( TINT a_iValue) const
inline

Definition at line 122 of file TArray.h.

123 {
124 return Iterator( m_iIndex - a_iValue, m_poArray );
125 }

◆ operator--() [1/2]

template<class T>
Iterator & TGenericArray< T >::Iterator::operator-- ( )
inline

Definition at line 104 of file TArray.h.

105 {
106 m_iIndex--;
107 return *this;
108 }

◆ operator--() [2/2]

template<class T>
Iterator TGenericArray< T >::Iterator::operator-- ( TINT )
inline

Definition at line 110 of file TArray.h.

111 {
112 Iterator temp = *this;
113 m_iIndex--;
114 return temp;
115 }

◆ operator->()

template<class T>
T * TGenericArray< T >::Iterator::operator-> ( ) const
inline

Definition at line 57 of file TArray.h.

58 {
59 TASSERT( m_iIndex >= 0 );
60 TASSERT( m_poArray );
62 return &m_poArray->m_pData[ m_iIndex ];
63 }

◆ operator==()

template<class T>
TBOOL TGenericArray< T >::Iterator::operator== ( const Iterator & a_rIt) const
inline

Definition at line 86 of file TArray.h.

87 {
88 return ( m_iIndex == a_rIt.m_iIndex ) && ( m_poArray == a_rIt.m_poArray );
89 }

◆ Push()

template<class T>
void TGenericArray< T >::Iterator::Push ( const T & element)
inline

Definition at line 51 of file TArray.h.

52 {
53 TASSERT( m_poArray );
54 m_poArray->Push( element );
55 }

Member Data Documentation

◆ TGenericArray

template<class T>
friend TGenericArray< T >::Iterator::TGenericArray

Definition at line 18 of file TArray.h.


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