OpenBarnyard
 
Loading...
Searching...
No Matches
T2DList< T > Class Template Reference

#include <T2DList.h>

Inheritance diagram for T2DList< T >:
T2GenericDList T2SortedList< T, Container, SortResults >

Public Types

using Iterator = Toshi::T2Iterator<T, Node>
 

Public Member Functions

 T2DList ()
 
 ~T2DList ()
 
Iterator Head () const
 
Iterator Tail () const
 
Iterator Begin () const
 
Iterator End () const
 
Iterator RBegin () const
 
Iterator REnd () const
 
Iterator Front () const
 
Iterator Back () const
 
void Delete (Iterator iter)
 
void DeleteAll ()
 
Iterator Erase (Iterator iter)
 
TBOOL Exists (T *a_pItem)
 
TBOOL IsEmpty () const
 
void PushBack (T *pItem)
 
void PushFront (T *pItem)
 
T * PopBack ()
 
T * PopFront ()
 
- Public Member Functions inherited from T2GenericDList
 T2GenericDList ()=default
 
 ~T2GenericDList ()
 
TBOOL IsLinked () const
 
void ClearBefore (Node *pNode)
 
void Clear ()
 
TBOOL IsInList (Node *pNode) const
 
TUINT Size () const
 

Additional Inherited Members

- Protected Attributes inherited from T2GenericDList
Node m_oRoot
 

Detailed Description

template<class T>
class T2DList< T >

Definition at line 153 of file T2DList.h.

Member Typedef Documentation

◆ Iterator

template<class T>
using T2DList< T >::Iterator = Toshi::T2Iterator<T, Node>

Definition at line 156 of file T2DList.h.

Constructor & Destructor Documentation

◆ T2DList()

template<class T>
T2DList< T >::T2DList ( )
inline

Definition at line 159 of file T2DList.h.

160 {
162 }
#define TSTATICASSERT(...)
Definition Defines.h:67

◆ ~T2DList()

template<class T>
T2DList< T >::~T2DList ( )
inline

Definition at line 164 of file T2DList.h.

165 {
166 TASSERT( IsEmpty() );
167 }
#define TASSERT(X,...)
Definition Defines.h:138
TBOOL IsEmpty() const
Definition T2DList.h:244

Member Function Documentation

◆ Back()

template<class T>
Iterator T2DList< T >::Back ( ) const
inline

Definition at line 206 of file T2DList.h.

207 {
208 return m_oRoot.Prev();
209 }

◆ Begin()

template<class T>
Iterator T2DList< T >::Begin ( ) const
inline

Definition at line 181 of file T2DList.h.

182 {
183 return m_oRoot.Next();
184 }

◆ Delete()

template<class T>
void T2DList< T >::Delete ( Iterator iter)
inline

Definition at line 211 of file T2DList.h.

212 {
213 iter->Remove();
214 delete TSTATICCAST( T, iter );
215 }
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69

◆ DeleteAll()

template<class T>
void T2DList< T >::DeleteAll ( )
inline

Definition at line 217 of file T2DList.h.

218 {
219 while ( Begin() != End() )
220 {
221 Delete( Begin() );
222 }
223 }
Iterator Begin() const
Definition T2DList.h:181
void Delete(Iterator iter)
Definition T2DList.h:211
Iterator End() const
Definition T2DList.h:186

◆ End()

template<class T>
Iterator T2DList< T >::End ( ) const
inline

Definition at line 186 of file T2DList.h.

187 {
188 return &m_oRoot;
189 }

◆ Erase()

template<class T>
Iterator T2DList< T >::Erase ( Iterator iter)
inline

Definition at line 225 of file T2DList.h.

226 {
227 Iterator itNext = iter.Next();
228 iter->Remove();
229
230 return itNext;
231 }
Toshi::T2Iterator< T, Node > Iterator
Definition T2DList.h:156

◆ Exists()

template<class T>
TBOOL T2DList< T >::Exists ( T * a_pItem)
inline

Definition at line 233 of file T2DList.h.

234 {
235 for ( auto it = Begin(); it != End(); it++ )
236 {
237 if ( it == a_pItem )
238 return TTRUE;
239 }
240
241 return TFALSE;
242 }

◆ Front()

template<class T>
Iterator T2DList< T >::Front ( ) const
inline

Definition at line 201 of file T2DList.h.

202 {
203 return m_oRoot.Next();
204 }

◆ Head()

template<class T>
Iterator T2DList< T >::Head ( ) const
inline

Definition at line 169 of file T2DList.h.

170 {
171 TASSERT( !IsEmpty() );
172 return m_oRoot.Next();
173 }

◆ IsEmpty()

template<class T>
TBOOL T2DList< T >::IsEmpty ( ) const
inline

Definition at line 244 of file T2DList.h.

245 {
246 return !m_oRoot.IsLinked();
247 }

◆ PopBack()

template<class T>
T * T2DList< T >::PopBack ( )
inline

Definition at line 259 of file T2DList.h.

260 {
261 auto node = Back();
262 node->Remove();
263 return node;
264 }
Iterator Back() const
Definition T2DList.h:206

◆ PopFront()

template<class T>
T * T2DList< T >::PopFront ( )
inline

Definition at line 266 of file T2DList.h.

267 {
268 auto node = Front();
269 node->Remove();
270 return node;
271 }
Iterator Front() const
Definition T2DList.h:201

◆ PushBack()

template<class T>
void T2DList< T >::PushBack ( T * pItem)
inline

Definition at line 249 of file T2DList.h.

250 {
251 pItem->InsertBefore( &m_oRoot );
252 }

◆ PushFront()

template<class T>
void T2DList< T >::PushFront ( T * pItem)
inline

Definition at line 254 of file T2DList.h.

255 {
256 pItem->InsertAfter( &m_oRoot );
257 }

◆ RBegin()

template<class T>
Iterator T2DList< T >::RBegin ( ) const
inline

Definition at line 191 of file T2DList.h.

192 {
193 return m_oRoot.Next();
194 }

◆ REnd()

template<class T>
Iterator T2DList< T >::REnd ( ) const
inline

Definition at line 196 of file T2DList.h.

197 {
198 return &m_oRoot;
199 }

◆ Tail()

template<class T>
Iterator T2DList< T >::Tail ( ) const
inline

Definition at line 175 of file T2DList.h.

176 {
177 TASSERT( !IsEmpty() );
178 return m_oRoot.Prev();
179 }

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