2015-12-16 23:08:01 +01:00
|
|
|
#include "..\lib\collection.h"
|
|
|
|
|
|
|
|
struct _History {
|
|
|
|
collection items;
|
|
|
|
int active;
|
2015-12-16 23:48:58 +01:00
|
|
|
int add();
|
|
|
|
int back();
|
|
|
|
int forward();
|
2015-12-16 23:08:01 +01:00
|
|
|
dword current();
|
|
|
|
} History;
|
|
|
|
|
2015-12-16 23:48:58 +01:00
|
|
|
int _History::add(dword in)
|
2015-12-16 23:08:01 +01:00
|
|
|
{
|
|
|
|
if (!strcmp(in, items.get(active-1))) return 0;
|
|
|
|
items.count = active;
|
|
|
|
items.add(in);
|
|
|
|
active++;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-12-16 23:48:58 +01:00
|
|
|
int _History::back()
|
2015-12-16 23:08:01 +01:00
|
|
|
{
|
|
|
|
if (active==1) return 0;
|
|
|
|
active--;
|
2015-12-16 23:48:58 +01:00
|
|
|
return 1;
|
2015-12-16 23:08:01 +01:00
|
|
|
}
|
|
|
|
|
2015-12-16 23:48:58 +01:00
|
|
|
int _History::forward()
|
2015-12-16 23:08:01 +01:00
|
|
|
{
|
|
|
|
if (active==items.count) return 0;
|
|
|
|
active++;
|
2015-12-16 23:48:58 +01:00
|
|
|
return 1;
|
2015-12-16 23:08:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dword _History::current()
|
|
|
|
{
|
|
|
|
return items.get(active-1);
|
|
|
|
}
|