From aa549268c57e8dd7478693b160b7aadb35ff2e09 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 5 May 2017 02:13:49 +0300 Subject: Rename virtfsentry into fsentry. --- src/CMakeLists.txt | 8 ++--- src/Makefile.am | 4 +-- src/fs/virtfs/direntry.cpp | 2 +- src/fs/virtfs/direntry.h | 4 +-- src/fs/virtfs/fsentry.cpp | 40 ++++++++++++++++++++++ src/fs/virtfs/fsentry.h | 53 +++++++++++++++++++++++++++++ src/fs/virtfs/virtfs.cpp | 76 +++++++++++++++++++++--------------------- src/fs/virtfs/virtfs.h | 14 ++++---- src/fs/virtfs/virtfsdir.cpp | 24 ++++++------- src/fs/virtfs/virtfsdir.h | 26 +++++++-------- src/fs/virtfs/virtfsentry.cpp | 40 ---------------------- src/fs/virtfs/virtfsentry.h | 53 ----------------------------- src/fs/virtfs/virtfsfuncs.h | 24 ++++++------- src/fs/virtfs/virtfszip.cpp | 22 ++++++------ src/fs/virtfs/virtfszip.h | 24 ++++++------- src/fs/virtfs/virtzipentry.cpp | 2 +- src/fs/virtfs/virtzipentry.h | 4 +-- 17 files changed, 210 insertions(+), 210 deletions(-) create mode 100644 src/fs/virtfs/fsentry.cpp create mode 100644 src/fs/virtfs/fsentry.h delete mode 100644 src/fs/virtfs/virtfsentry.cpp delete mode 100644 src/fs/virtfs/virtfsentry.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b15792876..fdd390b5f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -906,8 +906,8 @@ SET(SRCS fs/virtfs/virtfsdir.h fs/virtfs/virtfsdirrwops.cpp fs/virtfs/virtfsdirrwops.h - fs/virtfs/virtfsentry.cpp - fs/virtfs/virtfsentry.h + fs/virtfs/fsentry.cpp + fs/virtfs/fsentry.h fs/virtfs/virtfszip.cpp fs/virtfs/virtfszip.h fs/virtfs/virtfsziprwops.cpp @@ -1815,8 +1815,8 @@ SET(DYE_CMD_SRCS fs/virtfs/virtfsdir.h fs/virtfs/virtfsdirrwops.cpp fs/virtfs/virtfsdirrwops.h - fs/virtfs/virtfsentry.cpp - fs/virtfs/virtfsentry.h + fs/virtfs/fsentry.cpp + fs/virtfs/fsentry.h fs/virtfs/virtfszip.cpp fs/virtfs/virtfszip.h fs/virtfs/virtfsziprwops.cpp diff --git a/src/Makefile.am b/src/Makefile.am index b9682f459..5f5f1ce80 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -854,8 +854,8 @@ BASE_SRC += events/actionevent.h \ fs/virtfs/virtfsdir.h \ fs/virtfs/virtfsdirrwops.cpp \ fs/virtfs/virtfsdirrwops.h \ - fs/virtfs/virtfsentry.cpp \ - fs/virtfs/virtfsentry.h \ + fs/virtfs/fsentry.cpp \ + fs/virtfs/fsentry.h \ fs/virtfs/virtfszip.cpp \ fs/virtfs/virtfszip.h \ fs/virtfs/virtfsziprwops.cpp \ diff --git a/src/fs/virtfs/direntry.cpp b/src/fs/virtfs/direntry.cpp index 5616a6577..618d3675d 100644 --- a/src/fs/virtfs/direntry.cpp +++ b/src/fs/virtfs/direntry.cpp @@ -28,7 +28,7 @@ namespace VirtFs DirEntry::DirEntry(const std::string &userDir0, const std::string &rootDir, VirtFsFuncs *restrict const funcs0) : - VirtFsEntry(FsEntryType::Dir, funcs0), + FsEntry(FsEntryType::Dir, funcs0), userDir(userDir0) { root = rootDir; diff --git a/src/fs/virtfs/direntry.h b/src/fs/virtfs/direntry.h index fa5eabb16..c803093c1 100644 --- a/src/fs/virtfs/direntry.h +++ b/src/fs/virtfs/direntry.h @@ -21,14 +21,14 @@ #ifndef UTILS_VIRTDIRENTRY_H #define UTILS_VIRTDIRENTRY_H -#include "fs/virtfs/virtfsentry.h" +#include "fs/virtfs/fsentry.h" #include "localconsts.h" namespace VirtFs { -struct DirEntry final : public VirtFsEntry +struct DirEntry final : public FsEntry { DirEntry(const std::string &userDir, const std::string &rootDir, diff --git a/src/fs/virtfs/fsentry.cpp b/src/fs/virtfs/fsentry.cpp new file mode 100644 index 000000000..10d84415b --- /dev/null +++ b/src/fs/virtfs/fsentry.cpp @@ -0,0 +1,40 @@ +/* + * The ManaPlus Client + * Copyright (C) 2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "fs/virtfs/fsentry.h" + +#include "debug.h" + +namespace VirtFs +{ + +FsEntry::FsEntry(const FsEntryTypeT &type0, + VirtFsFuncs *restrict const funcs0) : + root(), + type(type0), + funcs(funcs0) +{ +} + +FsEntry::~FsEntry() +{ +} + +} // namespace VirtFs diff --git a/src/fs/virtfs/fsentry.h b/src/fs/virtfs/fsentry.h new file mode 100644 index 000000000..4cadd92e5 --- /dev/null +++ b/src/fs/virtfs/fsentry.h @@ -0,0 +1,53 @@ +/* + * The ManaPlus Client + * Copyright (C) 2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef UTILS_VIRTFSENTRY_H +#define UTILS_VIRTFSENTRY_H + +#include "enums/fs/fsentrytype.h" + +#include + +#include "localconsts.h" + +namespace VirtFs +{ + +struct VirtFsFuncs; + +struct FsEntry notfinal +{ + FsEntry(const FsEntryTypeT &type0, + VirtFsFuncs *restrict const funcs); + + A_DELETE_COPY(FsEntry) + + ~FsEntry(); + + std::string root; + + FsEntryTypeT type; + + VirtFsFuncs *funcs; +}; + +} // namespace VirtFs + +#endif // UTILS_VIRTFSENTRY_H diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp index d98a0b56a..fae3bc908 100644 --- a/src/fs/virtfs/virtfs.cpp +++ b/src/fs/virtfs/virtfs.cpp @@ -49,7 +49,7 @@ namespace VirtFs { namespace { - std::vector mEntries; + std::vector mEntries; } // namespace void init(const std::string &restrict name) @@ -83,14 +83,14 @@ namespace VirtFs return VirtFsDir::getUserDir(); } - std::vector &getEntries() + std::vector &getEntries() { return mEntries; } - VirtFsEntry *searchEntryByRootInternal(const std::string &restrict root) + FsEntry *searchEntryByRootInternal(const std::string &restrict root) { - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { if ((*it)->root == root) return *it; @@ -98,12 +98,12 @@ namespace VirtFs return nullptr; } - VirtFsEntry *searchEntryInternal(const std::string &restrict root, - const FsEntryTypeT type) + FsEntry *searchEntryInternal(const std::string &restrict root, + const FsEntryTypeT type) { - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - const VirtFsEntry *const entry = *it; + const FsEntry *const entry = *it; if (entry->root == root && entry->type == type) { @@ -127,9 +127,9 @@ namespace VirtFs if (findLast(rootDir, std::string(dirSeparator)) == false) rootDir += dirSeparator; - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; if (entry->funcs->exists(entry, name, rootDir) == true) return true; } @@ -152,9 +152,9 @@ namespace VirtFs rootDir += dirSeparator; StringVect &names = list->names; - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; entry->funcs->enumerate(entry, rootDir, names); } @@ -176,9 +176,9 @@ namespace VirtFs if (findLast(rootDir, std::string(dirSeparator)) == false) rootDir += dirSeparator; - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; entry->funcs->getFiles(entry, rootDir, list); } } @@ -198,9 +198,9 @@ namespace VirtFs if (findLast(rootDir, std::string(dirSeparator)) == false) rootDir += dirSeparator; - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; entry->funcs->getFilesWithDir(entry, rootDir, list); } } @@ -221,9 +221,9 @@ namespace VirtFs if (findLast(rootDir, std::string(dirSeparator)) == false) rootDir += dirSeparator; - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; entry->funcs->getDirs(entry, rootDir, list); } } @@ -241,9 +241,9 @@ namespace VirtFs if (findLast(dirName, std::string(dirSeparator)) == false) dirName += dirSeparator; - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; bool isDirFlag(false); if (entry->funcs->isDirectory(entry, dirName, isDirFlag) == true) { @@ -272,9 +272,9 @@ namespace VirtFs filename.c_str()); return nullptr; } - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; File *const file = entry->funcs->openRead(entry, filename); if (file != nullptr) return file; @@ -291,9 +291,9 @@ namespace VirtFs filename.c_str()); return nullptr; } - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; File *const file = entry->funcs->openWrite(entry, filename); if (file != nullptr) return file; @@ -310,9 +310,9 @@ namespace VirtFs filename.c_str()); return nullptr; } - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; File *const file = entry->funcs->openAppend(entry, filename); if (file != nullptr) return file; @@ -325,7 +325,7 @@ namespace VirtFs return VirtFsDir::setWriteDir(newDir); } - void addEntry(VirtFsEntry *const entry, + void addEntry(FsEntry *const entry, const Append append) { if (append == Append_true) @@ -345,7 +345,7 @@ namespace VirtFs std::string rootDir = newDir; if (findLast(rootDir, std::string(dirSeparator)) == false) rootDir += dirSeparator; - const VirtFsEntry *const entry = searchEntryByRootInternal(rootDir); + const FsEntry *const entry = searchEntryByRootInternal(rootDir); if (entry != nullptr) { reportAlways("VirtFs::addToSearchPath already exists: %s", @@ -402,9 +402,9 @@ namespace VirtFs { if (findLast(oldDir, std::string(dirSeparator)) == false) oldDir += dirSeparator; - FOR_EACH (std::vector::iterator, it, mEntries) + FOR_EACH (std::vector::iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; if (entry->root == oldDir && entry->type == FsEntryType::Dir) { @@ -496,9 +496,9 @@ namespace VirtFs reportAlways("Called removeFromSearchPath without zip archive"); return false; } - FOR_EACH (std::vector::iterator, it, mEntries) + FOR_EACH (std::vector::iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; if (entry->root == oldDir && entry->type == FsEntryType::Zip) { @@ -530,9 +530,9 @@ namespace VirtFs if (findLast(rootDir, std::string(dirSeparator)) == false) rootDir += dirSeparator; - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; std::string realDir; if (entry->funcs->getRealDir(entry, fileName, @@ -559,9 +559,9 @@ namespace VirtFs { VirtFsDir::deinit(); VirtFsZip::deinit(); - FOR_EACH (std::vector::iterator, it, mEntries) + FOR_EACH (std::vector::iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; if (entry->type == FsEntryType::Dir) delete static_cast(entry); else if (entry->type == FsEntryType::Zip) @@ -639,9 +639,9 @@ namespace VirtFs filename.c_str()); return nullptr; } - FOR_EACH (std::vector::const_iterator, it, mEntries) + FOR_EACH (std::vector::const_iterator, it, mEntries) { - VirtFsEntry *const entry = *it; + FsEntry *const entry = *it; const char *const buf = entry->funcs->loadFile(entry, filename, fileSize); diff --git a/src/fs/virtfs/virtfs.h b/src/fs/virtfs/virtfs.h index 313017d7b..8b5df99ef 100644 --- a/src/fs/virtfs/virtfs.h +++ b/src/fs/virtfs/virtfs.h @@ -32,7 +32,7 @@ namespace VirtFs { struct File; - struct VirtFsEntry; + struct FsEntry; struct VirtList; void init(const std::string &restrict name); @@ -81,12 +81,12 @@ namespace VirtFs bool mountDirInternal(const std::string &restrict newDir, const Append append); bool unmountDirInternal(std::string oldDir); - std::vector &getEntries(); - VirtFsEntry *searchEntryByRootInternal(const std::string &restrict - root); - VirtFsEntry *searchEntryInternal(const std::string &restrict root, - const FsEntryTypeT type); - void addEntry(VirtFsEntry *const entry, + std::vector &getEntries(); + FsEntry *searchEntryByRootInternal(const std::string &restrict + root); + FsEntry *searchEntryInternal(const std::string &restrict root, + const FsEntryTypeT type); + void addEntry(FsEntry *const entry, const Append append); #ifdef UNITTESTS bool mountDirSilent2(std::string newDir, diff --git a/src/fs/virtfs/virtfsdir.cpp b/src/fs/virtfs/virtfsdir.cpp index df2511bf8..0f94e3fa0 100644 --- a/src/fs/virtfs/virtfsdir.cpp +++ b/src/fs/virtfs/virtfsdir.cpp @@ -61,7 +61,7 @@ namespace namespace VirtFsDir { - File *openInternal(VirtFsEntry *restrict const entry, + File *openInternal(FsEntry *restrict const entry, const std::string &filename, const FILEMTYPE mode) { @@ -80,19 +80,19 @@ namespace VirtFsDir return file; } - File *openRead(VirtFsEntry *restrict const entry, + File *openRead(FsEntry *restrict const entry, const std::string &filename) { return openInternal(entry, filename, FILEOPEN_FLAG_READ); } - File *openWrite(VirtFsEntry *restrict const entry, + File *openWrite(FsEntry *restrict const entry, const std::string &filename) { return openInternal(entry, filename, FILEOPEN_FLAG_WRITE); } - File *openAppend(VirtFsEntry *restrict const entry, + File *openAppend(FsEntry *restrict const entry, const std::string &filename) { return openInternal(entry, filename, FILEOPEN_FLAG_APPEND); @@ -167,7 +167,7 @@ namespace VirtFsDir return mUserDir.c_str(); } - bool getRealDir(VirtFsEntry *restrict const entry, + bool getRealDir(FsEntry *restrict const entry, const std::string &filename, const std::string &dirName A_UNUSED, std::string &realDir) @@ -181,14 +181,14 @@ namespace VirtFsDir return false; } - bool exists(VirtFsEntry *restrict const entry, + bool exists(FsEntry *restrict const entry, const std::string &fileName, const std::string &dirName A_UNUSED) { return Files::existsLocal(entry->root + fileName); } - void enumerate(VirtFsEntry *restrict const entry, + void enumerate(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { @@ -230,7 +230,7 @@ namespace VirtFsDir } } - bool isDirectory(VirtFsEntry *restrict const entry, + bool isDirectory(FsEntry *restrict const entry, const std::string &dirName, bool &isDirFlag) { @@ -457,7 +457,7 @@ namespace VirtFsDir return pos < 0 || len < 0 || pos >= len; } - const char *loadFile(VirtFsEntry *restrict const entry, + const char *loadFile(FsEntry *restrict const entry, const std::string &restrict filename, int &restrict fileSize) { @@ -520,7 +520,7 @@ namespace VirtFsDir return buffer; } - void getFiles(VirtFsEntry *restrict const entry, + void getFiles(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { @@ -569,7 +569,7 @@ namespace VirtFsDir } } - void getFilesWithDir(VirtFsEntry *restrict const entry, + void getFilesWithDir(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { @@ -618,7 +618,7 @@ namespace VirtFsDir } } - void getDirs(VirtFsEntry *restrict const entry, + void getDirs(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { diff --git a/src/fs/virtfs/virtfsdir.h b/src/fs/virtfs/virtfsdir.h index 33736a7f0..e0379e06d 100644 --- a/src/fs/virtfs/virtfsdir.h +++ b/src/fs/virtfs/virtfsdir.h @@ -31,20 +31,20 @@ namespace VirtFs { struct File; -struct VirtFsEntry; +struct FsEntry; struct VirtFsFuncs; struct VirtList; namespace VirtFsDir { - File *openInternal(VirtFsEntry *restrict const entry, + File *openInternal(FsEntry *restrict const entry, const std::string &filename, const FILEMTYPE mode); - File *openRead(VirtFsEntry *restrict const entry, + File *openRead(FsEntry *restrict const entry, const std::string &filename); - File *openWrite(VirtFsEntry *restrict const entry, + File *openWrite(FsEntry *restrict const entry, const std::string &filename); - File *openAppend(VirtFsEntry *restrict const entry, + File *openAppend(FsEntry *restrict const entry, const std::string &filename); const char *getBaseDir(); const char *getUserDir(); @@ -52,28 +52,28 @@ namespace VirtFsDir void init(const std::string &restrict name); void initFuncs(VirtFsFuncs *restrict const ptr); void deinit(); - bool exists(VirtFsEntry *restrict const entry, + bool exists(FsEntry *restrict const entry, const std::string &fileName, const std::string &dirName); - void enumerate(VirtFsEntry *restrict const entry, + void enumerate(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void getFiles(VirtFsEntry *restrict const entry, + void getFiles(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void getFilesWithDir(VirtFsEntry *restrict const entry, + void getFilesWithDir(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void getDirs(VirtFsEntry *restrict const entry, + void getDirs(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - bool isDirectory(VirtFsEntry *restrict const entry, + bool isDirectory(FsEntry *restrict const entry, const std::string &dirName, bool &isDirFlag); bool isSymbolicLink(std::string name); void freeList(VirtList *restrict const handle); bool setWriteDir(std::string newDir); - bool getRealDir(VirtFsEntry *restrict const entry, + bool getRealDir(FsEntry *restrict const entry, const std::string &filename, const std::string &dirName, std::string &realDir); @@ -94,7 +94,7 @@ namespace VirtFsDir int seek(File *restrict const file, const uint64_t pos); int eof(File *restrict const file); - const char *loadFile(VirtFsEntry *restrict const entry, + const char *loadFile(FsEntry *restrict const entry, const std::string &restrict fileName, int &restrict fileSize); } // namespace VirtFsDir diff --git a/src/fs/virtfs/virtfsentry.cpp b/src/fs/virtfs/virtfsentry.cpp deleted file mode 100644 index a02ab938c..000000000 --- a/src/fs/virtfs/virtfsentry.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fs/virtfs/virtfsentry.h" - -#include "debug.h" - -namespace VirtFs -{ - -VirtFsEntry::VirtFsEntry(const FsEntryTypeT &type0, - VirtFsFuncs *restrict const funcs0) : - root(), - type(type0), - funcs(funcs0) -{ -} - -VirtFsEntry::~VirtFsEntry() -{ -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/virtfsentry.h b/src/fs/virtfs/virtfsentry.h deleted file mode 100644 index 8394459de..000000000 --- a/src/fs/virtfs/virtfsentry.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UTILS_VIRTFSENTRY_H -#define UTILS_VIRTFSENTRY_H - -#include "enums/fs/fsentrytype.h" - -#include - -#include "localconsts.h" - -namespace VirtFs -{ - -struct VirtFsFuncs; - -struct VirtFsEntry notfinal -{ - VirtFsEntry(const FsEntryTypeT &type0, - VirtFsFuncs *restrict const funcs); - - A_DELETE_COPY(VirtFsEntry) - - ~VirtFsEntry(); - - std::string root; - - FsEntryTypeT type; - - VirtFsFuncs *funcs; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTFSENTRY_H diff --git a/src/fs/virtfs/virtfsfuncs.h b/src/fs/virtfs/virtfsfuncs.h index bc74fa785..70f9882ab 100644 --- a/src/fs/virtfs/virtfsfuncs.h +++ b/src/fs/virtfs/virtfsfuncs.h @@ -33,7 +33,7 @@ namespace VirtFs { struct File; -struct VirtFsEntry; +struct FsEntry; struct VirtFsFuncs final { @@ -81,36 +81,36 @@ struct VirtFsFuncs final int64_t (*tell) (File *restrict const file); int (*seek) (File *restrict const file, const uint64_t pos); - bool (*exists) (VirtFsEntry *restrict const entry, + bool (*exists) (FsEntry *restrict const entry, const std::string &filename, const std::string &dirName); - bool (*getRealDir) (VirtFsEntry *restrict const entry, + bool (*getRealDir) (FsEntry *restrict const entry, const std::string &filename, const std::string &dirName, std::string &realDir); - void (*enumerate) (VirtFsEntry *restrict const entry, + void (*enumerate) (FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void (*getFiles) (VirtFsEntry *restrict const entry, + void (*getFiles) (FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void (*getFilesWithDir) (VirtFsEntry *restrict const entry, + void (*getFilesWithDir) (FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void (*getDirs) (VirtFsEntry *restrict const entry, + void (*getDirs) (FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - bool (*isDirectory) (VirtFsEntry *restrict const entry, + bool (*isDirectory) (FsEntry *restrict const entry, const std::string &dirName, bool &isDirFlag); - File *(*openRead) (VirtFsEntry *restrict const entry, + File *(*openRead) (FsEntry *restrict const entry, const std::string &filename); - File *(*openWrite) (VirtFsEntry *restrict const entry, + File *(*openWrite) (FsEntry *restrict const entry, const std::string &filename); - File *(*openAppend) (VirtFsEntry *restrict const entry, + File *(*openAppend) (FsEntry *restrict const entry, const std::string &filename); int (*eof) (File *restrict const file); - const char *(*loadFile) (VirtFsEntry *restrict const entry, + const char *(*loadFile) (FsEntry *restrict const entry, const std::string &restrict fileName, int &restrict fileSize); diff --git a/src/fs/virtfs/virtfszip.cpp b/src/fs/virtfs/virtfszip.cpp index c1c8da676..fc7cbbd6b 100644 --- a/src/fs/virtfs/virtfszip.cpp +++ b/src/fs/virtfs/virtfszip.cpp @@ -88,7 +88,7 @@ namespace VirtFsZip #endif // USE_SDL2 } - bool getRealDir(VirtFsEntry *restrict const entry, + bool getRealDir(FsEntry *restrict const entry, const std::string &filename, const std::string &dirName, std::string &realDir) @@ -117,7 +117,7 @@ namespace VirtFsZip return false; } - bool exists(VirtFsEntry *restrict const entry, + bool exists(FsEntry *restrict const entry, const std::string &filename, const std::string &dirName) { @@ -139,7 +139,7 @@ namespace VirtFsZip return false; } - void enumerate(VirtFsEntry *restrict const entry, + void enumerate(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { @@ -199,7 +199,7 @@ namespace VirtFsZip } } - void getFiles(VirtFsEntry *restrict const entry, + void getFiles(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { @@ -294,7 +294,7 @@ namespace VirtFsZip } } - void getFilesWithDir(VirtFsEntry *restrict const entry, + void getFilesWithDir(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { @@ -389,7 +389,7 @@ namespace VirtFsZip } } - void getDirs(VirtFsEntry *restrict const entry, + void getDirs(FsEntry *restrict const entry, const std::string &dirName, StringVect &names) { @@ -484,7 +484,7 @@ namespace VirtFsZip } } - bool isDirectory(VirtFsEntry *restrict const entry, + bool isDirectory(FsEntry *restrict const entry, const std::string &dirName, bool &isDirFlag) { @@ -507,7 +507,7 @@ namespace VirtFsZip delete handle; } - File *openRead(VirtFsEntry *restrict const entry, + File *openRead(FsEntry *restrict const entry, const std::string &filename) { VirtZipEntry *const zipEntry = static_cast(entry); @@ -530,14 +530,14 @@ namespace VirtFsZip return nullptr; } - File *openWrite(VirtFsEntry *restrict const entry A_UNUSED, + File *openWrite(FsEntry *restrict const entry A_UNUSED, const std::string &filename A_UNUSED) { reportAlways("VirtFs::openWrite for zip not implemented."); return nullptr; } - File *openAppend(VirtFsEntry *restrict const entry A_UNUSED, + File *openAppend(FsEntry *restrict const entry A_UNUSED, const std::string &filename A_UNUSED) { reportAlways("VirtFs::openAppend for zip not implemented."); @@ -635,7 +635,7 @@ namespace VirtFsZip return file->mPos >= file->mSize; } - const char *loadFile(VirtFsEntry *restrict const entry, + const char *loadFile(FsEntry *restrict const entry, const std::string &restrict filename, int &restrict fileSize) { diff --git a/src/fs/virtfs/virtfszip.h b/src/fs/virtfs/virtfszip.h index fbae5a54e..bcf7a3697 100644 --- a/src/fs/virtfs/virtfszip.h +++ b/src/fs/virtfs/virtfszip.h @@ -31,7 +31,7 @@ namespace VirtFs struct File; struct VirtList; struct VirtFsFuncs; -struct VirtFsEntry; +struct FsEntry; namespace VirtFsZip { @@ -39,33 +39,33 @@ namespace VirtFsZip void init(); void initFuncs(VirtFsFuncs *restrict const ptr); void deinit(); - bool exists(VirtFsEntry *restrict const entry, + bool exists(FsEntry *restrict const entry, const std::string &filename, const std::string &dirName); - void enumerate(VirtFsEntry *restrict const entry, + void enumerate(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void getFiles(VirtFsEntry *restrict const entry, + void getFiles(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void getFilesWithDir(VirtFsEntry *restrict const entry, + void getFilesWithDir(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - void getDirs(VirtFsEntry *restrict const entry, + void getDirs(FsEntry *restrict const entry, const std::string &dirName, StringVect &names); - bool isDirectory(VirtFsEntry *restrict const entry, + bool isDirectory(FsEntry *restrict const entry, const std::string &dirName, bool &isDirFlag); void freeList(VirtList *restrict const handle); - File *openRead(VirtFsEntry *restrict const entry, + File *openRead(FsEntry *restrict const entry, const std::string &filename); - File *openWrite(VirtFsEntry *restrict const entry, + File *openWrite(FsEntry *restrict const entry, const std::string &filename); - File *openAppend(VirtFsEntry *restrict const entry, + File *openAppend(FsEntry *restrict const entry, const std::string &filename); File *openReadInternal(const std::string &filename); - bool getRealDir(VirtFsEntry *restrict const entry, + bool getRealDir(FsEntry *restrict const entry, const std::string &filename, const std::string &dirName, std::string &realDir); @@ -83,7 +83,7 @@ namespace VirtFsZip int seek(File *restrict const file, const uint64_t pos); int eof(File *restrict const file); - const char *loadFile(VirtFsEntry *restrict const entry, + const char *loadFile(FsEntry *restrict const entry, const std::string &restrict fileName, int &restrict fileSize); } // namespace VirtFsZip diff --git a/src/fs/virtfs/virtzipentry.cpp b/src/fs/virtfs/virtzipentry.cpp index 2cd3b30f5..f84b3083e 100644 --- a/src/fs/virtfs/virtzipentry.cpp +++ b/src/fs/virtfs/virtzipentry.cpp @@ -31,7 +31,7 @@ namespace VirtFs VirtZipEntry::VirtZipEntry(const std::string &restrict archiveName, VirtFsFuncs *restrict const funcs0) : - VirtFsEntry(FsEntryType::Zip, funcs0), + FsEntry(FsEntryType::Zip, funcs0), mHeaders(), mDirs() { diff --git a/src/fs/virtfs/virtzipentry.h b/src/fs/virtfs/virtzipentry.h index e0bdf4847..841fd7775 100644 --- a/src/fs/virtfs/virtzipentry.h +++ b/src/fs/virtfs/virtzipentry.h @@ -21,7 +21,7 @@ #ifndef UTILS_VIRTZIPENTRY_H #define UTILS_VIRTZIPENTRY_H -#include "fs/virtfs/virtfsentry.h" +#include "fs/virtfs/fsentry.h" #include @@ -32,7 +32,7 @@ namespace VirtFs struct ZipLocalHeader; -struct VirtZipEntry final : public VirtFsEntry +struct VirtZipEntry final : public FsEntry { VirtZipEntry(const std::string &restrict archiveName, VirtFsFuncs *restrict const funcs); -- cgit v1.2.3-70-g09d2