OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreFileSystem.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __FileSystem_H__
29 #define __FileSystem_H__
30 
31 #include "OgrePrerequisites.h"
32 
33 #include "OgreArchive.h"
34 #include "OgreArchiveFactory.h"
35 #include "OgreHeaderPrefix.h"
36 
37 namespace Ogre {
38 
49  {
50  protected:
61  void findFiles(const String& pattern, bool recursive, bool dirs,
62  StringVector* simpleList, FileInfoList* detailList) const;
63 
65  public:
66  FileSystemArchive(const String& name, const String& archType );
68 
70  bool isCaseSensitive(void) const;
71 
73  void load();
75  void unload();
76 
78  DataStreamPtr open(const String& filename, bool readOnly = true) const;
79 
81  DataStreamPtr create(const String& filename) const;
82 
84  void remove(const String& filename) const;
85 
87  StringVectorPtr list(bool recursive = true, bool dirs = false);
88 
90  FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
91 
93  StringVectorPtr find(const String& pattern, bool recursive = true,
94  bool dirs = false);
95 
97  FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true,
98  bool dirs = false) const;
99 
101  bool exists(const String& filename);
102 
104  time_t getModifiedTime(const String& filename);
105 
109  static void setIgnoreHidden(bool ignore)
110  {
111  msIgnoreHidden = ignore;
112  }
113 
115  static bool getIgnoreHidden()
116  {
117  return msIgnoreHidden;
118  }
119 
120  static bool msIgnoreHidden;
121  };
122 
124  //class _OgrePrivate FileSystemArchiveFactory : public ArchiveFactory
126  {
127  public:
130  const String& getType(void) const;
132  Archive *createInstance( const String& name )
133  {
134  return OGRE_NEW FileSystemArchive(name, "FileSystem");
135  }
137  void destroyInstance( Archive* arch) { delete arch; }
138  };
139 
143 }
144 
145 #include "OgreHeaderSuffix.h"
146 
147 #endif
Archive * createInstance(const String &name)
Creates a new object.
#define OGRE_AUTO_MUTEX
#define _OgreExport
Definition: OgrePlatform.h:233
Specialisation of ArchiveFactory for FileSystem files.
void destroyInstance(Archive *arch)
Destroys an object which was created by this factory.
static void setIgnoreHidden(bool ignore)
Set whether filesystem enumeration will include hidden files or not.
vector< String >::type StringVector
static bool getIgnoreHidden()
Get whether hidden files are ignored during filesystem enumeration.
Abstract factory class, archive codec plugins can register concrete subclasses of this...
vector< FileInfo >::type FileInfoList
Definition: OgreArchive.h:69
#define OGRE_NEW
Archive-handling class.
Definition: OgreArchive.h:88
_StringBase String
Specialisation of the Archive class to allow reading of files from filesystem folders / directories...