#ifndef LISTNODE_H
#define LISTNODE_H

#include "extdll.h"
#include "util.h" 
#include "cbase.h"

/* The ListList is a simple linked-list class designed to hold StrBufs and Entities.
 * It could doubtless be replaced with something better. */

/* a ListNode is a single element of a ListList. */
class ListNode  
{
public:
	ListNode(); //Create an empty ListNode.
	ListNode(StrBuf); //Create a ListNode holding this StrBuf.
	ListNode(CBaseEntity* tent); //Create a ListNode holding this CBE*.
	void Clean(); //Destroy this ListNode and Clean() the next one.
	virtual ~ListNode();

	StrBuf buf; //If the node holds a StrBuf, this is it.
	ListNode* next; //This is the next node in the list.
	CBaseEntity* ent; //If the node holds an ent, this is it.

};

/* And here's the ListList class: */
class ListList
{
public:
	CBaseEntity* EPop(); //Pop a node from the list and return its "ent" value.
	StrBuf SPop(); //Pop a node from the list and return its "buf" value.
	void Append(CBaseEntity*); //Append an ent-containing node to the list.
	void Append(StrBuf); //Append a StrBuf-containing node to the list.
	void EKill(CBaseEntity*); //Remove the node containing this pointer from the list.
	ListList();
	virtual ~ListList();

	ListNode* head; //First node in the list.
	ListNode* tail; //Last node in the list.
};

#endif
