Files
tp/include/JSystem/JSupport/JSUList/JSUList.h
T
Jonathan Wase ac6b191dc1 Improved handling of virtual inheritance. (#7)
* new system for handling vtables

* commented out non-matching JKRDisposer::~JKDisposer()

* removed artificial vtables and matched simple virtual-call functions

* better text on nonmatching functions

* reverted asmdiff.sh

* attempt 2

* Spelling

* banner and .gitignore for vtable artifacts

* move virtual function to the correct class

* remove unnecessary casts
2020-12-01 15:18:01 -05:00

59 lines
1.0 KiB
C++

#ifndef __JSULIST_H__
#define __JSULIST_H__
#include "dolphin/types.h"
class JSUPtrList;
class JSUPtrLink {
public:
JSUPtrLink(void* owner);
~JSUPtrLink();
public:
void* owner;
JSUPtrList* list;
JSUPtrLink* prev;
JSUPtrLink* next;
};
class JSUPtrList {
public:
JSUPtrList(bool should_initiate);
~JSUPtrList();
void initiate();
void setFirst(JSUPtrLink* first);
bool append(JSUPtrLink* ptr);
bool prepend(JSUPtrLink* ptr);
bool insert(JSUPtrLink* before, JSUPtrLink* ptr);
bool remove(JSUPtrLink* ptr);
JSUPtrLink* getNthLink(u32 i) const;
public:
JSUPtrLink* head;
JSUPtrLink* tail;
u32 length;
};
template <typename T>
class JSUList : JSUPtrList {
public:
JSUList() : JSUPtrList(true) {
}
~JSUList(){};
void append(T* value) {
list.append(&value->ptr_link);
}
void prepend(T* value) {
list.prepend(&value->ptr_link);
}
void remove(T* value) {
list.remove(&value->ptr_link);
}
};
#endif