| Irrlicht 3D Engine |

IFileSystem.h
Go to the documentation of this file.

    00001 // Copyright (C) 2002-2012 Nikolaus Gebhardt
    00002 // This file is part of the "Irrlicht Engine".
    00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
    00004
    00005 #ifndef __I_FILE_SYSTEM_H_INCLUDED__
    00006 #define __I_FILE_SYSTEM_H_INCLUDED__
    00007
    00008 #include "IReferenceCounted.h"
    00009 #include "IXMLReader.h"
    00010 #include "IFileArchive.h"
    00011
    00012 namespace irr
    00013 {
    00014 namespace video
    00015 {
    00016     class IVideoDriver;
    00017 } // end namespace video
    00018 namespace io
    00019 {
    00020
    00021 class IReadFile;
    00022 class IWriteFile;
    00023 class IFileList;
    00024 class IXMLWriter;
    00025 class IAttributes;
    00026
    00027
    00029
    00032 class IFileSystem : public virtual IReferenceCounted
    00033 {
    00034 public:
    00035
    00037
    00041     virtual IReadFile* createAndOpenFile(const path& filename) =0;
    00042
    00044
    00054     virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
    00055
    00057
    00066     virtual IReadFile* createLimitReadFile(const path& fileName,
    00067             IReadFile* alreadyOpenedFile, long pos, long areaSize) =0;
    00068
    00070
    00081     virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
    00082
    00083
    00085
    00092     virtual IWriteFile* createAndWriteFile(const path& filename, bool append=false) =0;
    00093
    00095
    00116     virtual bool addFileArchive(const path& filename, bool ignoreCase=true,
    00117             bool ignorePaths=true,
    00118             E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
    00119             const core::stringc& password="",
    00120             IFileArchive** retArchive=0) =0;
    00121
    00123
    00148     virtual bool addFileArchive(IReadFile* file, bool ignoreCase=true,
    00149             bool ignorePaths=true,
    00150             E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
    00151             const core::stringc& password="",
    00152             IFileArchive** retArchive=0) =0;
    00153
    00155
    00157     virtual bool addFileArchive(IFileArchive* archive) =0;
    00158
    00160     virtual u32 getFileArchiveCount() const =0;
    00161
    00163
    00168     virtual bool removeFileArchive(u32 index) =0;
    00169
    00171
    00182     virtual bool removeFileArchive(const path& filename) =0;
    00183
    00185
    00190     virtual bool removeFileArchive(const IFileArchive* archive) =0;
    00191
    00193
    00196     virtual bool moveFileArchive(u32 sourceIndex, s32 relative) =0;
    00197
    00199     virtual IFileArchive* getFileArchive(u32 index) =0;
    00200
    00202
    00204     virtual void addArchiveLoader(IArchiveLoader* loader) =0;
    00205
    00207     virtual u32 getArchiveLoaderCount() const = 0;
    00208
    00210
    00213     virtual IArchiveLoader* getArchiveLoader(u32 index) const = 0;
    00214
    00216
    00228     _IRR_DEPRECATED_ virtual bool addZipFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
    00229     {
    00230         return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_ZIP);
    00231     }
    00232
    00234
    00244     _IRR_DEPRECATED_ virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
    00245     {
    00246         return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_FOLDER);
    00247     }
    00248
    00250
    00262     _IRR_DEPRECATED_ virtual bool addPakFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
    00263     {
    00264         return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_PAK);
    00265     }
    00266
    00268
    00269     virtual const path& getWorkingDirectory() =0;
    00270
    00272
    00276     virtual bool changeWorkingDirectoryTo(const path& newDirectory) =0;
    00277
    00279
    00281     virtual path getAbsolutePath(const path& filename) const =0;
    00282
    00284
    00286     virtual path getFileDir(const path& filename) const =0;
    00287
    00289
    00293     virtual path getFileBasename(const path& filename, bool keepExtension=true) const =0;
    00294
    00296     virtual path& flattenFilename(path& directory, const path& root="/") const =0;
    00297
    00299     virtual path getRelativeFilename(const path& filename, const path& directory) const =0;
    00300
    00302
    00305     virtual IFileList* createFileList() =0;
    00306
    00308
    00311     virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) =0;
    00312
    00314     virtual EFileSystemType setFileListSystem(EFileSystemType listType) =0;
    00315
    00317
    00319     virtual bool existFile(const path& filename) const =0;
    00320
    00322
    00328     virtual IXMLReader* createXMLReader(const path& filename) =0;
    00329
    00331
    00337     virtual IXMLReader* createXMLReader(IReadFile* file) =0;
    00338
    00340
    00346     virtual IXMLReaderUTF8* createXMLReaderUTF8(const path& filename) =0;
    00347
    00349
    00355     virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) =0;
    00356
    00358
    00362     virtual IXMLWriter* createXMLWriter(const path& filename) =0;
    00363
    00365
    00369     virtual IXMLWriter* createXMLWriter(IWriteFile* file) =0;
    00370
    00372
    00377     virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0;
    00378 };
    00379
    00380
    00381 } // end namespace io
    00382 } // end namespace irr
    00383
    00384 #endif
    00385