00001 #ifndef __LDK_PHYSFSFILE_H__
00002 #define __LDK_PHYSFSFILE_H__
00003
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028
00033
00034 #include "LDK/VFile.h"
00035 #include <physfs.h>
00036
00037 namespace LDK
00038 {
00065 class LDK_API PhysFSFile : public VFile
00066 {
00067 protected:
00068
00069 PHYSFS_file* mFile;
00070 int mUnget;
00071 int64 mPos;
00072
00073 void resetPos();
00074
00075 public:
00076
00077 PhysFSFile(PHYSFS_file* file=NULL);
00078 virtual ~PhysFSFile() throw();
00079
00080 virtual void openRead(const char* fileName, bool text=false);
00081 virtual void openWrite(const char* fileName, bool text=false);
00082 virtual void openAppend(const char* fileName, bool text=false);
00083 virtual int64 length();
00084 virtual void close();
00085
00086 virtual bool eof();
00087 virtual int64 tell();
00088 virtual int64 seek(int64 offset, int whence);
00089 virtual void flush();
00090
00091 inline PHYSFS_file* handle() { return mFile; }
00092
00093
00094
00095 virtual int64 read(void *buffer, uint32 objCount, uint32 objSize=1);
00096 virtual int32 getc();
00097
00098 virtual int32 ungetc(char c);
00099
00100 virtual const char* gets(char* buffer, uint32 size);
00101
00102
00103 virtual int64 write(const void *buffer, uint32 objCount, uint32 objSize=1);
00104 virtual int32 putc(char c);
00105 virtual int32 puts(const char* str);
00106 virtual int32 printf(const char* format, ...);
00107 virtual int32 vprintf(const char *format, va_list ap);
00108 };
00109
00110 }
00111
00112 #endif //__LDK_PHYSFSFILE_H__