From ab311005113b2648cf5d709ec2a12baea90ede95 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 5 May 2017 19:21:42 +0300 Subject: Rename virtlist into list. --- src/fs/virtfs/fs.cpp | 8 +++---- src/fs/virtfs/fs.h | 6 +++--- src/fs/virtfs/fsdir.cpp | 4 ++-- src/fs/virtfs/fsdir.h | 4 ++-- src/fs/virtfs/fszip.cpp | 4 ++-- src/fs/virtfs/fszip.h | 4 ++-- src/fs/virtfs/list.cpp | 37 ++++++++++++++++++++++++++++++++ src/fs/virtfs/list.h | 44 +++++++++++++++++++++++++++++++++++++++ src/fs/virtfs/tools.cpp | 6 +++--- src/fs/virtfs/virtfs1_unittest.cc | 22 ++++++++++---------- src/fs/virtfs/virtfs_unittest.cc | 14 ++++++------- src/fs/virtfs/virtlist.cpp | 37 -------------------------------- src/fs/virtfs/virtlist.h | 44 --------------------------------------- 13 files changed, 117 insertions(+), 117 deletions(-) create mode 100644 src/fs/virtfs/list.cpp create mode 100644 src/fs/virtfs/list.h delete mode 100644 src/fs/virtfs/virtlist.cpp delete mode 100644 src/fs/virtfs/virtlist.h (limited to 'src/fs/virtfs') diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp index c4f1e7f42..4d73784dd 100644 --- a/src/fs/virtfs/fs.cpp +++ b/src/fs/virtfs/fs.cpp @@ -28,7 +28,7 @@ #include "fs/virtfs/fsdir.h" #include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/fszip.h" -#include "fs/virtfs/virtlist.h" +#include "fs/virtfs/list.h" #include "fs/virtfs/virtzipentry.h" #include "fs/virtfs/zipreader.h" @@ -136,9 +136,9 @@ namespace VirtFs return false; } - VirtList *enumerateFiles(std::string dirName) + List *enumerateFiles(std::string dirName) { - VirtList *const list = new VirtList; + List *const list = new List; prepareFsPath(dirName); if (checkPath(dirName) == false) { @@ -258,7 +258,7 @@ namespace VirtFs return FsDir::isSymbolicLink(name); } - void freeList(VirtList *restrict const handle) + void freeList(List *restrict const handle) { delete handle; } diff --git a/src/fs/virtfs/fs.h b/src/fs/virtfs/fs.h index 8b5df99ef..a6b787d6e 100644 --- a/src/fs/virtfs/fs.h +++ b/src/fs/virtfs/fs.h @@ -33,7 +33,7 @@ namespace VirtFs { struct File; struct FsEntry; - struct VirtList; + struct List; void init(const std::string &restrict name); void updateDirSeparator(); @@ -41,10 +41,10 @@ namespace VirtFs const char *getBaseDir(); const char *getUserDir(); bool exists(std::string name); - VirtList *enumerateFiles(std::string dir) RETURNS_NONNULL; + List *enumerateFiles(std::string dir) RETURNS_NONNULL; bool isDirectory(std::string name); bool isSymbolicLink(const std::string &restrict name); - void freeList(VirtList *restrict const handle); + void freeList(List *restrict const handle); File *openRead(std::string filename); File *openWrite(std::string filename); File *openAppend(std::string filename); diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp index f6642fb14..4ee6d648e 100644 --- a/src/fs/virtfs/fsdir.cpp +++ b/src/fs/virtfs/fsdir.cpp @@ -28,7 +28,7 @@ #include "fs/virtfs/file.h" #include "fs/virtfs/fsdirrwops.h" #include "fs/virtfs/fsfuncs.h" -#include "fs/virtfs/virtlist.h" +#include "fs/virtfs/list.h" #include "utils/checkutils.h" #include "utils/stringutils.h" @@ -266,7 +266,7 @@ namespace FsDir #endif // WIN32 } - void freeList(VirtList *restrict const handle) + void freeList(List *restrict const handle) { delete handle; } diff --git a/src/fs/virtfs/fsdir.h b/src/fs/virtfs/fsdir.h index 1abb46211..e57036043 100644 --- a/src/fs/virtfs/fsdir.h +++ b/src/fs/virtfs/fsdir.h @@ -33,7 +33,7 @@ namespace VirtFs struct File; struct FsEntry; struct FsFuncs; -struct VirtList; +struct List; namespace FsDir { @@ -71,7 +71,7 @@ namespace FsDir const std::string &dirName, bool &isDirFlag); bool isSymbolicLink(std::string name); - void freeList(VirtList *restrict const handle); + void freeList(List *restrict const handle); bool setWriteDir(std::string newDir); bool getRealDir(FsEntry *restrict const entry, const std::string &filename, diff --git a/src/fs/virtfs/fszip.cpp b/src/fs/virtfs/fszip.cpp index b114d4740..c3e51cf45 100644 --- a/src/fs/virtfs/fszip.cpp +++ b/src/fs/virtfs/fszip.cpp @@ -23,7 +23,7 @@ #include "fs/virtfs/file.h" #include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/fsziprwops.h" -#include "fs/virtfs/virtlist.h" +#include "fs/virtfs/list.h" #include "fs/virtfs/virtzipentry.h" #include "fs/virtfs/zipreader.h" #include "fs/virtfs/ziplocalheader.h" @@ -502,7 +502,7 @@ namespace FsZip return false; } - void freeList(VirtList *restrict const handle) + void freeList(List *restrict const handle) { delete handle; } diff --git a/src/fs/virtfs/fszip.h b/src/fs/virtfs/fszip.h index 03981f0ec..4caffba17 100644 --- a/src/fs/virtfs/fszip.h +++ b/src/fs/virtfs/fszip.h @@ -29,7 +29,7 @@ namespace VirtFs { struct File; -struct VirtList; +struct List; struct FsFuncs; struct FsEntry; @@ -57,7 +57,7 @@ namespace FsZip bool isDirectory(FsEntry *restrict const entry, const std::string &dirName, bool &isDirFlag); - void freeList(VirtList *restrict const handle); + void freeList(List *restrict const handle); File *openRead(FsEntry *restrict const entry, const std::string &filename); File *openWrite(FsEntry *restrict const entry, diff --git a/src/fs/virtfs/list.cpp b/src/fs/virtfs/list.cpp new file mode 100644 index 000000000..2f0a23d66 --- /dev/null +++ b/src/fs/virtfs/list.cpp @@ -0,0 +1,37 @@ +/* + * 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/list.h" + +#include "debug.h" + +namespace VirtFs +{ + +List::List() : + names() +{ +} + +List::~List() +{ +} + +} // namespace VirtFs diff --git a/src/fs/virtfs/list.h b/src/fs/virtfs/list.h new file mode 100644 index 000000000..9dcb9e269 --- /dev/null +++ b/src/fs/virtfs/list.h @@ -0,0 +1,44 @@ +/* + * 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_VIRTLIST_H +#define UTILS_VIRTLIST_H + +#include "utils/stringvector.h" + +#include "localconsts.h" + +namespace VirtFs +{ + +struct List final +{ + List(); + + A_DELETE_COPY(List) + + ~List(); + + StringVect names; +}; + +} // namespace VirtFs + +#endif // UTILS_VIRTLIST_H diff --git a/src/fs/virtfs/tools.cpp b/src/fs/virtfs/tools.cpp index ea897e861..a5bf06097 100644 --- a/src/fs/virtfs/tools.cpp +++ b/src/fs/virtfs/tools.cpp @@ -25,7 +25,7 @@ #include "fs/paths.h" #include "fs/virtfs/fs.h" -#include "fs/virtfs/virtlist.h" +#include "fs/virtfs/list.h" #include "utils/stringutils.h" @@ -40,7 +40,7 @@ namespace VirtFs const std::string &restrict ext, const Append append) { - VirtList *const list = VirtFs::enumerateFiles(path); + List *const list = VirtFs::enumerateFiles(path); FOR_EACH (StringVectCIter, i, list->names) { const std::string str = *i; @@ -60,7 +60,7 @@ namespace VirtFs void searchAndRemoveArchives(const std::string &restrict path, const std::string &restrict ext) { - VirtList *const list = VirtFs::enumerateFiles(path); + List *const list = VirtFs::enumerateFiles(path); FOR_EACH (StringVectCIter, i, list->names) { const std::string str = *i; diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc index b1084d605..8a219e3ce 100644 --- a/src/fs/virtfs/virtfs1_unittest.cc +++ b/src/fs/virtfs/virtfs1_unittest.cc @@ -25,7 +25,7 @@ #include "fs/virtfs/direntry.h" #include "fs/virtfs/fs.h" #include "fs/virtfs/rwops.h" -#include "fs/virtfs/virtlist.h" +#include "fs/virtfs/list.h" #include "utils/checkutils.h" #include "utils/delete2.h" @@ -673,7 +673,7 @@ TEST_CASE("VirtFs1 getRealDir2") delete2(logger); } -static bool inList(const VirtFs::VirtList *const list, +static bool inList(const VirtFs::List *const list, const std::string &name) { FOR_EACH (StringVectCIter, it, list->names) @@ -718,7 +718,7 @@ TEST_CASE("VirtFs1 enumerateFiles1") VirtFs::mountDirSilent("../data", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; const int cnt1 = VirtFs::exists("test/test2.txt") ? 28 : 27; const int cnt2 = 28; @@ -763,7 +763,7 @@ TEST_CASE("VirtFs1 enumerateFiles2") VirtFs::mountDirSilent("../data/test/dir1", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("/"); REQUIRE(list->names.size() == 5); @@ -788,7 +788,7 @@ TEST_CASE("VirtFs1 enumerateFiles3") VirtFs::mountDirSilent("../data/test/dir2", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("/"); const size_t sz = list->names.size(); @@ -811,7 +811,7 @@ TEST_CASE("VirtFsZip enumerateFiles4") VirtFs::mountZip(prefix + "test.zip", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("dir"); REQUIRE(list->names.size() == 2); @@ -838,7 +838,7 @@ TEST_CASE("VirtFsZip enumerateFiles5") VirtFs::mountZip(prefix + "test2.zip", Append_true); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("dir"); FOR_EACH (StringVectCIter, it, list->names) @@ -872,7 +872,7 @@ TEST_CASE("VirtFsZip enumerateFiles6") VirtFs::mountZip(prefix + "test.zip", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("/"); REQUIRE(list->names.size() == 1); @@ -896,7 +896,7 @@ TEST_CASE("VirtFsZip enumerateFiles7") VirtFs::mountZip(prefix + "test2.zip", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("/"); REQUIRE(list->names.size() == 4); @@ -925,7 +925,7 @@ TEST_CASE("VirtFsZip enumerateFiles8") VirtFs::mountDirSilent(prefix + "data/test", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("dir2"); REQUIRE(list->names.size() >= 6); @@ -957,7 +957,7 @@ TEST_CASE("VirtFsZip enumerateFiles9") VirtFs::mountDirSilent(prefix + "data/test", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("dir"); REQUIRE(list->names.size() == 4); diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc index 3c0b65679..8c7688cb6 100644 --- a/src/fs/virtfs/virtfs_unittest.cc +++ b/src/fs/virtfs/virtfs_unittest.cc @@ -24,7 +24,7 @@ #include "fs/paths.h" #include "fs/virtfs/fs.h" -#include "fs/virtfs/virtlist.h" +#include "fs/virtfs/list.h" #include "utils/checkutils.h" #include "utils/delete2.h" @@ -216,7 +216,7 @@ static void removeTemp(StringVect &restrict list) } } -static bool inList(const VirtFs::VirtList *const list, +static bool inList(const VirtFs::List *const list, const std::string &name) { FOR_EACH (StringVectCIter, it, list->names) @@ -234,7 +234,7 @@ TEST_CASE("VirtFs enumerateFiles1") VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; const int cnt1 = VirtFs::exists("test/test2.txt") ? 28 : 27; const int cnt2 = 28; @@ -277,7 +277,7 @@ TEST_CASE("VirtFs enumerateFiles2") VirtFs::mountDirSilent("../data/test/dir1", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("/"); REQUIRE(list->names.size() == 5); @@ -299,7 +299,7 @@ TEST_CASE("VirtFs enumerateFiles3") VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("/"); REQUIRE(list->names.size() == 1); @@ -321,7 +321,7 @@ TEST_CASE("VirtFs enumerateFiles4") VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("/"); REQUIRE(list->names.size() == 4); @@ -347,7 +347,7 @@ TEST_CASE("VirtFs enumerateFiles5") Append_false); VirtFs::mountDirSilent(prefix + "data/test", Append_false); - VirtFs::VirtList *list = nullptr; + VirtFs::List *list = nullptr; list = VirtFs::enumerateFiles("dir2"); REQUIRE(inList(list, "file1.txt")); diff --git a/src/fs/virtfs/virtlist.cpp b/src/fs/virtfs/virtlist.cpp deleted file mode 100644 index 332968d09..000000000 --- a/src/fs/virtfs/virtlist.cpp +++ /dev/null @@ -1,37 +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/virtlist.h" - -#include "debug.h" - -namespace VirtFs -{ - -VirtList::VirtList() : - names() -{ -} - -VirtList::~VirtList() -{ -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/virtlist.h b/src/fs/virtfs/virtlist.h deleted file mode 100644 index 7f698e6ad..000000000 --- a/src/fs/virtfs/virtlist.h +++ /dev/null @@ -1,44 +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_VIRTLIST_H -#define UTILS_VIRTLIST_H - -#include "utils/stringvector.h" - -#include "localconsts.h" - -namespace VirtFs -{ - -struct VirtList final -{ - VirtList(); - - A_DELETE_COPY(VirtList) - - ~VirtList(); - - StringVect names; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTLIST_H -- cgit v1.2.3-60-g2f50