#ifndef __PTRLIST_INCLUDED__ #define __PTRLIST_INCLUDED__ #pragma once #include "stdafx.h" #ifndef POSITION #ifndef _AFX struct __POSITION { }; #endif typedef __POSITION* POSITION; #endif /** * Class CPtrList * {group:Common} * * Version: 1.0.0 * Date: 2002-08-23 * Author: Johan Sanneblad */ class CPtrList { // Construction public: CPtrList(); CPtrList(const CPtrList& list); const CPtrList& operator=(const CPtrList& right); // Attributes protected: DWORD m_dwCount; struct _DATALISTELEMENT { void* pData; _DATALISTELEMENT* pPrev; _DATALISTELEMENT* pNext; } *m_pHead, *m_pTail; // Operations public: DWORD GetCount() const; POSITION GetHeadPosition() const; POSITION Find(void* p, POSITION startAfter = NULL) const; POSITION FindIndex(DWORD dwIndex) const; void* GetAt(POSITION position) const; void* GetNext(POSITION& rPosition) const; void AddTail(void* p); void RemoveAt(POSITION position); void RemoveAll(); protected: void Initialize(); void CreateLocalCopy(const _DATALISTELEMENT* pHead); void FreeNode(_DATALISTELEMENT* pNode); // Implementation public: virtual ~CPtrList(); }; #endif // __PTRLIST_INCLUDED__