diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-27 18:16:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-27 18:16:39 +0300 |
commit | 6388446b85e1fa5deccc6d5c1683fba88ef53d99 (patch) | |
tree | daaa6c764a34aece74de45dddc5b1e276d61774d /src/fs/virtfsdir.cpp | |
parent | 757069bdedabbd904e56d153e2e858db2a2cf2f1 (diff) | |
download | mv-6388446b85e1fa5deccc6d5c1683fba88ef53d99.tar.gz mv-6388446b85e1fa5deccc6d5c1683fba88ef53d99.tar.bz2 mv-6388446b85e1fa5deccc6d5c1683fba88ef53d99.tar.xz mv-6388446b85e1fa5deccc6d5c1683fba88ef53d99.zip |
Add functions pointers into VirtFile.
From VirtFs call if possible pointer from VirtFile.
Diffstat (limited to 'src/fs/virtfsdir.cpp')
-rw-r--r-- | src/fs/virtfsdir.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/fs/virtfsdir.cpp b/src/fs/virtfsdir.cpp index 249317773..3950aa18c 100644 --- a/src/fs/virtfsdir.cpp +++ b/src/fs/virtfsdir.cpp @@ -27,6 +27,7 @@ #include "fs/virtfs.h" #include "fs/virtfile.h" #include "fs/virtfileprivate.h" +#include "fs/virtfsfuncs.h" #include "fs/virtlist.h" #include "utils/checkutils.h" @@ -50,6 +51,7 @@ namespace std::vector<VirtDirEntry*> mEntries; std::string mWriteDir; bool mPermitLinks = false; + VirtFsFuncs funcs; } // namespace namespace VirtFsDir @@ -79,7 +81,7 @@ namespace VirtFsDir filename.c_str()); return nullptr; } - VirtFile *restrict const file = new VirtFile; + VirtFile *restrict const file = new VirtFile(&funcs); file->mPrivate = new VirtFilePrivate(fd); return file; @@ -250,6 +252,22 @@ namespace VirtFsDir mEntries.clear(); } + void init() + { + initFuncs(&funcs); + } + + void initFuncs(VirtFsFuncs *restrict const ptr) + { + ptr->close = &VirtFsDir::close; + ptr->read = &VirtFsDir::read; + ptr->write = &VirtFsDir::write; + ptr->fileLength = &VirtFsDir::fileLength; + ptr->tell = &VirtFsDir::tell; + ptr->seek = &VirtFsDir::seek; + ptr->eof = &VirtFsDir::eof; + } + std::string getRealDir(const std::string &restrict filename) { if (checkPath(filename) == false) |