2015-12-16 23:08:01 +01:00
|
|
|
#include "..\lib\collection.h"
|
|
|
|
|
2016-01-01 17:51:53 +01:00
|
|
|
struct _history {
|
2015-12-16 23:08:01 +01:00
|
|
|
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();
|
2020-03-29 12:57:14 +02:00
|
|
|
};
|
2015-12-16 23:08:01 +01:00
|
|
|
|
2016-01-01 17:51:53 +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;
|
|
|
|
}
|
|
|
|
|
2016-01-01 17:51:53 +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
|
|
|
}
|
|
|
|
|
2016-01-01 17:51:53 +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
|
|
|
}
|
|
|
|
|
2016-01-01 17:51:53 +01:00
|
|
|
dword _history::current()
|
2015-12-16 23:08:01 +01:00
|
|
|
{
|
|
|
|
return items.get(active-1);
|
|
|
|
}
|