Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IFileSystem.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_FILE_SYSTEM_HPP_INCLUDED
6#define NIRT_I_FILE_SYSTEM_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/IReferenceCounted.hpp>
9#include <nirtcpp/core/engine/IXMLReader.hpp>
10#include <nirtcpp/core/engine/IXMLWriter.hpp>
11#include <nirtcpp/core/engine/IFileArchive.hpp>
12
13namespace nirt
14{
15namespace video
16{
17 class IVideoDriver;
18} // end namespace video
19namespace io
20{
21
22class IReadFile;
23class IWriteFile;
24class IFileList;
25class IAttributes;
26
27
29
32class IFileSystem : public virtual IReferenceCounted
33{
34public:
35
37
41 virtual IReadFile* createAndOpenFile(const path& filename) =0;
42
44
54 virtual IReadFile* createMemoryReadFile(const 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,
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,
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 NIRT_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 NIRT_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 NIRT_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
306
308
311 virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) =0;
312
315
317
319 virtual bool existFile(const path& filename) const =0;
320
322
328 virtual IXMLReader* createXMLReader(const path& filename) =0;
329
331
338
340
346 virtual IXMLReaderUTF8* createXMLReaderUTF8(const path& filename) =0;
347
349
356
358
362 virtual IXMLWriterUTF8* createXMLWriterUTF8(const path& filename) =0;
363
365
370
372
376 virtual IXMLWriter* createXMLWriter(const path& filename) =0;
377
379
384
386
392};
393
394
395} // end namespace io
396} // end namespace nirt
397
398#endif
Base class of most objects of the Nirtcpp Engine.
Definition IReferenceCounted.hpp:46
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
Class which is able to create an archive from a file.
Definition IFileArchive.hpp:95
Provides a generic interface for attributes and their values and the possibility to serialize them.
Definition IAttributes.hpp:42
The FileArchive manages archives and provides access to files inside them.
Definition IFileArchive.hpp:54
Provides a list of files and folders.
Definition IFileList.hpp:20
The FileSystem manages files and archives and provides access to them.
Definition IFileSystem.hpp:33
virtual NIRT_DEPRECATED bool addPakFileArchive(const c8 *filename, bool ignoreCase=true, bool ignorePaths=true)
Adds a pak archive to the file system.
Definition IFileSystem.hpp:262
virtual IXMLReaderUTF8 * createXMLReaderUTF8(IReadFile *file)=0
Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
virtual path getAbsolutePath(const path &filename) const =0
Converts a relative path to an absolute (unique) path, resolving symbolic links if required.
virtual IXMLWriterUTF8 * createXMLWriterUTF8(const path &filename)=0
Creates a XML Writer from a file which will write ASCII/UTF-8 characters (char*).
virtual bool removeFileArchive(const path &filename)=0
Removes an archive from the file system.
virtual path getFileBasename(const path &filename, bool keepExtension=true) const =0
Get the base part of a filename, i.e. the name without the directory part.
virtual u32 getFileArchiveCount() const =0
Get the number of archives currently attached to the file system.
virtual bool removeFileArchive(const IFileArchive *archive)=0
Removes an archive from the file system.
virtual IWriteFile * createMemoryWriteFile(void *memory, s32 len, const path &fileName, bool deleteMemoryWhenDropped=false)=0
Creates an IWriteFile interface for accessing memory like a file.
virtual IXMLReader * createXMLReader(IReadFile *file)=0
Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
virtual path getRelativeFilename(const path &filename, const path &directory) const =0
Get the relative filename, relative to the given directory.
virtual path getFileDir(const path &filename) const =0
Get the directory a file is located in.
virtual IXMLReader * createXMLReader(const path &filename)=0
Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
virtual EFileSystemType setFileListSystem(EFileSystemType listType)=0
Set the active type of file system.
virtual bool moveFileArchive(u32 sourceIndex, s32 relative)=0
Changes the search order of attached archives.
virtual IArchiveLoader * getArchiveLoader(u32 index) const =0
Retrieve the given archive loader.
virtual bool removeFileArchive(u32 index)=0
Removes an archive from the file system.
virtual IFileList * createEmptyFileList(const io::path &path, bool ignoreCase, bool ignorePaths)=0
Creates an empty filelist.
virtual IAttributes * createEmptyAttributes(video::IVideoDriver *driver=0)=0
Creates a new empty collection of attributes, usable for serialization and more.
virtual u32 getArchiveLoaderCount() const =0
Gets the number of archive loaders currently added.
virtual bool changeWorkingDirectoryTo(const path &newDirectory)=0
Changes the current working directory.
virtual bool addFileArchive(const path &filename, bool ignoreCase=true, bool ignorePaths=true, E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN, const core::stringc &password="", IFileArchive **retArchive=0)=0
Adds an archive to the file system.
virtual path & flattenFilename(path &directory, const path &root="/") const =0
flatten a path and file name for example: "/you/me/../." becomes "/you"
virtual bool addFileArchive(IReadFile *file, bool ignoreCase=true, bool ignorePaths=true, E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN, const core::stringc &password="", IFileArchive **retArchive=0)=0
Adds an archive to the file system.
virtual IFileArchive * getFileArchive(u32 index)=0
Get the archive at a given index.
virtual IWriteFile * createAndWriteFile(const path &filename, bool append=false)=0
Opens a file for write access.
virtual NIRT_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.hpp:244
virtual IXMLReaderUTF8 * createXMLReaderUTF8(const path &filename)=0
Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
virtual IXMLWriterUTF8 * createXMLWriterUTF8(IWriteFile *file)=0
Creates a XML Writer from a file which will write ASCII/UTF-8 characters (char*).
virtual NIRT_DEPRECATED bool addZipFileArchive(const c8 *filename, bool ignoreCase=true, bool ignorePaths=true)
Adds a zip archive to the file system.
Definition IFileSystem.hpp:228
virtual IReadFile * createAndOpenFile(const path &filename)=0
Opens a file for read access.
virtual const path & getWorkingDirectory()=0
Get the current working directory.
virtual IFileList * createFileList()=0
Creates a list of files and directories in the current working directory and returns it.
virtual IXMLWriter * createXMLWriter(IWriteFile *file)=0
Creates a XML Writer from a file.
virtual void addArchiveLoader(IArchiveLoader *loader)=0
Adds an external archive loader to the engine.
virtual bool existFile(const path &filename) const =0
Determines if a file exists and could be opened.
virtual IReadFile * createMemoryReadFile(const void *memory, s32 len, const path &fileName, bool deleteMemoryWhenDropped=false)=0
Creates an IReadFile interface for accessing memory like a file.
virtual bool addFileArchive(IFileArchive *archive)=0
Adds an archive to the file system.
virtual IXMLWriter * createXMLWriter(const path &filename)=0
Creates a XML Writer from a file.
virtual IReadFile * createLimitReadFile(const path &fileName, IReadFile *alreadyOpenedFile, long pos, long areaSize)=0
Creates an IReadFile interface for accessing files inside files.
Interface providing easy read access to a XML file.
Definition irrXML.hpp:277
Interface providing methods for making it easier to write XML files.
Definition irrXML.hpp:377
Interface providing read access to a file.
Definition IReadFile.hpp:19
Interface providing write access to a file.
Definition IWriteFile.hpp:18
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition IVideoDriver.hpp:152
E_FILE_ARCHIVE_TYPE
Contains the different types of archives.
Definition IFileArchive.hpp:26
@ EFAT_PAK
An ID Software PAK archive.
Definition IFileArchive.hpp:37
@ EFAT_ZIP
A PKZIP archive.
Definition IFileArchive.hpp:28
@ EFAT_FOLDER
A virtual directory.
Definition IFileArchive.hpp:34
@ EFAT_UNKNOWN
The type of this archive is unknown.
Definition IFileArchive.hpp:49
EFileSystemType
FileSystemType: which filesystem should be used for e.g. browsing.
Definition IFileArchive.hpp:19
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
char c8
8 bit character variable.
Definition irrTypes.hpp:37

Nirtcpp    @cppfx.xyz

Utxcpp    utx::print