ManaPlus
fszip.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2013-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef UTILS_VIRTFSZIP_H
23 #define UTILS_VIRTFSZIP_H
24 
25 #include "utils/stringvector.h"
26 
27 #include "localconsts.h"
28 
29 namespace VirtFs
30 {
31 
32 struct File;
33 struct List;
34 struct FsFuncs;
35 struct FsEntry;
36 
37 namespace FsZip
38 {
39  FsFuncs *getFuncs();
40  void init();
41  void initFuncs(FsFuncs *restrict const ptr);
42  void deinit();
43  bool exists(FsEntry *restrict const entry,
44  std::string filename,
45  std::string dirName);
46  void enumerate(FsEntry *restrict const entry,
47  std::string dirName,
48  StringVect &names);
49  void getFiles(FsEntry *restrict const entry,
50  std::string dirName,
51  StringVect &names);
52  void getFilesWithDir(FsEntry *restrict const entry,
53  const std::string &dirName,
54  StringVect &names);
55  void getDirs(FsEntry *restrict const entry,
56  std::string dirName,
57  StringVect &names);
58  bool isDirectory(FsEntry *restrict const entry,
59  std::string dirName,
60  bool &isDirFlag);
61  void freeList(List *restrict const handle);
62  File *openRead(FsEntry *restrict const entry,
63  std::string filename);
64  File *openWrite(FsEntry *restrict const entry,
65  const std::string &filename);
66  File *openAppend(FsEntry *restrict const entry,
67  const std::string &filename);
68  File *openReadInternal(const std::string &filename);
69  bool getRealDir(FsEntry *restrict const entry,
70  std::string filename,
71  std::string dirName,
72  std::string &realDir);
73  int64_t read(File *restrict const handle,
74  void *restrict const buffer,
75  const uint32_t objSize,
76  const uint32_t objCount);
77  int64_t write(File *restrict const file,
78  const void *restrict const buffer,
79  const uint32_t objSize,
80  const uint32_t objCount);
81  int close(File *restrict const file);
82  int64_t fileLength(File *restrict const file);
83  int64_t tell(File *restrict const file);
84  int seek(File *restrict const file,
85  const uint64_t pos);
86  int eof(File *restrict const file);
87  const char *loadFile(FsEntry *restrict const entry,
88  std::string fileName,
89  int &restrict fileSize);
90 } // namespace FsZip
91 
92 } // namespace VirtFs
93 
94 #endif // UTILS_VIRTFSZIP_H
#define restrict
Definition: localconsts.h:165
File * openWrite(FsEntry *const entry, const std::string &filename)
Definition: fszip.cpp:569
File * openReadInternal(const std::string &filename)
void deinit()
Definition: fszip.cpp:56
bool isDirectory(FsEntry *const entry, std::string dirName, bool &isDirFlag)
Definition: fszip.cpp:517
void getDirs(FsEntry *const entry, std::string dirName, StringVect &names)
Definition: fszip.cpp:419
void enumerate(FsEntry *const entry, std::string dirName, StringVect &names)
Definition: fszip.cpp:157
void getFiles(FsEntry *const entry, std::string dirName, StringVect &names)
Definition: fszip.cpp:220
const char * loadFile(FsEntry *const entry, std::string filename, int &fileSize)
Definition: fszip.cpp:674
bool getRealDir(FsEntry *const entry, std::string filename, std::string dirName, std::string &realDir)
Definition: fszip.cpp:94
int seek(File *const file, const uint64_t pos)
Definition: fszip.cpp:654
File * openAppend(FsEntry *const entry, const std::string &filename)
Definition: fszip.cpp:576
int64_t tell(File *const file)
Definition: fszip.cpp:646
void getFilesWithDir(FsEntry *const entry, const std::string &dirName, StringVect &names)
Definition: fszip.cpp:318
bool exists(FsEntry *const entry, std::string filename, std::string dirName)
Definition: fszip.cpp:129
int64_t read(File *const file, void *const buffer, const uint32_t objSize, const uint32_t objCount)
Definition: fszip.cpp:591
int64_t write(File *const file, const void *const buffer, const uint32_t objSize, const uint32_t objCount)
Definition: fszip.cpp:630
void initFuncs(FsFuncs *const ptr)
Definition: fszip.cpp:65
int eof(File *const file)
Definition: fszip.cpp:666
void freeList(List *const handle)
Definition: fszip.cpp:538
int64_t fileLength(File *const file)
Definition: fszip.cpp:638
FsFuncs * getFuncs()
Definition: fszip.cpp:51
void init()
Definition: fszip.cpp:60
File * openRead(FsEntry *const entry, std::string filename)
Definition: fszip.cpp:543
int close(File *const file)
Definition: fszip.cpp:583
std::vector< std::string > StringVect
Definition: stringvector.h:29
std::string fileName
Definition: testmain.cpp:39