mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Refactor MxPtrList to use p_ownership
(#344)
* Refactor MxPtrList to use p_ownership * Remove class names
This commit is contained in:

committed by
GitHub

parent
db60467ba3
commit
afadca953b
@@ -10,12 +10,6 @@ class MxList;
|
||||
template <class T>
|
||||
class MxListCursor;
|
||||
|
||||
template <class T>
|
||||
class MxPtrList : public MxList<T*> {
|
||||
public:
|
||||
MxPtrList(void (*p_destroy)(T*) = Destroy) { m_customDestructor = p_destroy; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class MxListEntry {
|
||||
public:
|
||||
@@ -62,9 +56,9 @@ public:
|
||||
void Append(T p_obj) { InsertEntry(p_obj, this->m_last, NULL); };
|
||||
void DeleteAll(MxBool p_destroy = TRUE);
|
||||
MxU32 GetCount() { return this->m_count; }
|
||||
void SetDestroy(void (*p_customDestructor)(T)) { this->m_customDestructor = p_customDestructor; }
|
||||
|
||||
friend class MxListCursor<T>;
|
||||
using MxCollection<T>::SetDestroy;
|
||||
|
||||
protected:
|
||||
MxListEntry<T>* m_first; // 0x10
|
||||
@@ -74,6 +68,16 @@ protected:
|
||||
MxListEntry<T>* InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class MxPtrList : public MxList<T*> {
|
||||
public:
|
||||
MxPtrList(MxBool p_ownership) { SetOwnership(p_ownership); }
|
||||
|
||||
static void Destroy(T* p_obj) { delete p_obj; };
|
||||
|
||||
void SetOwnership(MxBool p_ownership) { SetDestroy(p_ownership ? Destroy : MxCollection<T*>::Destroy); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class MxListCursor : public MxCore {
|
||||
public:
|
||||
|
Reference in New Issue
Block a user