/*---------------------------------------------------------------------------* Project: My template library File: mytl.h (C)2005 HUDSON SOFT $Header: /home/cvsroot/SDK/include/win32/mytl.h,v 1.2 2006/03/09 12:28:40 yasuh-to Exp $ $NoKeywords: $ *---------------------------------------------------------------------------*/ #ifndef __MYTL_H__ #define __MYTL_H__ #include #include using namespace std; /////////////////////////////////////////////////////////////////////////////// // // TMyList // template class TMYList : public deque { public: typedef BOOL (* COMPARE)(T pItem1, LPVOID pData); // Get the number of lists (to control warnings) int GetCount() { return (int)size(); } // Get the list item corresponding to the index T GetItem(int nIndex) { assert((nIndex >= 0) && (nIndex < GetCount())); return at(nIndex); } // Add an item to the end of the list int AddTail(T pItem) { push_back(pItem); return GetCount() - 1; } // Get the index for the specified item int IndexOf(T pItem) { for (int i=0; i= 0) && (nIndex < GetCount())); if ( bDelItem ) delete at(nIndex); erase(begin() + nIndex); } // Delete the specified item void Remove(T pItem, BOOL bDelItem=TRUE) { int nIndex = IndexOf(pItem); assert(nIndex != -1); if ( bDelItem ) delete at(nIndex); erase(begin() + nIndex); } // Clear the list void Clear(BOOL bDelItem=TRUE) { if ( bDelItem ) { for (int i=0; i