Irrlicht 3D Engine
IFileSystem.h
Go to the documentation of this file.
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 __I_FILE_SYSTEM_H_INCLUDED__
6 #define __I_FILE_SYSTEM_H_INCLUDED__
7 
8 #include "IReferenceCounted.h"
9 #include "IXMLReader.h"
10 #include "IFileArchive.h"
11 
12 namespace irr
13 {
14 namespace video
15 {
16  class IVideoDriver;
17 } // end namespace video
18 namespace io
19 {
20 
21 class IReadFile;
22 class IWriteFile;
23 class IFileList;
24 class IXMLWriter;
25 class IAttributes;
26 
27 
29 
32 class IFileSystem : public virtual IReferenceCounted
33 {
34 public:
35 
37 
41  virtual IReadFile* createAndOpenFile(const path& filename) =0;
42 
44 
54  virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
55 
57 
66  virtual IReadFile* createLimitReadFile(const path& fileName,
67  IReadFile* alreadyOpenedFile, long pos, long areaSize) =0;
68 
70 
81  virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
82 
83 
85 
92  virtual IWriteFile* createAndWriteFile(const path& filename, bool append=false) =0;
93 
95 
116  virtual bool addFileArchive(const path& filename, bool ignoreCase=true,
117  bool ignorePaths=true,
118  E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
119  const core::stringc& password="",
120  IFileArchive** retArchive=0) =0;
121 
123 
148  virtual bool addFileArchive(IReadFile* file, bool ignoreCase=true,
149  bool ignorePaths=true,
150  E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
151  const core::stringc& password="",
152  IFileArchive** retArchive=0) =0;
153 
155 
157  virtual bool addFileArchive(IFileArchive* archive) =0;
158 
160  virtual u32 getFileArchiveCount() const =0;
161 
163 
168  virtual bool removeFileArchive(u32 index) =0;
169 
171 
182  virtual bool removeFileArchive(const path& filename) =0;
183 
185 
190  virtual bool removeFileArchive(const IFileArchive* archive) =0;
191 
193 
196  virtual bool moveFileArchive(u32 sourceIndex, s32 relative) =0;
197 
199  virtual IFileArchive* getFileArchive(u32 index) =0;
200 
202 
204  virtual void addArchiveLoader(IArchiveLoader* loader) =0;
205 
207  virtual u32 getArchiveLoaderCount() const = 0;
208 
210 
213  virtual IArchiveLoader* getArchiveLoader(u32 index) const = 0;
214 
216 
228  _IRR_DEPRECATED_ virtual bool addZipFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
229  {
230  return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_ZIP);
231  }
232 
234 
244  _IRR_DEPRECATED_ virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
245  {
246  return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_FOLDER);
247  }
248 
250 
262  _IRR_DEPRECATED_ virtual bool addPakFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
263  {
264  return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_PAK);
265  }
266 
268 
269  virtual const path& getWorkingDirectory() =0;
270 
272 
276  virtual bool changeWorkingDirectoryTo(const path& newDirectory) =0;
277 
279 
281  virtual path getAbsolutePath(const path& filename) const =0;
282 
284 
286  virtual path getFileDir(const path& filename) const =0;
287 
289 
293  virtual path getFileBasename(const path& filename, bool keepExtension=true) const =0;
294 
296  virtual path& flattenFilename(path& directory, const path& root="/") const =0;
297 
299  virtual path getRelativeFilename(const path& filename, const path& directory) const =0;
300 
302 
305  virtual IFileList* createFileList() =0;
306 
308 
311  virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) =0;
312 
314  virtual EFileSystemType setFileListSystem(EFileSystemType listType) =0;
315 
317 
319  virtual bool existFile(const path& filename) const =0;
320 
322 
328  virtual IXMLReader* createXMLReader(const path& filename) =0;
329 
331 
337  virtual IXMLReader* createXMLReader(IReadFile* file) =0;
338 
340 
346  virtual IXMLReaderUTF8* createXMLReaderUTF8(const path& filename) =0;
347 
349 
355  virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) =0;
356 
358 
362  virtual IXMLWriter* createXMLWriter(const path& filename) =0;
363 
365 
369  virtual IXMLWriter* createXMLWriter(IWriteFile* file) =0;
370 
372 
377  virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0;
378 };
379 
380 
381 } // end namespace io
382 } // end namespace irr
383 
384 #endif
385 
The FileSystem manages files and archives and provides access to them.
Definition: IFileSystem.h:32
virtual _IRR_DEPRECATED_ bool addPakFileArchive(const c8 *filename, bool ignoreCase=true, bool ignorePaths=true)
Adds a pak archive to the file system.
Definition: IFileSystem.h:262
Interface providing methods for making it easier to write XML files.
Definition: IXMLWriter.h:20
The type of this archive is unknown.
Definition: IFileArchive.h:49
Provides a generic interface for attributes and their values and the possiblity to serialize them...
Definition: IAttributes.h:41
#define _IRR_DEPRECATED_
Defines a deprecated macro which generates a warning at compile time.
Definition: irrTypes.h:195
Interface providing read acess to a file.
Definition: IReadFile.h:17
A PKZIP archive.
Definition: IFileArchive.h:28
An ID Software PAK archive.
Definition: IFileArchive.h:37
Provides a list of files and folders.
Definition: IFileList.h:19
Class which is able to create an archive from a file.
Definition: IFileArchive.h:91
char c8
8 bit character variable.
Definition: irrTypes.h:31
IReadFile * createMemoryReadFile(void *memory, long size, const io::path &fileName, bool deleteMemoryWhenDropped)
Internal function, please do not use.
EFileSystemType
FileSystemType: which Filesystem should be used for e.g. browsing.
Definition: IFileArchive.h:18
Everything in the Irrlicht Engine can be found in this namespace.
Definition: aabbox3d.h:12
IReadFile * createLimitReadFile(const io::path &fileName, IReadFile *alreadyOpenedFile, long pos, long areaSize)
Internal function, please do not use.
Interface providing write access to a file.
Definition: IWriteFile.h:17
virtual _IRR_DEPRECATED_ bool addZipFileArchive(const c8 *filename, bool ignoreCase=true, bool ignorePaths=true)
Adds a zip archive to the file system.
Definition: IFileSystem.h:228
signed int s32
32 bit signed variable.
Definition: irrTypes.h:66
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:58
Interface providing easy read access to a XML file.
Definition: irrXML.h:275
E_FILE_ARCHIVE_TYPE
Contains the different types of archives.
Definition: IFileArchive.h:25
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition: IVideoDriver.h:256
virtual _IRR_DEPRECATED_ bool addFolderFileArchive(const c8 *filename, bool ignoreCase=true, bool ignorePaths=true)
Adds an unzipped archive (or basedirectory with subdirectories..) to the file system.
Definition: IFileSystem.h:244
Base class of most objects of the Irrlicht Engine.
A virtual directory.
Definition: IFileArchive.h:34
The FileArchive manages archives and provides access to files inside them.
Definition: IFileArchive.h:53