kolibrios-gitea/programs/cmm/lib/patterns/history.h
Kirill Lipatov (Leency) e6ee9c8f61 Fix liza
git-svn-id: svn://kolibrios.org@5979 a494cfbc-eb01-0410-851d-a64ba20cac60
2015-12-16 22:48:58 +00:00

38 lines
554 B
C

#include "..\lib\collection.h"
struct _History {
collection items;
int active;
int add();
int back();
int forward();
dword current();
} History;
int _History::add(dword in)
{
if (!strcmp(in, items.get(active-1))) return 0;
items.count = active;
items.add(in);
active++;
return 1;
}
int _History::back()
{
if (active==1) return 0;
active--;
return 1;
}
int _History::forward()
{
if (active==items.count) return 0;
active++;
return 1;
}
dword _History::current()
{
return items.get(active-1);
}