Subversion Repositories Kolibri OS

Rev

Rev 6021 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include "..\lib\collection.h"
  2.  
  3. struct _history {
  4.         collection items;
  5.         int active;    
  6.         int add();
  7.         int back();
  8.         int forward();
  9.         dword current();
  10. };
  11.  
  12. int _history::add(dword in)
  13. {
  14.         if (!strcmp(in, items.get(active-1))) return 0;
  15.         items.count = active;
  16.         items.add(in);
  17.         active++;
  18.         return 1;
  19. }
  20.        
  21. int _history::back()
  22. {
  23.         if (active==1) return 0;
  24.         active--;
  25.         return 1;
  26. }
  27.  
  28. int _history::forward()
  29. {
  30.         if (active==items.count) return 0;
  31.         active++;
  32.         return 1;
  33. }
  34.  
  35. dword _history::current()
  36. {
  37.         return items.get(active-1);
  38. }