Ignore:
Timestamp:
01/15/15 22:43:01 (9 years ago)
Author:
Maciej Komosinski
Message:

Reorganizations and extensions of directory/file/filesystem IO classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/virtfile/stdiofile.h

    r286 r295  
    88#include "virtfile.h"
    99#include <frams/util/sstring.h>
    10 #ifdef USE_MFILE
    1110#include <common/nonstd_stdio.h>
    12 #else
    13 #include <stdio.h>
    14 #endif
    1511#include <common/nonstd_dir.h>
    1612
     
    1915public:
    2016        VirtFILE *Vfopen(const char *path, const char *mode);
    21         int Vfexists(const char* path);
     17        bool Vfexists(const char* path);
    2218        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); }
    2321};
    2422
     
    2826protected:
    2927        MFILE *file;
    30         SString path;
    3128public:
    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; }
    3431        static void setStdio();
    3532        size_t Vread(void *ptr, size_t size, size_t nmemb) { return mfread(ptr, size, nmemb, file); }
     
    4138        long Vtell() { return mftell(file); }
    4239        int Vflush() { return 0; /*NOT IMPLEMENTED!*/ }
    43         const char* VgetPath() { return path; }
    4440
    4541        ~StdioFILE() { if (file) mfclose(file); }
     
    5046protected:
    5147        FILE *file;
    52         SString path;
    5348public:
    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; }
    5651        static void setStdio();
    5752        size_t Vread(void *ptr, size_t size, size_t nmemb) { return fread(ptr, size, nmemb, file); }
     
    6762        void Vrewind() { rewind(file); }
    6863        int Vflush() { return fflush(file); }
    69         const char* VgetPath() { return path; }
    7064
    7165        ~StdioFILE() { if (file) fclose(file); }
Note: See TracChangeset for help on using the changeset viewer.