Changeset 295 for cpp/frams/virtfile/stdiofile.h
- Timestamp:
- 01/15/15 22:43:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/virtfile/stdiofile.h
r286 r295 8 8 #include "virtfile.h" 9 9 #include <frams/util/sstring.h> 10 #ifdef USE_MFILE11 10 #include <common/nonstd_stdio.h> 12 #else13 #include <stdio.h>14 #endif15 11 #include <common/nonstd_dir.h> 16 12 … … 19 15 public: 20 16 VirtFILE *Vfopen(const char *path, const char *mode); 21 intVfexists(const char* path);17 bool Vfexists(const char* path); 22 18 VirtDIR *Vopendir(const char* path); 19 bool Vmkdir(const char* path) { return makeDirectory(path); } 20 bool Vdirexists(const char* path,bool is_writable) { return directoryExists(path,is_writable); } 23 21 }; 24 22 … … 28 26 protected: 29 27 MFILE *file; 30 SString path;31 28 public: 32 StdioFILE(MFILE *f) { file = f; }33 StdioFILE(MFILE *f, const SString& p) { file = f; path = p; }29 StdioFILE(MFILE *f):VirtFILE("") { file = f; } 30 StdioFILE(MFILE *f, const SString& p):VirtFILE(p) { file = f; } 34 31 static void setStdio(); 35 32 size_t Vread(void *ptr, size_t size, size_t nmemb) { return mfread(ptr, size, nmemb, file); } … … 41 38 long Vtell() { return mftell(file); } 42 39 int Vflush() { return 0; /*NOT IMPLEMENTED!*/ } 43 const char* VgetPath() { return path; }44 40 45 41 ~StdioFILE() { if (file) mfclose(file); } … … 50 46 protected: 51 47 FILE *file; 52 SString path;53 48 public: 54 StdioFILE(FILE *f) { file = f; }55 StdioFILE(FILE *f, const SString& p) { file = f; path = p; }49 StdioFILE(FILE *f):VirtFILE("") { file = f; } 50 StdioFILE(FILE *f, const SString& p):VirtFILE(p) { file = f; } 56 51 static void setStdio(); 57 52 size_t Vread(void *ptr, size_t size, size_t nmemb) { return fread(ptr, size, nmemb, file); } … … 67 62 void Vrewind() { rewind(file); } 68 63 int Vflush() { return fflush(file); } 69 const char* VgetPath() { return path; }70 64 71 65 ~StdioFILE() { if (file) fclose(file); }
Note: See TracChangeset
for help on using the changeset viewer.