aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CFileList.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CFileList.h')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CFileList.h276
1 files changed, 138 insertions, 138 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CFileList.h b/libraries/irrlicht-1.8/source/Irrlicht/CFileList.h
index f1d2ae3..95a3c9a 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CFileList.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CFileList.h
@@ -1,138 +1,138 @@
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_LIST_H_INCLUDED__ 5#ifndef __C_FILE_LIST_H_INCLUDED__
6#define __C_FILE_LIST_H_INCLUDED__ 6#define __C_FILE_LIST_H_INCLUDED__
7 7
8#include "IFileList.h" 8#include "IFileList.h"
9#include "irrString.h" 9#include "irrString.h"
10#include "irrArray.h" 10#include "irrArray.h"
11 11
12 12
13namespace irr 13namespace irr
14{ 14{
15namespace io 15namespace io
16{ 16{
17 17
18//! An entry in a list of files, can be a folder or a file. 18//! An entry in a list of files, can be a folder or a file.
19struct SFileListEntry 19struct SFileListEntry
20{ 20{
21 //! The name of the file 21 //! The name of the file
22 /** If this is a file or folder in the virtual filesystem and the archive 22 /** If this is a file or folder in the virtual filesystem and the archive
23 was created with the ignoreCase flag then the file name will be lower case. */ 23 was created with the ignoreCase flag then the file name will be lower case. */
24 io::path Name; 24 io::path Name;
25 25
26 //! The name of the file including the path 26 //! The name of the file including the path
27 /** If this is a file or folder in the virtual filesystem and the archive was 27 /** If this is a file or folder in the virtual filesystem and the archive was
28 created with the ignoreDirs flag then it will be the same as Name. */ 28 created with the ignoreDirs flag then it will be the same as Name. */
29 io::path FullName; 29 io::path FullName;
30 30
31 //! The size of the file in bytes 31 //! The size of the file in bytes
32 u32 Size; 32 u32 Size;
33 33
34 //! The ID of the file in an archive 34 //! The ID of the file in an archive
35 /** This is used to link the FileList entry to extra info held about this 35 /** This is used to link the FileList entry to extra info held about this
36 file in an archive, which can hold things like data offset and CRC. */ 36 file in an archive, which can hold things like data offset and CRC. */
37 u32 ID; 37 u32 ID;
38 38
39 //! FileOffset inside an archive 39 //! FileOffset inside an archive
40 u32 Offset; 40 u32 Offset;
41 41
42 //! True if this is a folder, false if not. 42 //! True if this is a folder, false if not.
43 bool IsDirectory; 43 bool IsDirectory;
44 44
45 //! The == operator is provided so that CFileList can slowly search the list! 45 //! The == operator is provided so that CFileList can slowly search the list!
46 bool operator ==(const struct SFileListEntry& other) const 46 bool operator ==(const struct SFileListEntry& other) const
47 { 47 {
48 if (IsDirectory != other.IsDirectory) 48 if (IsDirectory != other.IsDirectory)
49 return false; 49 return false;
50 50
51 return FullName.equals_ignore_case(other.FullName); 51 return FullName.equals_ignore_case(other.FullName);
52 } 52 }
53 53
54 //! The < operator is provided so that CFileList can sort and quickly search the list. 54 //! The < operator is provided so that CFileList can sort and quickly search the list.
55 bool operator <(const struct SFileListEntry& other) const 55 bool operator <(const struct SFileListEntry& other) const
56 { 56 {
57 if (IsDirectory != other.IsDirectory) 57 if (IsDirectory != other.IsDirectory)
58 return IsDirectory; 58 return IsDirectory;
59 59
60 return FullName.lower_ignore_case(other.FullName); 60 return FullName.lower_ignore_case(other.FullName);
61 } 61 }
62}; 62};
63 63
64 64
65//! Implementation of a file list 65//! Implementation of a file list
66class CFileList : public IFileList 66class CFileList : public IFileList
67{ 67{
68public: 68public:
69 69
70 // CFileList methods 70 // CFileList methods
71 71
72 //! Constructor 72 //! Constructor
73 /** \param path The path of this file archive */ 73 /** \param path The path of this file archive */
74 CFileList(const io::path& path, bool ignoreCase, bool ignorePaths); 74 CFileList(const io::path& path, bool ignoreCase, bool ignorePaths);
75 75
76 //! Destructor 76 //! Destructor
77 virtual ~CFileList(); 77 virtual ~CFileList();
78 78
79 //! Add as a file or folder to the list 79 //! Add as a file or folder to the list
80 /** \param fullPath The file name including path, up to the root of the file list. 80 /** \param fullPath The file name including path, up to the root of the file list.
81 \param isDirectory True if this is a directory rather than a file. 81 \param isDirectory True if this is a directory rather than a file.
82 \param offset The offset where the file is stored in an archive 82 \param offset The offset where the file is stored in an archive
83 \param size The size of the file in bytes. 83 \param size The size of the file in bytes.
84 \param id The ID of the file in the archive which owns it */ 84 \param id The ID of the file in the archive which owns it */
85 virtual u32 addItem(const io::path& fullPath, u32 offset, u32 size, bool isDirectory, u32 id=0); 85 virtual u32 addItem(const io::path& fullPath, u32 offset, u32 size, bool isDirectory, u32 id=0);
86 86
87 //! Sorts the file list. You should call this after adding any items to the file list 87 //! Sorts the file list. You should call this after adding any items to the file list
88 virtual void sort(); 88 virtual void sort();
89 89
90 //! Returns the amount of files in the filelist. 90 //! Returns the amount of files in the filelist.
91 virtual u32 getFileCount() const; 91 virtual u32 getFileCount() const;
92 92
93 //! Gets the name of a file in the list, based on an index. 93 //! Gets the name of a file in the list, based on an index.
94 virtual const io::path& getFileName(u32 index) const; 94 virtual const io::path& getFileName(u32 index) const;
95 95
96 //! Gets the full name of a file in the list, path included, based on an index. 96 //! Gets the full name of a file in the list, path included, based on an index.
97 virtual const io::path& getFullFileName(u32 index) const; 97 virtual const io::path& getFullFileName(u32 index) const;
98 98
99 //! Returns the ID of a file in the file list, based on an index. 99 //! Returns the ID of a file in the file list, based on an index.
100 virtual u32 getID(u32 index) const; 100 virtual u32 getID(u32 index) const;
101 101
102 //! Returns true if the file is a directory 102 //! Returns true if the file is a directory
103 virtual bool isDirectory(u32 index) const; 103 virtual bool isDirectory(u32 index) const;
104 104
105 //! Returns the size of a file 105 //! Returns the size of a file
106 virtual u32 getFileSize(u32 index) const; 106 virtual u32 getFileSize(u32 index) const;
107 107
108 //! Returns the offest of a file 108 //! Returns the offest of a file
109 virtual u32 getFileOffset(u32 index) const; 109 virtual u32 getFileOffset(u32 index) const;
110 110
111 //! Searches for a file or folder within the list, returns the index 111 //! Searches for a file or folder within the list, returns the index
112 virtual s32 findFile(const io::path& filename, bool isFolder) const; 112 virtual s32 findFile(const io::path& filename, bool isFolder) const;
113 113
114 //! Returns the base path of the file list 114 //! Returns the base path of the file list
115 virtual const io::path& getPath() const; 115 virtual const io::path& getPath() const;
116 116
117protected: 117protected:
118 118
119 //! Ignore paths when adding or searching for files 119 //! Ignore paths when adding or searching for files
120 bool IgnorePaths; 120 bool IgnorePaths;
121 121
122 //! Ignore case when adding or searching for files 122 //! Ignore case when adding or searching for files
123 bool IgnoreCase; 123 bool IgnoreCase;
124 124
125 //! Path to the file list 125 //! Path to the file list
126 io::path Path; 126 io::path Path;
127 127
128 //! List of files 128 //! List of files
129 core::array<SFileListEntry> Files; 129 core::array<SFileListEntry> Files;
130}; 130};
131 131
132 132
133} // end namespace irr 133} // end namespace irr
134} // end namespace io 134} // end namespace io
135 135
136 136
137#endif 137#endif
138 138