aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CTarReader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CTarReader.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CTarReader.h133
1 files changed, 133 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CTarReader.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CTarReader.h
new file mode 100644
index 0000000..e2e59c7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CTarReader.h
@@ -0,0 +1,133 @@
1// Copyright (C) 2009-2012 Gaz Davidson
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_TAR_READER_H_INCLUDED__
6#define __C_TAR_READER_H_INCLUDED__
7
8#include "IrrCompileConfig.h"
9
10#ifdef __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_
11
12#include "IReferenceCounted.h"
13#include "IReadFile.h"
14#include "irrArray.h"
15#include "irrString.h"
16#include "IFileSystem.h"
17#include "CFileList.h"
18
19namespace irr
20{
21namespace io
22{
23
24 enum E_TAR_LINK_INDICATOR
25 {
26 ETLI_REGULAR_FILE_OLD = 0 ,
27 ETLI_REGULAR_FILE = '0',
28 ETLI_LINK_TO_ARCHIVED_FILE = '1', // Hard link
29 ETLI_SYMBOLIC_LINK = '2',
30 ETLI_CHAR_SPECIAL_DEVICE = '3',
31 ETLI_BLOCK_SPECIAL_DEVICE = '4',
32 ETLI_DIRECTORY = '5',
33 ETLI_FIFO_SPECIAL_FILE = '6',
34 ETLI_CONTIGUOUS_FILE = '7'
35 };
36
37// byte-align structures
38#include "irrpack.h"
39
40 struct STarHeader
41 {
42 c8 FileName[100];
43 c8 FileMode[8];
44 c8 UserID[8];
45 c8 GroupID[8];
46 c8 Size[12];
47 c8 ModifiedTime[12];
48 c8 Checksum[8];
49 c8 Link;
50 c8 LinkName[100];
51 c8 Magic[6];
52 c8 USTARVersion[2];
53 c8 UserName[32];
54 c8 GroupName[32];
55 c8 DeviceMajor[8];
56 c8 DeviceMinor[8];
57 c8 FileNamePrefix[155];
58 } PACK_STRUCT;
59
60// Default alignment
61#include "irrunpack.h"
62
63 //! Archiveloader capable of loading ZIP Archives
64 class CArchiveLoaderTAR : public IArchiveLoader
65 {
66 public:
67
68 //! Constructor
69 CArchiveLoaderTAR(io::IFileSystem* fs);
70
71 //! returns true if the file maybe is able to be loaded by this class
72 //! based on the file extension (e.g. ".tar")
73 virtual bool isALoadableFileFormat(const io::path& filename) const;
74
75 //! Check if the file might be loaded by this class
76 /** Check might look into the file.
77 \param file File handle to check.
78 \return True if file seems to be loadable. */
79 virtual bool isALoadableFileFormat(io::IReadFile* file) const;
80
81 //! Check to see if the loader can create archives of this type.
82 /** Check based on the archive type.
83 \param fileType The archive type to check.
84 \return True if the archile loader supports this type, false if not */
85 virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const;
86
87 //! Creates an archive from the filename
88 /** \param file File handle to check.
89 \return Pointer to newly created archive, or 0 upon error. */
90 virtual IFileArchive* createArchive(const io::path& filename, bool ignoreCase, bool ignorePaths) const;
91
92 //! creates/loads an archive from the file.
93 //! \return Pointer to the created archive. Returns 0 if loading failed.
94 virtual io::IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const;
95
96 private:
97 io::IFileSystem* FileSystem;
98 };
99
100
101
102 class CTarReader : public virtual IFileArchive, virtual CFileList
103 {
104 public:
105
106 CTarReader(IReadFile* file, bool ignoreCase, bool ignorePaths);
107
108 virtual ~CTarReader();
109
110 //! opens a file by file name
111 virtual IReadFile* createAndOpenFile(const io::path& filename);
112
113 //! opens a file by index
114 virtual IReadFile* createAndOpenFile(u32 index);
115
116 //! returns the list of files
117 virtual const IFileList* getFileList() const;
118
119 //! get the class Type
120 virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_TAR; }
121
122 private:
123
124 u32 populateFileList();
125
126 IReadFile* File;
127 };
128
129} // end namespace io
130} // end namespace irr
131
132#endif // __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_
133#endif // __C_TAR_READER_H_INCLUDED__