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