Rev 6021 | 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 | |
6021 | leency | 3 | struct _history { |
5977 | leency | 4 | collection items; |
5 | int active; |
||
5979 | leency | 6 | int add(); |
7 | int back(); |
||
8 | int forward(); |
||
5977 | leency | 9 | dword current(); |
7757 | leency | 10 | }; |
3363 | leency | 11 | |
6021 | leency | 12 | int _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 | |
6021 | leency | 21 | int _history::back() |
5974 | leency | 22 | { |
5977 | leency | 23 | if (active==1) return 0; |
24 | active--; |
||
5979 | leency | 25 | return 1; |
5974 | leency | 26 | } |
3363 | leency | 27 | |
6021 | leency | 28 | int _history::forward() |
3363 | leency | 29 | { |
5977 | leency | 30 | if (active==items.count) return 0; |
31 | active++; |
||
5979 | leency | 32 | return 1; |
5977 | leency | 33 | } |
34 | |||
6021 | leency | 35 | dword _history::current() |
5977 | leency | 36 | { |
37 | return items.get(active-1); |
||
3363 | leency | 38 | } |