diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CMountPointReader.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CMountPointReader.h b/libraries/irrlicht-1.8/source/Irrlicht/CMountPointReader.h new file mode 100644 index 0000000..a5ea86c --- /dev/null +++ b/libraries/irrlicht-1.8/source/Irrlicht/CMountPointReader.h | |||
@@ -0,0 +1,89 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
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 __C_MOUNT_READER_H_INCLUDED__ | ||
6 | #define __C_MOUNT_READER_H_INCLUDED__ | ||
7 | |||
8 | #include "IrrCompileConfig.h" | ||
9 | |||
10 | #ifdef __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ | ||
11 | |||
12 | #include "IFileSystem.h" | ||
13 | #include "CFileList.h" | ||
14 | |||
15 | namespace irr | ||
16 | { | ||
17 | namespace io | ||
18 | { | ||
19 | |||
20 | //! Archiveloader capable of loading MountPoint Archives | ||
21 | class CArchiveLoaderMount : public IArchiveLoader | ||
22 | { | ||
23 | public: | ||
24 | |||
25 | //! Constructor | ||
26 | CArchiveLoaderMount(io::IFileSystem* fs); | ||
27 | |||
28 | //! returns true if the file maybe is able to be loaded by this class | ||
29 | //! based on the file extension (e.g. ".zip") | ||
30 | virtual bool isALoadableFileFormat(const io::path& filename) const; | ||
31 | |||
32 | //! Check if the file might be loaded by this class | ||
33 | /** Check might look into the file. | ||
34 | \param file File handle to check. | ||
35 | \return True if file seems to be loadable. */ | ||
36 | virtual bool isALoadableFileFormat(io::IReadFile* file) const; | ||
37 | |||
38 | //! Check to see if the loader can create archives of this type. | ||
39 | /** Check based on the archive type. | ||
40 | \param fileType The archive type to check. | ||
41 | \return True if the archile loader supports this type, false if not */ | ||
42 | virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const; | ||
43 | |||
44 | //! Creates an archive from the filename | ||
45 | /** \param file File handle to check. | ||
46 | \return Pointer to newly created archive, or 0 upon error. */ | ||
47 | virtual IFileArchive* createArchive(const io::path& filename, bool ignoreCase, bool ignorePaths) const; | ||
48 | |||
49 | //! creates/loads an archive from the file. | ||
50 | //! \return Pointer to the created archive. Returns 0 if loading failed. | ||
51 | virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const; | ||
52 | |||
53 | private: | ||
54 | io::IFileSystem* FileSystem; | ||
55 | }; | ||
56 | |||
57 | //! A File Archive which uses a mountpoint | ||
58 | class CMountPointReader : public virtual IFileArchive, virtual CFileList | ||
59 | { | ||
60 | public: | ||
61 | |||
62 | //! Constructor | ||
63 | CMountPointReader(IFileSystem *parent, const io::path& basename, | ||
64 | bool ignoreCase, bool ignorePaths); | ||
65 | |||
66 | //! opens a file by index | ||
67 | virtual IReadFile* createAndOpenFile(u32 index); | ||
68 | |||
69 | //! opens a file by file name | ||
70 | virtual IReadFile* createAndOpenFile(const io::path& filename); | ||
71 | |||
72 | //! returns the list of files | ||
73 | virtual const IFileList* getFileList() const; | ||
74 | |||
75 | //! get the class Type | ||
76 | virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_FOLDER; } | ||
77 | |||
78 | private: | ||
79 | |||
80 | core::array<io::path> RealFileNames; | ||
81 | |||
82 | IFileSystem *Parent; | ||
83 | void buildDirectory(); | ||
84 | }; | ||
85 | } // io | ||
86 | } // irr | ||
87 | |||
88 | #endif // __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ | ||
89 | #endif // __C_MOUNT_READER_H_INCLUDED__ | ||