summaryrefslogtreecommitdiff
path: root/common/array.h
diff options
context:
space:
mode:
authorleo2005-07-14 05:10:57 +0000
committerleo2005-07-14 05:10:57 +0000
commite3b7ec77734b8f415f9c756f0d7bf90ff202e71e (patch)
tree741fd8c82177a499308de47bd94453d9bdc5e229 /common/array.h
parent7c16eadee05cfe3115ac0a69a822c66f1b3e292f (diff)
Changed the pieces list to a tree sorted by categories.
git-svn-id: http://svn.leocad.org/trunk@414 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/array.h')
-rwxr-xr-xcommon/array.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/common/array.h b/common/array.h
index c8adfbf..64f82f9 100755
--- a/common/array.h
+++ b/common/array.h
@@ -4,30 +4,33 @@
template <class T>
class PtrArray
{
- public:
- PtrArray (int nSize = 0);
- ~PtrArray ();
+public:
+ PtrArray(int nSize = 0);
+ ~PtrArray();
- typedef int (*LC_PTRARRAY_COMPARE_FUNC) (T* a, T* b, void* data);
+ typedef int (*LC_PTRARRAY_COMPARE_FUNC)(T* a, T* b, void* data);
- int GetSize () const
- { return m_nLength; }
+ int GetSize() const
+ { return m_nLength; }
- T* RemoveIndex (int nIndex);
- T* RemovePointer (T* pObj);
- void Add (T* pObj);
- void AddSorted (T* pObj, LC_PTRARRAY_COMPARE_FUNC pFunc, void* pData);
- void InsertAt (int nIndex, T* pObj);
+ T* RemoveIndex(int nIndex);
+ T* RemovePointer(T* pObj);
+ void RemoveAll();
+ void Add(T* pObj);
+ void AddSorted(T* pObj, LC_PTRARRAY_COMPARE_FUNC pFunc, void* pData);
+ void InsertAt(int nIndex, T* pObj);
+ int FindIndex(T* Obj) const;
- T* operator [](int nIndex) const
- { return m_pData[nIndex]; }
+ PtrArray<T>& operator=(const PtrArray<T>& Array);
+ T* operator [](int nIndex) const
+ { return m_pData[nIndex]; }
- protected:
- void Expand (int nGrow);
+protected:
+ void Expand(int nGrow);
- T** m_pData;
- int m_nLength;
- int m_nAlloc;
+ T** m_pData;
+ int m_nLength;
+ int m_nAlloc;
};
template <class T>
@@ -43,6 +46,7 @@ public:
{ return m_Length; }
void RemoveIndex(int Index);
+ void RemoveAll();
void Add(const T& Obj);
void AddSorted(const T& Obj, LC_OBJARRAY_COMPARE_FUNC Func, void* SortData);
void InsertAt(int Index, const T& Obj);