arsa  2.7
IFileArchive.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt/ Thomas Alten
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_FILE_ARCHIVE_H_INCLUDED__
6 #define __I_FILE_ARCHIVE_H_INCLUDED__
7 
8 #include "IReadFile.h"
9 #include "IFileList.h"
10 
11 namespace irr
12 {
13 
14 namespace io
15 {
16 
19 {
20  FILESYSTEM_NATIVE = 0, // Native OS FileSystem
21  FILESYSTEM_VIRTUAL // Virtual FileSystem
22 };
23 
26 {
28  EFAT_ZIP = MAKE_IRR_ID('Z','I','P', 0),
29 
31  EFAT_GZIP = MAKE_IRR_ID('g','z','i','p'),
32 
34  EFAT_FOLDER = MAKE_IRR_ID('f','l','d','r'),
35 
37  EFAT_PAK = MAKE_IRR_ID('P','A','K', 0),
38 
40  EFAT_NPK = MAKE_IRR_ID('N','P','K', 0),
41 
43  EFAT_TAR = MAKE_IRR_ID('T','A','R', 0),
44 
46  EFAT_WAD = MAKE_IRR_ID('W','A','D', 0),
47 
49  EFAT_ANDROID_ASSET = MAKE_IRR_ID('A','S','S','E'),
50 
52  EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n')
53 };
54 
56 class IFileArchive : public virtual IReferenceCounted
57 {
58 public:
59 
61 
65  virtual IReadFile* createAndOpenFile(const path& filename) =0;
66 
68 
71  virtual IReadFile* createAndOpenFile(u32 index) =0;
72 
74 
76  virtual const IFileList* getFileList() const =0;
77 
79  virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_UNKNOWN; }
80 
82  virtual const io::path& getArchiveName() const =0;
83 
85 
92  virtual void addDirectoryToFileList(const io::path &filename) {}
93 
95 
100 };
101 
103 
107 class IArchiveLoader : public virtual IReferenceCounted
108 {
109 public:
111 
114  virtual bool isALoadableFileFormat(const path& filename) const =0;
115 
117 
120  virtual bool isALoadableFileFormat(io::IReadFile* file) const =0;
121 
123 
126  virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const =0;
127 
129 
133  virtual IFileArchive* createArchive(const path& filename, bool ignoreCase, bool ignorePaths) const =0;
134 
136 
140  virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const =0;
141 };
142 
143 
144 } // end namespace io
145 } // end namespace irr
146 
147 #endif
148 
The type of this archive is unknown.
Definition: IFileArchive.h:52
Interface providing read access to a file.
Definition: IReadFile.h:18
A PKZIP archive.
Definition: IFileArchive.h:28
An ID Software PAK archive.
Definition: IFileArchive.h:37
virtual IReadFile * createAndOpenFile(const path &filename)=0
Opens a file based on its name.
Provides a list of files and folders.
Definition: IFileList.h:19
Class which is able to create an archive from a file.
Definition: IFileArchive.h:107
EFileSystemType
FileSystemType: which filesystem should be used for e.g. browsing.
Definition: IFileArchive.h:18
An Android asset file archive.
Definition: IFileArchive.h:49
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual IFileArchive * createArchive(const path &filename, bool ignoreCase, bool ignorePaths) const =0
Creates an archive from the filename.
virtual const io::path & getArchiveName() const =0
return the name (id) of the file Archive
virtual E_FILE_ARCHIVE_TYPE getType() const
get the archive type
Definition: IFileArchive.h:79
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
E_FILE_ARCHIVE_TYPE
Contains the different types of archives.
Definition: IFileArchive.h:25
GLuint index
A Tape ARchive.
Definition: IFileArchive.h:43
virtual bool isALoadableFileFormat(const path &filename) const =0
Check if the file might be loaded by this class.
#define MAKE_IRR_ID(c0, c1, c2, c3)
ignore VC8 warning deprecated
Definition: irrTypes.h:243
Base class of most objects of the Irrlicht Engine.
core::stringc Password
An optionally used password string.
Definition: IFileArchive.h:99
virtual const IFileList * getFileList() const =0
Returns the complete file tree.
A virtual directory.
Definition: IFileArchive.h:34
A Nebula Device archive.
Definition: IFileArchive.h:40
The FileArchive manages archives and provides access to files inside them.
Definition: IFileArchive.h:56
A gzip archive.
Definition: IFileArchive.h:31
A wad Archive, Quake2, Halflife.
Definition: IFileArchive.h:46
virtual void addDirectoryToFileList(const io::path &filename)
Add a directory in the archive and all it's files to the FileList.
Definition: IFileArchive.h:92