aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CPakReader.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CPakReader.h250
1 files changed, 125 insertions, 125 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CPakReader.h b/libraries/irrlicht-1.8/source/Irrlicht/CPakReader.h
index 1a8dbdd..67dd1cb 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CPakReader.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CPakReader.h
@@ -1,125 +1,125 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __C_PAK_READER_H_INCLUDED__ 5#ifndef __C_PAK_READER_H_INCLUDED__
6#define __C_PAK_READER_H_INCLUDED__ 6#define __C_PAK_READER_H_INCLUDED__
7 7
8#include "IrrCompileConfig.h" 8#include "IrrCompileConfig.h"
9 9
10#ifdef __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_ 10#ifdef __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_
11 11
12#include "IReferenceCounted.h" 12#include "IReferenceCounted.h"
13#include "IReadFile.h" 13#include "IReadFile.h"
14#include "irrArray.h" 14#include "irrArray.h"
15#include "irrString.h" 15#include "irrString.h"
16#include "IFileSystem.h" 16#include "IFileSystem.h"
17#include "CFileList.h" 17#include "CFileList.h"
18 18
19namespace irr 19namespace irr
20{ 20{
21namespace io 21namespace io
22{ 22{
23 //! File header containing location and size of the table of contents 23 //! File header containing location and size of the table of contents
24 struct SPAKFileHeader 24 struct SPAKFileHeader
25 { 25 {
26 // Don't change the order of these fields! They must match the order stored on disk. 26 // Don't change the order of these fields! They must match the order stored on disk.
27 c8 tag[4]; 27 c8 tag[4];
28 u32 offset; 28 u32 offset;
29 u32 length; 29 u32 length;
30 }; 30 };
31 31
32 //! An entry in the PAK file's table of contents. 32 //! An entry in the PAK file's table of contents.
33 struct SPAKFileEntry 33 struct SPAKFileEntry
34 { 34 {
35 // Don't change the order of these fields! They must match the order stored on disk. 35 // Don't change the order of these fields! They must match the order stored on disk.
36 c8 name[56]; 36 c8 name[56];
37 u32 offset; 37 u32 offset;
38 u32 length; 38 u32 length;
39 }; 39 };
40 40
41 //! Archiveloader capable of loading PAK Archives 41 //! Archiveloader capable of loading PAK Archives
42 class CArchiveLoaderPAK : public IArchiveLoader 42 class CArchiveLoaderPAK : public IArchiveLoader
43 { 43 {
44 public: 44 public:
45 45
46 //! Constructor 46 //! Constructor
47 CArchiveLoaderPAK(io::IFileSystem* fs); 47 CArchiveLoaderPAK(io::IFileSystem* fs);
48 48
49 //! returns true if the file maybe is able to be loaded by this class 49 //! returns true if the file maybe is able to be loaded by this class
50 //! based on the file extension (e.g. ".zip") 50 //! based on the file extension (e.g. ".zip")
51 virtual bool isALoadableFileFormat(const io::path& filename) const; 51 virtual bool isALoadableFileFormat(const io::path& filename) const;
52 52
53 //! Check if the file might be loaded by this class 53 //! Check if the file might be loaded by this class
54 /** Check might look into the file. 54 /** Check might look into the file.
55 \param file File handle to check. 55 \param file File handle to check.
56 \return True if file seems to be loadable. */ 56 \return True if file seems to be loadable. */
57 virtual bool isALoadableFileFormat(io::IReadFile* file) const; 57 virtual bool isALoadableFileFormat(io::IReadFile* file) const;
58 58
59 //! Check to see if the loader can create archives of this type. 59 //! Check to see if the loader can create archives of this type.
60 /** Check based on the archive type. 60 /** Check based on the archive type.
61 \param fileType The archive type to check. 61 \param fileType The archive type to check.
62 \return True if the archile loader supports this type, false if not */ 62 \return True if the archile loader supports this type, false if not */
63 virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const; 63 virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const;
64 64
65 //! Creates an archive from the filename 65 //! Creates an archive from the filename
66 /** \param file File handle to check. 66 /** \param file File handle to check.
67 \return Pointer to newly created archive, or 0 upon error. */ 67 \return Pointer to newly created archive, or 0 upon error. */
68 virtual IFileArchive* createArchive(const io::path& filename, bool ignoreCase, bool ignorePaths) const; 68 virtual IFileArchive* createArchive(const io::path& filename, bool ignoreCase, bool ignorePaths) const;
69 69
70 //! creates/loads an archive from the file. 70 //! creates/loads an archive from the file.
71 //! \return Pointer to the created archive. Returns 0 if loading failed. 71 //! \return Pointer to the created archive. Returns 0 if loading failed.
72 virtual io::IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const; 72 virtual io::IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const;
73 73
74 //! Returns the type of archive created by this loader 74 //! Returns the type of archive created by this loader
75 virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_PAK; } 75 virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_PAK; }
76 76
77 private: 77 private:
78 io::IFileSystem* FileSystem; 78 io::IFileSystem* FileSystem;
79 }; 79 };
80 80
81 81
82 //! reads from pak 82 //! reads from pak
83 class CPakReader : public virtual IFileArchive, virtual CFileList 83 class CPakReader : public virtual IFileArchive, virtual CFileList
84 { 84 {
85 public: 85 public:
86 86
87 CPakReader(IReadFile* file, bool ignoreCase, bool ignorePaths); 87 CPakReader(IReadFile* file, bool ignoreCase, bool ignorePaths);
88 virtual ~CPakReader(); 88 virtual ~CPakReader();
89 89
90 // file archive methods 90 // file archive methods
91 91
92 //! return the id of the file Archive 92 //! return the id of the file Archive
93 virtual const io::path& getArchiveName() const 93 virtual const io::path& getArchiveName() const
94 { 94 {
95 return File->getFileName(); 95 return File->getFileName();
96 } 96 }
97 97
98 //! opens a file by file name 98 //! opens a file by file name
99 virtual IReadFile* createAndOpenFile(const io::path& filename); 99 virtual IReadFile* createAndOpenFile(const io::path& filename);
100 100
101 //! opens a file by index 101 //! opens a file by index
102 virtual IReadFile* createAndOpenFile(u32 index); 102 virtual IReadFile* createAndOpenFile(u32 index);
103 103
104 //! returns the list of files 104 //! returns the list of files
105 virtual const IFileList* getFileList() const; 105 virtual const IFileList* getFileList() const;
106 106
107 //! get the class Type 107 //! get the class Type
108 virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_PAK; } 108 virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_PAK; }
109 109
110 private: 110 private:
111 111
112 //! scans for a local header, returns false if the header is invalid 112 //! scans for a local header, returns false if the header is invalid
113 bool scanLocalHeader(); 113 bool scanLocalHeader();
114 114
115 IReadFile* File; 115 IReadFile* File;
116 116
117 }; 117 };
118 118
119} // end namespace io 119} // end namespace io
120} // end namespace irr 120} // end namespace irr
121 121
122#endif // __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_ 122#endif // __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_
123 123
124#endif // __C_PAK_READER_H_INCLUDED__ 124#endif // __C_PAK_READER_H_INCLUDED__
125 125