mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-22 06:43:28 +03:00
672bbcf6a0
git-svn-id: svn://kolibrios.org@7771 a494cfbc-eb01-0410-851d-a64ba20cac60
46 lines
625 B
C
46 lines
625 B
C
#include "..\lib\collection.h"
|
|
|
|
struct _history {
|
|
collection items;
|
|
int active;
|
|
void clear();
|
|
int add();
|
|
int back();
|
|
int forward();
|
|
dword current();
|
|
};
|
|
|
|
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);
|
|
}
|
|
|
|
:void _history::clear()
|
|
{
|
|
items.drop();
|
|
active=0;
|
|
}
|