aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CFileSystem.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CFileSystem.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CFileSystem.h173
1 files changed, 173 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CFileSystem.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CFileSystem.h
new file mode 100644
index 0000000..0af5356
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CFileSystem.h
@@ -0,0 +1,173 @@
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_FILE_SYSTEM_H_INCLUDED__
6#define __C_FILE_SYSTEM_H_INCLUDED__
7
8#include "IFileSystem.h"
9#include "irrArray.h"
10
11namespace irr
12{
13namespace io
14{
15
16 class CZipReader;
17 class CPakReader;
18 class CMountPointReader;
19
20/*!
21 FileSystem which uses normal files and one zipfile
22*/
23class CFileSystem : public IFileSystem
24{
25public:
26
27 //! constructor
28 CFileSystem();
29
30 //! destructor
31 virtual ~CFileSystem();
32
33 //! opens a file for read access
34 virtual IReadFile* createAndOpenFile(const io::path& filename);
35
36 //! Creates an IReadFile interface for accessing memory like a file.
37 virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const io::path& fileName, bool deleteMemoryWhenDropped = false);
38
39 //! Creates an IReadFile interface for accessing files inside files
40 virtual IReadFile* createLimitReadFile(const io::path& fileName, IReadFile* alreadyOpenedFile, long pos, long areaSize);
41
42 //! Creates an IWriteFile interface for accessing memory like a file.
43 virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const io::path& fileName, bool deleteMemoryWhenDropped=false);
44
45 //! Opens a file for write access.
46 virtual IWriteFile* createAndWriteFile(const io::path& filename, bool append=false);
47
48 //! Adds an archive to the file system.
49 virtual bool addFileArchive(const io::path& filename,
50 bool ignoreCase = true, bool ignorePaths = true,
51 E_FILE_ARCHIVE_TYPE archiveType = EFAT_UNKNOWN,
52 const core::stringc& password="",
53 IFileArchive** retArchive = 0);
54
55 //! Adds an archive to the file system.
56 virtual bool addFileArchive(IReadFile* file, bool ignoreCase=true,
57 bool ignorePaths=true,
58 E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
59 const core::stringc& password="",
60 IFileArchive** retArchive = 0);
61
62 //! Adds an archive to the file system.
63 virtual bool addFileArchive(IFileArchive* archive);
64
65 //! move the hirarchy of the filesystem. moves sourceIndex relative up or down
66 virtual bool moveFileArchive(u32 sourceIndex, s32 relative);
67
68 //! Adds an external archive loader to the engine.
69 virtual void addArchiveLoader(IArchiveLoader* loader);
70
71 //! Returns the total number of archive loaders added.
72 virtual u32 getArchiveLoaderCount() const;
73
74 //! Gets the archive loader by index.
75 virtual IArchiveLoader* getArchiveLoader(u32 index) const;
76
77 //! gets the file archive count
78 virtual u32 getFileArchiveCount() const;
79
80 //! gets an archive
81 virtual IFileArchive* getFileArchive(u32 index);
82
83 //! removes an archive from the file system.
84 virtual bool removeFileArchive(u32 index);
85
86 //! removes an archive from the file system.
87 virtual bool removeFileArchive(const io::path& filename);
88
89 //! Removes an archive from the file system.
90 virtual bool removeFileArchive(const IFileArchive* archive);
91
92 //! Returns the string of the current working directory
93 virtual const io::path& getWorkingDirectory();
94
95 //! Changes the current Working Directory to the string given.
96 //! The string is operating system dependent. Under Windows it will look
97 //! like this: "drive:\directory\sudirectory\"
98 virtual bool changeWorkingDirectoryTo(const io::path& newDirectory);
99
100 //! Converts a relative path to an absolute (unique) path, resolving symbolic links
101 virtual io::path getAbsolutePath(const io::path& filename) const;
102
103 //! Returns the directory a file is located in.
104 /** \param filename: The file to get the directory from */
105 virtual io::path getFileDir(const io::path& filename) const;
106
107 //! Returns the base part of a filename, i.e. the name without the directory
108 //! part. If no directory is prefixed, the full name is returned.
109 /** \param filename: The file to get the basename from */
110 virtual io::path getFileBasename(const io::path& filename, bool keepExtension=true) const;
111
112 //! flatten a path and file name for example: "/you/me/../." becomes "/you"
113 virtual io::path& flattenFilename( io::path& directory, const io::path& root = "/" ) const;
114
115 //! Get the relative filename, relative to the given directory
116 virtual path getRelativeFilename(const path& filename, const path& directory) const;
117
118 virtual EFileSystemType setFileListSystem(EFileSystemType listType);
119
120 //! Creates a list of files and directories in the current working directory
121 //! and returns it.
122 virtual IFileList* createFileList();
123
124 //! Creates an empty filelist
125 virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths);
126
127 //! determines if a file exists and would be able to be opened.
128 virtual bool existFile(const io::path& filename) const;
129
130 //! Creates a XML Reader from a file.
131 virtual IXMLReader* createXMLReader(const io::path& filename);
132
133 //! Creates a XML Reader from a file.
134 virtual IXMLReader* createXMLReader(IReadFile* file);
135
136 //! Creates a XML Reader from a file.
137 virtual IXMLReaderUTF8* createXMLReaderUTF8(const io::path& filename);
138
139 //! Creates a XML Reader from a file.
140 virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file);
141
142 //! Creates a XML Writer from a file.
143 virtual IXMLWriter* createXMLWriter(const io::path& filename);
144
145 //! Creates a XML Writer from a file.
146 virtual IXMLWriter* createXMLWriter(IWriteFile* file);
147
148 //! Creates a new empty collection of attributes, usable for serialization and more.
149 virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver);
150
151private:
152
153 // don't expose, needs refactoring
154 bool changeArchivePassword(const path& filename,
155 const core::stringc& password,
156 IFileArchive** archive = 0);
157
158 //! Currently used FileSystemType
159 EFileSystemType FileSystemType;
160 //! WorkingDirectory for Native and Virtual filesystems
161 io::path WorkingDirectory [2];
162 //! currently attached ArchiveLoaders
163 core::array<IArchiveLoader*> ArchiveLoader;
164 //! currently attached Archives
165 core::array<IFileArchive*> FileArchives;
166};
167
168
169} // end namespace irr
170} // end namespace io
171
172#endif
173