home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-09 | 2.1 KB | 73 lines | [TEXT/MPCC] |
-
- /*
-
- MWfolk:
- I munged this up when CW5 was new, but it never compiled to usable
- code, and thus couldn’t use it. With CW6, it seems to work, so
- I'm able to use it again, much to my relief. If I'd gotten it
- to work with CW/5, it would've saved me numerous hours of grief.
-
- You have my full permission to do what you like with this;
- I suggest it would save future PP users much grief if you
- were to replace the standard LDynamicArray with it (or
- something like it.) void * is an abomination always abhorred!
- I decided against sending it to macgifts as it remains mostly
- your copyrighted material.
-
- Further, you could do a StHandleBlock<T> class alongside the
- existing such class for UMemoryMgr which would remove some casting
- in this version.
-
- As always,
- Chris
- */
-
-
- // ===========================================================================
- // LtDynamicArray.t ©1994-1995 Metrowerks Inc. All rights reserved.
- // templated by Chris Thomas thunderone@delphi.com
- // ===========================================================================
-
- #pragma once
-
- #include <PP_Prefix.h>
-
-
- template <class T>
- class LtDynamicArray
- {
-
- public:
- LtDynamicArray();
- LtDynamicArray(T** inItemsHandle);
- virtual ~LtDynamicArray();
-
- virtual Int32 GetCount() const;
-
- virtual void InsertItemsAt(Uint32 inCount, Int32 inAtIndex,
- T *inItem);
- virtual void RemoveItemsAt(Uint32 inCount, Int32 inAtIndex);
-
- virtual Boolean FetchItemAt(Int32 inAtIndex, T *outItem);
- virtual void SetItemAt(Int32 inAtIndex, const T *inItem);
-
- virtual void SwapItems(Int32 inIndexA, Int32 inIndexB);
- virtual void MoveItem(Int32 inFromIndex, Int32 inToIndex);
-
- // this doesn't work if /*const*/ is uncommented below - MWC++ template bug ??
- virtual Int32 FetchIndexOf(const T *inItem) const;
- virtual void Remove(const T* inItem);
-
- protected:
- Int32 mItemSize;
- Int32 mItemCount;
- T **mItemsH;
-
- virtual T* GetItemPtr(Int32 inAtIndex) const;
- virtual void PeekItem(Int32 inAtIndex, T *outItem) const;
- virtual void PokeItem(Int32 inAtIndex, const T *inItem);
-
- virtual void ShiftItems(Int32 inStartPos, Int32 inEndPos,
- Int32 inDestPos);
- };
-