Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cListBase Class Reference

#include <cList.h>

Inheritance diagram for Gray::cListBase:
Gray::cListT< cXmlNode > Gray::cListT< cOctreeObject > Gray::cListT< _TYPE_REC > GrayLib::cXmlContainer Gray3D::cOctreeNode GrayLib::cXmlDocument GrayLib::cXmlElement

Public Member Functions

 cListBase () noexcept
 
virtual ~cListBase ()
 
virtual void InsertListNode (cListNodeBase *pNodeNew, cListNodeBase *pNodePrev=nullptr)
 
void InsertList (cListBase *pListSrc, cListNodeBase *pNodePrev=nullptr)
 
void InsertBefore (cListNodeBase *pNodeNew, const cListNodeBase *pNodeNext)
 
void InsertHead (cListNodeBase *pNodeNew)
 
void InsertTail (cListNodeBase *pNodeNew)
 
void DisposeAll ()
 
void Empty ()
 
cListNodeBaseget_Head (void) const noexcept
 
cListNodeBaseget_Tail (void) const noexcept
 
ITERATE_t get_Count () const noexcept
 
bool isEmpty () const noexcept
 
cListNodeBaseGetAt (ITERATE_t index) const
 iterate the linked list. More...
 
bool IsMyChild (const cListNodeBase *pNode) const noexcept
 

Protected Member Functions

virtual void RemoveListNode (cListNodeBase *pNode)
 allow Override of this. called when child pObRec removed from list. More...
 

Protected Attributes

ITERATE_t m_iCount
 how many children? nice to get read only direct access to this for scripting. More...
 

Friends

class cListNodeBase
 
class cListTests
 

Detailed Description

Double linked list. NOT circular. head and tail are nullptr.

Note
Lists are primarily used if inserts and deletes for large sets occurs frequently. Objects should remove themselves from the list when deleted. Similar to the MFC CList, or std::list<T>, std::deque

Constructor & Destructor Documentation

◆ cListBase()

Gray::cListBase::cListBase ( )
inlinenoexcept

◆ ~cListBase()

virtual Gray::cListBase::~cListBase ( )
inlinevirtual
Note
virtuals do not work in destructors ! ASSUME: DisposeAll() or Empty() is called from higher levels it is important for virtual RemoveListNode() callback

Member Function Documentation

◆ DisposeAll()

void Gray::cListBase::DisposeAll ( void  )

call DisposeThis() for all entries.

◆ Empty()

void Gray::cListBase::Empty ( )

empty the list. but don't necessarily DisposeThis() the objects.

◆ get_Count()

ITERATE_t Gray::cListBase::get_Count ( ) const
inlinenoexcept

◆ get_Head()

cListNodeBase* Gray::cListBase::get_Head ( void  ) const
inlinenoexcept

◆ get_Tail()

cListNodeBase* Gray::cListBase::get_Tail ( void  ) const
inlinenoexcept

◆ GetAt()

cListNodeBase * Gray::cListBase::GetAt ( ITERATE_t  index) const

iterate the linked list.

iterate the linked list. Not very efficient. iterative.

Returns
nullptr = past end of list.

◆ InsertBefore()

void Gray::cListBase::InsertBefore ( cListNodeBase pNodeNew,
const cListNodeBase pNodeNext 
)
inline
  • pNext = nullptr = insert last

◆ InsertHead()

void Gray::cListBase::InsertHead ( cListNodeBase pNodeNew)
inline

◆ InsertList()

void Gray::cListBase::InsertList ( cListBase pListSrc,
cListNodeBase pNodePrev = nullptr 
)

Transfer the contents of another list into this one.

◆ InsertListNode()

void Gray::cListBase::InsertListNode ( cListNodeBase pNodeNew,
cListNodeBase pNodePrev = nullptr 
)
virtual

Override this to check items being added. pPrev = nullptr = first

Add pNodeNew after pNodePrev. pNodePrev = nullptr == add to the start.

Note
If the item is already here, it will NOT be removed then re-added.

◆ InsertTail()

void Gray::cListBase::InsertTail ( cListNodeBase pNodeNew)
inline

◆ isEmpty()

bool Gray::cListBase::isEmpty ( ) const
inlinenoexcept

◆ IsMyChild()

bool Gray::cListBase::IsMyChild ( const cListNodeBase pNode) const
inlinenoexcept

◆ RemoveListNode()

void Gray::cListBase::RemoveListNode ( cListNodeBase pNode)
protectedvirtual

allow Override of this. called when child pObRec removed from list.

Override this to get called when an item is removed from this list. Never called directly. ALWAYS called from pObRec->RemoveFromParent()

Some object is being removed from my list. Override this to get called when an item is removed from this list. just remove from list. It may or may not be deleting itself.

Note
Only called from RemoveFromParent(). this is protected. Never called directly. ALWAYS called from pNodeRemove->RemoveFromParent()

Friends And Related Function Documentation

◆ cListNodeBase

friend class cListNodeBase
friend

◆ cListTests

friend class cListTests
friend

Member Data Documentation

◆ m_iCount

ITERATE_t Gray::cListBase::m_iCount
protected

how many children? nice to get read only direct access to this for scripting.


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