Rev 5974 | Rev 5979 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5977 | leency | 1 | #include "..\lib\collection.h" |
3363 | leency | 2 | |
5977 | leency | 3 | struct _History { |
4 | collection items; |
||
5 | int active; |
||
6 | dword add(); |
||
7 | dword back(); |
||
8 | dword forward(); |
||
9 | dword current(); |
||
10 | } History; |
||
3363 | leency | 11 | |
5977 | leency | 12 | dword _History::add(dword in) |
3363 | leency | 13 | { |
5977 | leency | 14 | if (!strcmp(in, items.get(active-1))) return 0; |
15 | items.count = active; |
||
16 | items.add(in); |
||
17 | active++; |
||
5974 | leency | 18 | return 1; |
3363 | leency | 19 | } |
5974 | leency | 20 | |
5977 | leency | 21 | dword _History::back() |
5974 | leency | 22 | { |
5977 | leency | 23 | if (active==1) return 0; |
24 | active--; |
||
25 | return items.get(active-1); |
||
5974 | leency | 26 | } |
3363 | leency | 27 | |
5977 | leency | 28 | dword _History::forward() |
3363 | leency | 29 | { |
5977 | leency | 30 | if (active==items.count) return 0; |
31 | active++; |
||
32 | return items.get(active-1); |
||
33 | } |
||
34 | |||
35 | dword _History::current() |
||
36 | { |
||
37 | return items.get(active-1); |
||
3363 | leency | 38 | } |