buf_file.hh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /********************************************************************** <BR>
  2. This file is part of Crack dot Com's free source code release of
  3. Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
  4. information about compiling & licensing issues visit this URL</a>
  5. <PRE> If that doesn't help, contact Jonathan Clark at
  6. golgotha_source@usa.net (Subject should have "GOLG" in it)
  7. ***********************************************************************/
  8. #ifndef __I4BUF_FILE_HPP
  9. #define __I4BUF_FILE_HPP
  10. #include "file/file.hh"
  11. // This file provides buffering for another i4_file_class
  12. class i4_buffered_file_class : public i4_file_class
  13. {
  14. protected:
  15. friend void i4_async_buf_read_callback(w32 count, void *context);
  16. i4_file_class *from;
  17. void *buf;
  18. w32 buf_size,buf_start,buf_end,offset;
  19. i4_bool write_file;
  20. public:
  21. i4_buffered_file_class(i4_file_class *from,
  22. w32 buffer_size=0x1000,
  23. w32 current_offset=0);
  24. virtual w32 read (void *buffer, w32 size);
  25. virtual w32 write(const void *buffer, w32 size);
  26. virtual w32 seek (w32 offset);
  27. virtual w32 size ();
  28. virtual w32 tell ();
  29. virtual i4_bool async_read (void *buffer, w32 size,
  30. async_callback call,
  31. void *context);
  32. ~i4_buffered_file_class();
  33. };
  34. #endif