diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/nde/LinkedList.h | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/nde/LinkedList.h')
-rw-r--r-- | Src/nde/LinkedList.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Src/nde/LinkedList.h b/Src/nde/LinkedList.h new file mode 100644 index 00000000..4fffddaf --- /dev/null +++ b/Src/nde/LinkedList.h @@ -0,0 +1,82 @@ +/* --------------------------------------------------------------------------- + Nullsoft Database Engine + -------------------- + codename: Near Death Experience + --------------------------------------------------------------------------- */ + +/* --------------------------------------------------------------------------- + + Double-Linked List Class Prototypes + + --------------------------------------------------------------------------- */ + +#ifndef __LINKEDLIST_H +#define __LINKEDLIST_H + +class LinkedListEntry +{ +public: + LinkedListEntry *Next; + LinkedListEntry *Previous; +public: + LinkedListEntry *GetNext() const; + LinkedListEntry *GetPrevious() const; + LinkedListEntry(); + virtual ~LinkedListEntry(); +}; + +template <class T> class VListEntry : public LinkedListEntry +{ +public: + void SetVal(T val) + { + Val = val; + } + T GetVal(void) + { + return Val; + } + +private: + T Val; +}; + +template <class T> class PListEntry : public LinkedListEntry +{ +public: + void SetVal(T *val) + { + Val = val; + } + T *GetVal(void) + { + return Val; + } + +private: + T *Val; +}; + + +typedef bool (*WalkListProc)(LinkedListEntry *Entry, int, void*, void*); + +class LinkedList +{ +protected: + int NElements; + LinkedListEntry *Head; + LinkedListEntry *Foot; + +public: + LinkedList(); + ~LinkedList(); + void AddEntry(LinkedListEntry *Entry, bool Cat); + void RemoveEntry(LinkedListEntry *Entry); + + void WalkList(WalkListProc WalkProc, int ID, void *Data1, void *Data2); + int GetNElements(void) { return NElements; } + LinkedListEntry *GetHead(void) { return Head; } + LinkedListEntry *GetFoot(void) { return Foot; } +}; + +#endif
\ No newline at end of file |