00001 #ifndef __LDK_STDFILE_H__
00002 #define __LDK_STDFILE_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 <stdio.h>
00036
00037 #ifdef putc
00038 #undef putc
00039 #endif
00040
00041 #ifdef puts
00042 #undef puts
00043 #endif
00044
00045 #ifdef getc
00046 #undef getc
00047 #endif
00048
00049 namespace LDK
00050 {
00067 class LDK_API StdFile : public VFile
00068 {
00069 protected:
00070
00071 FILE *mFile;
00072 inline StdFile(const StdFile&) {}
00073 inline void operator=(const StdFile&) {}
00074
00075 public:
00076
00077 StdFile(FILE* f=NULL);
00078 virtual ~StdFile() 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 inline FILE* handle() { return mFile; }
00091
00092 virtual int64 read(void *buffer, uint32 objCount, uint32 objSize=1);
00093 virtual int32 getc();
00094 virtual int32 ungetc(char c);
00095
00096 virtual const char* gets(char* buffer, uint32 size);
00097
00098 virtual int64 write(const void *buffer, uint32 objCount, uint32 objSize=1);
00099 virtual int32 putc(char c);
00100 virtual int32 puts(const char* str);
00101 virtual int32 printf(const char* format, ...);
00102 virtual int32 vprintf(const char *format, va_list ap);
00103 };
00104
00105 }
00106 #endif //__LDK_STDFILE_H__