list.h
cowmud-0.11/src/list.h · 980 B
From the archive cowmud-0.11.tar.gz
Download the archive « Back to the archive contents
#ifndef _LIST_H_
#define _LIST_H_
//Linked List Node
template < class listItemType > struct listNode;
//Linked List Class
template < class listItemType > class List {
public:
// constructors and destructor:
List(); // default constructor
List(const List < listItemType > &L); // copy constructor
virtual ~ List(); // destructor
// list operations:
virtual bool isEmpty() const;
virtual int listLength() const;
virtual void listInsert(int newPosition, listItemType newItem);
virtual void listDelete(int position);
virtual void listRetrieve(int position, listItemType & dataItem) const;
virtual void listReplace(int position, listItemType & dataItem) const;
private:
int Size; // number of items in list
struct listNode <listItemType > *head; // pointer to linked list of items
struct listNode <listItemType > *ptrTo(int position) const; // returns pointer to position'th listitem
};
#include "list.cpp"
#endif