aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include/IFileArchive.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/include/IFileArchive.h')
-rw-r--r--src/others/irrlicht-1.8.1/include/IFileArchive.h132
1 files changed, 132 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/IFileArchive.h b/src/others/irrlicht-1.8.1/include/IFileArchive.h
new file mode 100644
index 0000000..a2e02a8
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IFileArchive.h
@@ -0,0 +1,132 @@
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
11namespace irr
12{
13
14namespace io
15{
16
17//! FileSystemType: which Filesystem should be used for e.g. browsing
18enum EFileSystemType
19{
20 FILESYSTEM_NATIVE = 0, // Native OS FileSystem
21 FILESYSTEM_VIRTUAL // Virtual FileSystem
22};
23
24//! Contains the different types of archives
25enum E_FILE_ARCHIVE_TYPE
26{
27 //! A PKZIP archive
28 EFAT_ZIP = MAKE_IRR_ID('Z','I','P', 0),
29
30 //! A gzip archive
31 EFAT_GZIP = MAKE_IRR_ID('g','z','i','p'),
32
33 //! A virtual directory
34 EFAT_FOLDER = MAKE_IRR_ID('f','l','d','r'),
35
36 //! An ID Software PAK archive
37 EFAT_PAK = MAKE_IRR_ID('P','A','K', 0),
38
39 //! A Nebula Device archive
40 EFAT_NPK = MAKE_IRR_ID('N','P','K', 0),
41
42 //! A Tape ARchive
43 EFAT_TAR = MAKE_IRR_ID('T','A','R', 0),
44
45 //! A wad Archive, Quake2, Halflife
46 EFAT_WAD = MAKE_IRR_ID('W','A','D', 0),
47
48 //! The type of this archive is unknown
49 EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n')
50};
51
52//! The FileArchive manages archives and provides access to files inside them.
53class IFileArchive : public virtual IReferenceCounted
54{
55public:
56
57 //! Opens a file based on its name
58 /** Creates and returns a new IReadFile for a file in the archive.
59 \param filename The file to open
60 \return Returns A pointer to the created file on success,
61 or 0 on failure. */
62 virtual IReadFile* createAndOpenFile(const path& filename) =0;
63
64 //! Opens a file based on its position in the file list.
65 /** Creates and returns
66 \param index The zero based index of the file.
67 \return Returns a pointer to the created file on success, or 0 on failure. */
68 virtual IReadFile* createAndOpenFile(u32 index) =0;
69
70 //! Returns the complete file tree
71 /** \return Returns the complete directory tree for the archive,
72 including all files and folders */
73 virtual const IFileList* getFileList() const =0;
74
75 //! get the archive type
76 virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_UNKNOWN; }
77
78 //! An optionally used password string
79 /** This variable is publicly accessible from the interface in order to
80 avoid single access patterns to this place, and hence allow some more
81 obscurity.
82 */
83 core::stringc Password;
84};
85
86//! Class which is able to create an archive from a file.
87/** If you want the Irrlicht Engine be able to load archives of
88currently unsupported file formats (e.g .wad), then implement
89this and add your new Archive loader with
90IFileSystem::addArchiveLoader() to the engine. */
91class IArchiveLoader : public virtual IReferenceCounted
92{
93public:
94 //! Check if the file might be loaded by this class
95 /** Check based on the file extension (e.g. ".zip")
96 \param filename Name of file to check.
97 \return True if file seems to be loadable. */
98 virtual bool isALoadableFileFormat(const path& filename) const =0;
99
100 //! Check if the file might be loaded by this class
101 /** This check may look into the file.
102 \param file File handle to check.
103 \return True if file seems to be loadable. */
104 virtual bool isALoadableFileFormat(io::IReadFile* file) const =0;
105
106 //! Check to see if the loader can create archives of this type.
107 /** Check based on the archive type.
108 \param fileType The archive type to check.
109 \return True if the archile loader supports this type, false if not */
110 virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const =0;
111
112 //! Creates an archive from the filename
113 /** \param filename File to use.
114 \param ignoreCase Searching is performed without regarding the case
115 \param ignorePaths Files are searched for without checking for the directories
116 \return Pointer to newly created archive, or 0 upon error. */
117 virtual IFileArchive* createArchive(const path& filename, bool ignoreCase, bool ignorePaths) const =0;
118
119 //! Creates an archive from the file
120 /** \param file File handle to use.
121 \param ignoreCase Searching is performed without regarding the case
122 \param ignorePaths Files are searched for without checking for the directories
123 \return Pointer to newly created archive, or 0 upon error. */
124 virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const =0;
125};
126
127
128} // end namespace io
129} // end namespace irr
130
131#endif
132