Subversion Repositories Kolibri OS

Rev

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

  1. enum {
  2.         PAGE=1, IMG
  3. };
  4.  
  5. struct _cache
  6. {
  7.         dword current_buf;
  8.         dword current_size;
  9.         collection url;
  10.         collection_int data;
  11.         collection_int size;
  12.         collection_int type;
  13.         void add();
  14.         bool has();
  15.         void clear();
  16. } cache=0;
  17.  
  18. void _cache::add(dword _url, _data, _size, _type)
  19. {
  20.         dword data_pointer;
  21.         data_pointer = malloc(_size);
  22.         memmov(data_pointer, _data, _size);
  23.         data.add(data_pointer);
  24.  
  25.         url.add(_url);
  26.         size.add(_size);
  27.         type.add(_type);
  28. }
  29.  
  30. bool _cache::has(dword _link)
  31. {
  32.         int pos;
  33.         pos = url.get_pos_by_name(_link);
  34.         if (pos != -1) {
  35.                 current_buf = data.get(pos);
  36.                 current_size = size.get(pos);
  37.                 return true;
  38.         }
  39.         return false;
  40. }
  41.  
  42. void _cache::clear()
  43. {
  44.         url.drop();
  45.         data.drop();
  46.         size.drop();
  47.         current_buf = NULL;
  48.         current_size = NULL;
  49. }