coastline 0.0.4
Loading...
Searching...
No Matches
CWordList Class Reference

Doubly linked list of 16-bit words with pooled nodes and MFC position semantics. More...

#include <mfc.h>

Inheritance diagram for CWordList:
Collaboration diagram for CWordList:

Public Member Functions

 CWordList (int blockSize=10)
 Initialise an empty list with node allocation deferred until insertion.
 ~CWordList () override
 Release all nodes and pool blocks.
BOOL IsEmpty () const
int GetCount () const
WORD & GetHead ()
POSITION GetHeadPosition () const
WORD & GetNext (POSITION &position)
 Retrieve a node value and advance towards the tail.
POSITION AddHead (WORD value)
 Insert a value at the head.
POSITION AddTail (WORD value)
 Insert a value at the tail.
POSITION InsertBefore (POSITION position, WORD value)
 Insert a value before a position, or at the head for a null position.
POSITION InsertAfter (POSITION position, WORD value)
 Insert a value after a position, or at the tail for a null position.
void RemoveAt (POSITION position)
 Remove a node and release all pool blocks when the list becomes empty.
void RemoveAll ()
 Remove every node and release all pool blocks.
Public Member Functions inherited from CObject
virtual CRuntimeClass * GetRuntimeClass () const
virtual ~CObject ()
 The base destructor does not perform additional cleanup.
virtual void Serialize (CArchive &archive)
 Do not serialise archive data.
virtual void AssertValid () const
 Do not validate object state.
virtual void Dump (CDumpContext &context) const
 Do not emit diagnostic output.

Detailed Description

Doubly linked list of 16-bit words with pooled nodes and MFC position semantics.

Positions and references remain valid until their nodes are removed or all storage is released.

Constructor & Destructor Documentation

◆ CWordList()

CWordList::CWordList ( int blockSize = 10)
explicit

Initialise an empty list with node allocation deferred until insertion.

Parameters
blockSizeThe positive number of nodes allocated per pool block.

◆ ~CWordList()

CWordList::~CWordList ( )
override

Release all nodes and pool blocks.

Member Function Documentation

◆ IsEmpty()

BOOL CWordList::IsEmpty ( ) const
Returns
TRUE when the list is empty; otherwise FALSE.

◆ GetCount()

int CWordList::GetCount ( ) const
Returns
The number of list nodes.

◆ GetHead()

WORD & CWordList::GetHead ( )
Returns
A mutable reference to the first value; the list must be nonempty.

◆ GetHeadPosition()

POSITION CWordList::GetHeadPosition ( ) const
Returns
The first node position, or null when the list is empty.

◆ GetNext()

WORD & CWordList::GetNext ( POSITION & position)

Retrieve a node value and advance towards the tail.

Parameters
positionA non-null position from this list, replaced with the next position or null.
Returns
A mutable reference to the retrieved node value.

◆ AddHead()

POSITION CWordList::AddHead ( WORD value)

Insert a value at the head.

Parameters
valueThe word copied into the new node.
Returns
The new node position.

◆ AddTail()

POSITION CWordList::AddTail ( WORD value)

Insert a value at the tail.

Parameters
valueThe word copied into the new node.
Returns
The new node position.

◆ InsertBefore()

POSITION CWordList::InsertBefore ( POSITION position,
WORD value )

Insert a value before a position, or at the head for a null position.

Parameters
positionA position from this list, or null.
valueThe word copied into the new node.
Returns
The new node position.

◆ InsertAfter()

POSITION CWordList::InsertAfter ( POSITION position,
WORD value )

Insert a value after a position, or at the tail for a null position.

Parameters
positionA position from this list, or null.
valueThe word copied into the new node.
Returns
The new node position.

◆ RemoveAt()

void CWordList::RemoveAt ( POSITION position)

Remove a node and release all pool blocks when the list becomes empty.

Parameters
positionA non-null position identifying a current node in this list.

◆ RemoveAll()

void CWordList::RemoveAll ( )

Remove every node and release all pool blocks.


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