Cafu Engine
FileSys_ZipArchive_AS.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_FILESYS_FILESYSTEM_ZIPARCHIVE_AS_HPP_INCLUDED
8 #define CAFU_FILESYS_FILESYSTEM_ZIPARCHIVE_AS_HPP_INCLUDED
9 
10 #include "FileSys.hpp"
11 #include "ZipArchive.h"
12 
13 
14 namespace cf
15 {
16  namespace FileSys
17  {
18  /// This class implements file systems that are ZIP archives, employing the ZipArchive library by Artpol Software.
19  /// The ZipArchive library supports AES encryption in accordance with the WinZip format,
20  /// but it cannot be redistributed with the Cafu source code due to its licensing conditions.
21  /// Note however that employing AES encryption for Cafu asset files is not useful anyway,
22  /// as any determined hacker could reverse-engineer the Cafu executable or access e.g. the texture
23  /// images by a modified graphics driver anyway.
24  /// Therefore, we now use the other implementation FileSystemZipArchiveGST by Gilles Vollant now,
25  /// which is under the liberal zlib license with which redistribution is no problem.
27  {
28  public:
29 
30  /// Constructor.
31  /// @throws FileSystemExceptionT when there is a problem with initializing this file system.
32  FileSystemZipArchiveAST(const std::string& ArchiveName_, const std::string& MountPoint_, const std::string& Password_="");
33 
34  /// Destructor. Destroys the file system.
36 
37  // Implement all the (pure) virtual methods of the FileSystemT class.
38  InFileI* OpenRead(const std::string& FileName);
39 
40 
41  private:
42 
43  const std::string ArchiveName; ///< The name of the archive.
44  CZipArchive Archive; ///< The zip archive itself.
45  const std::string MountPoint; ///< The mount point of the archive contents.
46  const std::string::size_type MountPointLen; ///< The length of the MountPoint string.
47  std::map<std::string, ZIP_INDEX_TYPE> NameToFileNr; ///< Maps a file name to the related index in the zip archive.
48  };
49  }
50 }
51 
52 #endif
Definition: File.hpp:55
Definition: FileSys.hpp:42
FileSystemZipArchiveAST(const std::string &ArchiveName_, const std::string &MountPoint_, const std::string &Password_="")
Constructor.
Definition: FileSys_ZipArchive_AS.cpp:14
~FileSystemZipArchiveAST()
Destructor. Destroys the file system.
Definition: FileSys_ZipArchive_AS.cpp:55
This class implements file systems that are ZIP archives, employing the ZipArchive library by Artpol ...
Definition: FileSys_ZipArchive_AS.hpp:26
InFileI * OpenRead(const std::string &FileName)
Opens the file with the given name for reading.
Definition: FileSys_ZipArchive_AS.cpp:68