Subversion Repositories Kolibri OS

Rev

Rev 7757 | 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.         void clear();
  7.         int add();
  8.         int back();
  9.         int forward();
  10.         dword current();
  11. };
  12.  
  13. int _history::add(dword in)
  14. {
  15.         if (!strcmp(in, items.get(active-1))) return 0;
  16.         items.count = active;
  17.         items.add(in);
  18.         active++;
  19.         return 1;
  20. }
  21.        
  22. int _history::back()
  23. {
  24.         if (active==1) return 0;
  25.         active--;
  26.         return 1;
  27. }
  28.  
  29. int _history::forward()
  30. {
  31.         if (active==items.count) return 0;
  32.         active++;
  33.         return 1;
  34. }
  35.  
  36. dword _history::current()
  37. {
  38.         return items.get(active-1);
  39. }
  40.  
  41. :void _history::clear()
  42. {
  43.         items.drop();
  44.         active=0;
  45. }
  46.