Unreal Snake Game 1.0.0
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
SnakeGame::TDoubleLinkedList< ElementType > Class Template Reference

#include <List.h>

Classes

class  TDoubleLinkedListNode
 

Public Types

typedef TDoubleLinkedListIterator< TDoubleLinkedListNode, ElementType > TIterator
 
typedef TDoubleLinkedListIterator< TDoubleLinkedListNode, const ElementType > TConstIterator
 

Public Member Functions

 TDoubleLinkedList ()
 
virtual ~TDoubleLinkedList ()
 
bool AddHead (const ElementType &InElement)
 
bool AddHead (TDoubleLinkedListNode *NewNode)
 
bool AddTail (const ElementType &InElement)
 
bool AddTail (TDoubleLinkedListNode *NewNode)
 
bool InsertNode (const ElementType &InElement, TDoubleLinkedListNode *NodeToInsertBefore=nullptr)
 
bool InsertNode (TDoubleLinkedListNode *NewNode, TDoubleLinkedListNode *NodeToInsertBefore=nullptr)
 
void RemoveNode (const ElementType &InElement)
 
void RemoveNode (TDoubleLinkedListNode *NodeToRemove, bool bDeleteNode=true)
 
void Empty ()
 
TDoubleLinkedListNodeGetHead () const
 
TDoubleLinkedListNodeGetTail () const
 
TDoubleLinkedListNodeFindNode (const ElementType &InElement)
 
bool Contains (const ElementType &InElement)
 
bool IsEmpty () const
 
int32 Num () const
 
void MoveTailAfterHead ()
 

Protected Member Functions

virtual void SetListSize (int32 NewListSize)
 

Private Member Functions

 TDoubleLinkedList (const TDoubleLinkedList &)
 

Private Attributes

TDoubleLinkedListNodeHeadNode
 
TDoubleLinkedListNodeTailNode
 
int32 ListSize
 

Friends

TIterator begin (TDoubleLinkedList &List)
 
TConstIterator begin (const TDoubleLinkedList &List)
 
TIterator end (TDoubleLinkedList &List)
 
TConstIterator end (const TDoubleLinkedList &List)
 

Detailed Description

template<class ElementType>
class SnakeGame::TDoubleLinkedList< ElementType >

Double linked list.

See also
TIntrusiveDoubleLinkedList

Member Typedef Documentation

◆ TIterator

template<class ElementType >
typedef TDoubleLinkedListIterator<TDoubleLinkedListNode, ElementType> SnakeGame::TDoubleLinkedList< ElementType >::TIterator

Used to iterate over the elements of a linked list.

Constructor & Destructor Documentation

◆ TDoubleLinkedList()

template<class ElementType >
SnakeGame::TDoubleLinkedList< ElementType >::TDoubleLinkedList ( )
inline

Constructors.

◆ ~TDoubleLinkedList()

template<class ElementType >
virtual SnakeGame::TDoubleLinkedList< ElementType >::~TDoubleLinkedList ( )
inlinevirtual

Destructor

Member Function Documentation

◆ AddHead()

template<class ElementType >
bool SnakeGame::TDoubleLinkedList< ElementType >::AddHead ( const ElementType &  InElement)
inline

Add the specified value to the beginning of the list, making that value the new head of the list.

Parameters
InElementthe value to add to the list.
Returns
whether the node was successfully added into the list.
See also
GetHead, InsertNode, RemoveNode

◆ AddTail()

template<class ElementType >
bool SnakeGame::TDoubleLinkedList< ElementType >::AddTail ( const ElementType &  InElement)
inline

Append the specified value to the end of the list

Parameters
InElementthe value to add to the list.
Returns
whether the node was successfully added into the list
See also
GetTail, InsertNode, RemoveNode

◆ Empty()

template<class ElementType >
void SnakeGame::TDoubleLinkedList< ElementType >::Empty ( )
inline

Removes all nodes from the list.

◆ FindNode()

template<class ElementType >
TDoubleLinkedListNode * SnakeGame::TDoubleLinkedList< ElementType >::FindNode ( const ElementType &  InElement)
inline

Finds the node corresponding to the value specified

Parameters
InElementthe value to find
Returns
a pointer to the node that contains the value specified, or nullptr of the value couldn't be found

◆ GetHead()

template<class ElementType >
TDoubleLinkedListNode * SnakeGame::TDoubleLinkedList< ElementType >::GetHead ( ) const
inline

Returns the node at the head of the list.

Returns
Pointer to the first node.
See also
GetTail

◆ GetTail()

template<class ElementType >
TDoubleLinkedListNode * SnakeGame::TDoubleLinkedList< ElementType >::GetTail ( ) const
inline

Returns the node at the end of the list.

Returns
Pointer to the last node.
See also
GetHead

◆ InsertNode()

template<class ElementType >
bool SnakeGame::TDoubleLinkedList< ElementType >::InsertNode ( const ElementType &  InElement,
TDoubleLinkedListNode NodeToInsertBefore = nullptr 
)
inline

Insert the specified value into the list at an arbitrary point.

Parameters
InElementthe value to insert into the list
NodeToInsertBeforethe new node will be inserted into the list at the current location of this node if nullptr, the new node will become the new head of the list
Returns
whether the node was successfully added into the list
See also
Empty, RemoveNode

◆ IsEmpty()

template<class ElementType >
bool SnakeGame::TDoubleLinkedList< ElementType >::IsEmpty ( ) const
inline

Returns true if the list is empty and contains no elements.

Returns
True if the list is empty.
See also
Num

◆ Num()

template<class ElementType >
int32 SnakeGame::TDoubleLinkedList< ElementType >::Num ( ) const
inline

Returns the number of items in the list.

Returns
Item count.

◆ RemoveNode() [1/2]

template<class ElementType >
void SnakeGame::TDoubleLinkedList< ElementType >::RemoveNode ( const ElementType &  InElement)
inline

Remove the node corresponding to InElement.

Parameters
InElementThe value to remove from the list.
See also
Empty, InsertNode

◆ RemoveNode() [2/2]

template<class ElementType >
void SnakeGame::TDoubleLinkedList< ElementType >::RemoveNode ( TDoubleLinkedListNode NodeToRemove,
bool  bDeleteNode = true 
)
inline

Removes the node specified.

Parameters
NodeToRemoveThe node to remove.
See also
Empty, InsertNode

◆ SetListSize()

template<class ElementType >
virtual void SnakeGame::TDoubleLinkedList< ElementType >::SetListSize ( int32  NewListSize)
inlineprotectedvirtual

Updates the size reported by Num(). Child classes can use this function to conveniently hook into list additions/removals.

Parameters
NewListSizethe new size for this list

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