[80] | 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 |
|
---|
| 9 | #ifndef I4_DIR_SAVE_HH
|
---|
| 10 | #define I4_DIR_SAVE_HH
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | #include "file/file.hh"
|
---|
| 14 | #include "memory/array.hh"
|
---|
| 15 |
|
---|
| 16 | struct i4_saver_section_type
|
---|
| 17 | {
|
---|
| 18 | w32 section_id;
|
---|
| 19 | w32 section_offset;
|
---|
| 20 | i4_saver_section_type(w32 section_id, w32 section_offset)
|
---|
| 21 | : section_offset(section_offset), section_id(section_id) {}
|
---|
| 22 | };
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | class i4_saver_class : public i4_file_class
|
---|
| 26 | {
|
---|
| 27 | protected:
|
---|
| 28 | enum { DIRECTORY_CREATE, DATA_WRITE, DATA_LOAD } state;
|
---|
| 29 |
|
---|
| 30 | w32 current_offset, last_version_start, current_skip;
|
---|
| 31 |
|
---|
| 32 | i4_file_class *out;
|
---|
| 33 | i4_bool close_on_delete;
|
---|
| 34 |
|
---|
| 35 | i4_array<w16> skips;
|
---|
| 36 | i4_array<i4_saver_section_type> sections;
|
---|
| 37 | i4_array<w32> sizes;
|
---|
| 38 | int marker_on;
|
---|
| 39 |
|
---|
| 40 | public:
|
---|
| 41 | i4_saver_class(i4_file_class *out, i4_bool close_on_delete=i4_T);
|
---|
| 42 |
|
---|
| 43 | int mark_size();
|
---|
| 44 | void end_mark_size(int marker_number);
|
---|
| 45 |
|
---|
| 46 | void mark_section(w32 section_id);
|
---|
| 47 | void mark_section(char *section_name); // calls above with checksum of name
|
---|
| 48 |
|
---|
| 49 | void start_version(w16 version);
|
---|
| 50 | void end_version();
|
---|
| 51 |
|
---|
| 52 | i4_bool begin_data_write(); // returns false if error occured
|
---|
| 53 |
|
---|
| 54 | virtual w32 read (void *buffer, w32 size);
|
---|
| 55 | virtual w32 write(const void *buffer, w32 size);
|
---|
| 56 |
|
---|
| 57 | virtual w32 seek (w32 offset) { return out->seek(offset); }
|
---|
| 58 | virtual w32 size () { return out->size(); }
|
---|
| 59 | virtual w32 tell ();
|
---|
| 60 |
|
---|
| 61 | virtual ~i4_saver_class();
|
---|
| 62 | };
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | #endif
|
---|