00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXMEMMAP_H
00022 #define FXMEMMAP_H
00023
00024
00025 #ifndef FXFILE_H
00026 #include "FXFile.h"
00027 #endif
00028
00029 namespace FX {
00030
00031
00040 class FXAPI FXMemMap : public FXFile {
00041 private:
00042 FXInputHandle maphandle;
00043 FXuchar* mapbase;
00044 FXlong mapoffset;
00045 FXlong mapposition;
00046 FXival maplength;
00047 private:
00048 FXMemMap(const FXMemMap&);
00049 FXMemMap &operator=(const FXMemMap&);
00050 public:
00051
00053 FXMemMap();
00054
00056 void* openMap(const FXString& filename,FXlong off=0,FXival len=-1L,FXuint m=FXIO::Reading,FXuint p=FXIO::AllReadWrite);
00057
00059 void* openMap(FXInputHandle h,FXlong off=0,FXival len=-1L,FXuint m=FXIO::Reading);
00060
00062 void *map(FXlong off=0,FXival len=-1L);
00063
00065 void* base() const { return mapbase; }
00066
00068 FXival length() const { return maplength; }
00069
00071 FXlong offset() const { return mapoffset; }
00072
00074 virtual FXlong position() const;
00075
00077 virtual FXlong position(FXlong off,FXuint from=FXIO::Begin);
00078
00080 void* unmap();
00081
00083 virtual FXival readBlock(void* data,FXival count);
00084
00086 virtual FXival writeBlock(const void* data,FXival count);
00087
00089 virtual FXbool flush();
00090
00092 virtual FXbool close();
00093
00095 ~FXMemMap();
00096 };
00097
00098
00099 }
00100
00101 #endif