sub_section.hh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 I4_SUB_SECTION
  9. #define I4_SUB_SECTION
  10. #include "file/file.hh"
  11. /*
  12. The sub section file maps part of another file, it uses dup() on the other
  13. file so seeks and closes won't cause problems. The subsection file's offset 0,
  14. begins somewhere inside the other file and reads are only allowed in this area.
  15. */
  16. class i4_sub_section_file : public i4_file_class
  17. {
  18. i4_file_class *fp;
  19. int fstart, fsize, foffset;
  20. public:
  21. virtual w32 read (void *buffer, w32 size);
  22. virtual w32 write(const void *buffer, w32 size);
  23. virtual w32 seek (w32 offset);
  24. virtual w32 size ();
  25. virtual w32 tell ();
  26. virtual i4_bool async_read (void *buffer, w32 size,
  27. async_callback call,
  28. void *context=0);
  29. i4_sub_section_file(i4_file_class *fp, int start, int size);
  30. ~i4_sub_section_file();
  31. };
  32. #endif