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