00001 // mk4io.h -- 00002 // $Id: mk4io.h,v 1.5 2003/11/23 01:42:50 wcvs Exp $ 00003 // This is part of Metakit, the homepage is https://www.equi4.com/metakit/ 00004 00009 #ifndef __MK4IO_H__ 00010 #define __MK4IO_H__ 00011 00012 #include <stdio.h> 00013 00016 00017 class c4_FileStream : public c4_Stream 00018 { 00019 public: 00020 c4_FileStream (FILE* stream_, bool owned_ =false); 00021 virtual ~c4_FileStream (); 00022 00023 virtual int Read(void* buffer_, int length_); 00024 virtual bool Write(const void* buffer_, int length_); 00025 00026 FILE* _stream; 00027 bool _owned; 00028 }; 00029 00032 00033 class c4_FileStrategy : public c4_Strategy 00034 { 00035 public: 00037 c4_FileStrategy (FILE* file_ =0); 00038 virtual ~c4_FileStrategy (); 00039 00041 virtual bool IsValid() const; 00043 virtual bool DataOpen(const char* fileName_, int mode_); 00045 virtual int DataRead(t4_i32 pos_, void* buffer_, int length_); 00047 virtual void DataWrite(t4_i32 pos_, const void* buffer_, int length_); 00049 virtual void DataCommit(t4_i32 newSize_); 00051 virtual void ResetFileMapping(); 00053 virtual t4_i32 FileSize(); 00055 virtual t4_i32 FreshGeneration(); 00056 00057 protected: 00059 FILE* _file; 00061 FILE* _cleanup; 00062 }; 00063 00065 00066 #endif // __MK4IO_H__