/*	Table widget for FLTK-2
	class Collecton holds integer key-value pairs
	Copyright(C) 2007 Alex Ivanov
	http://www.aleksoft.net
*/

#include <malloc.h>

#if not defined uint
#define uint unsigned int
#endif
struct KeyValue
{
	int key;
	int value;
};

class Collection 
{
public:
	Collection(int defaultValue=0);
	~Collection();
	void add(int key, int value);
	void clear();
	int key(uint index); // Get key by index
	int value(int key); // Get by key
	int value(uint index); // Get by index
	void value(int key, int value);
	void setDefault(int newVal); // if the requested key is not present
	int getDefault();
	int count();
private:
	KeyValue* data; // defined Key-Value pairs
	int count_; // # of entries in the collection
	int default_; //default returned if a requested key is not present
};
