]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CFileSystem.h
Revert "Fix: Listbox was sometimes sending EGET_LISTBOX_SELECTED_AGAIN instead of...
[irrlicht.git] / source / Irrlicht / CFileSystem.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_FILE_SYSTEM_H_INCLUDED__\r
6 #define __C_FILE_SYSTEM_H_INCLUDED__\r
7 \r
8 #include "IFileSystem.h"\r
9 #include "irrArray.h"\r
10 \r
11 namespace irr\r
12 {\r
13 namespace io\r
14 {\r
15 \r
16         class CZipReader;\r
17 \r
18 /*!\r
19         FileSystem which uses normal files and one zipfile\r
20 */\r
21 class CFileSystem : public IFileSystem\r
22 {\r
23 public:\r
24 \r
25         //! constructor\r
26         CFileSystem();\r
27 \r
28         //! destructor\r
29         virtual ~CFileSystem();\r
30 \r
31         //! opens a file for read access\r
32         IReadFile* createAndOpenFile(const io::path& filename) override;\r
33 \r
34         //! Creates an IReadFile interface for accessing memory like a file.\r
35         IReadFile* createMemoryReadFile(const void* memory, s32 len, const io::path& fileName, bool deleteMemoryWhenDropped = false) override;\r
36 \r
37         //! Creates an IReadFile interface for accessing files inside files\r
38         IReadFile* createLimitReadFile(const io::path& fileName, IReadFile* alreadyOpenedFile, long pos, long areaSize) override;\r
39 \r
40         //! Creates an IWriteFile interface for accessing memory like a file.\r
41         IWriteFile* createMemoryWriteFile(void* memory, s32 len, const io::path& fileName, bool deleteMemoryWhenDropped=false) override;\r
42 \r
43         //! Opens a file for write access.\r
44         IWriteFile* createAndWriteFile(const io::path& filename, bool append=false) override;\r
45 \r
46         //! Adds an archive to the file system.\r
47         virtual bool addFileArchive(const io::path& filename,\r
48                         bool ignoreCase = true, bool ignorePaths = true,\r
49                         E_FILE_ARCHIVE_TYPE archiveType = EFAT_UNKNOWN,\r
50                         const core::stringc& password="",\r
51                         IFileArchive** retArchive = 0) override;\r
52 \r
53         //! Adds an archive to the file system.\r
54         virtual bool addFileArchive(IReadFile* file, bool ignoreCase=true,\r
55                         bool ignorePaths=true,\r
56                         E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,\r
57                         const core::stringc& password="",\r
58                         IFileArchive** retArchive = 0) override;\r
59 \r
60         //! Adds an archive to the file system.\r
61         bool addFileArchive(IFileArchive* archive) override;\r
62 \r
63         //! move the hirarchy of the filesystem. moves sourceIndex relative up or down\r
64         bool moveFileArchive(u32 sourceIndex, s32 relative) override;\r
65 \r
66         //! Adds an external archive loader to the engine.\r
67         void addArchiveLoader(IArchiveLoader* loader) override;\r
68 \r
69         //! Returns the total number of archive loaders added.\r
70         u32 getArchiveLoaderCount() const override;\r
71 \r
72         //! Gets the archive loader by index.\r
73         IArchiveLoader* getArchiveLoader(u32 index) const override;\r
74 \r
75         //! gets the file archive count\r
76         u32 getFileArchiveCount() const override;\r
77 \r
78         //! gets an archive\r
79         IFileArchive* getFileArchive(u32 index) override;\r
80 \r
81         //! removes an archive from the file system.\r
82         bool removeFileArchive(u32 index) override;\r
83 \r
84         //! removes an archive from the file system.\r
85         bool removeFileArchive(const io::path& filename) override;\r
86 \r
87         //! Removes an archive from the file system.\r
88         bool removeFileArchive(const IFileArchive* archive) override;\r
89 \r
90         //! Returns the string of the current working directory\r
91         const io::path& getWorkingDirectory() override;\r
92 \r
93         //! Changes the current Working Directory to the string given.\r
94         //! The string is operating system dependent. Under Windows it will look\r
95         //! like this: "drive:\directory\sudirectory\"\r
96         bool changeWorkingDirectoryTo(const io::path& newDirectory) override;\r
97 \r
98         //! Converts a relative path to an absolute (unique) path, resolving symbolic links\r
99         io::path getAbsolutePath(const io::path& filename) const override;\r
100 \r
101         //! Returns the directory a file is located in.\r
102         /** \param filename: The file to get the directory from */\r
103         io::path getFileDir(const io::path& filename) const override;\r
104 \r
105         //! Returns the base part of a filename, i.e. the name without the directory\r
106         //! part. If no directory is prefixed, the full name is returned.\r
107         /** \param filename: The file to get the basename from */\r
108         io::path getFileBasename(const io::path& filename, bool keepExtension=true) const override;\r
109 \r
110         //! flatten a path and file name for example: "/you/me/../." becomes "/you"\r
111         io::path& flattenFilename( io::path& directory, const io::path& root = "/" ) const override;\r
112 \r
113         //! Get the relative filename, relative to the given directory\r
114         path getRelativeFilename(const path& filename, const path& directory) const override;\r
115 \r
116         EFileSystemType setFileListSystem(EFileSystemType listType) override;\r
117 \r
118         //! Creates a list of files and directories in the current working directory\r
119         //! and returns it.\r
120         IFileList* createFileList() override;\r
121 \r
122         //! Creates an empty filelist\r
123         IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) override;\r
124 \r
125         //! determines if a file exists and would be able to be opened.\r
126         bool existFile(const io::path& filename) const override;\r
127 \r
128 private:\r
129 \r
130         //! Currently used FileSystemType\r
131         EFileSystemType FileSystemType;\r
132         //! WorkingDirectory for Native and Virtual filesystems\r
133         io::path WorkingDirectory [2];\r
134         //! currently attached ArchiveLoaders\r
135         core::array<IArchiveLoader*> ArchiveLoader;\r
136         //! currently attached Archives\r
137         core::array<IFileArchive*> FileArchives;\r
138 };\r
139 \r
140 \r
141 } // end namespace irr\r
142 } // end namespace io\r
143 \r
144 #endif\r
145 \r